1導入
この講義で重要なのは、行列の積は成分ごとの掛け算ではなく、線型写像の合成を座標で表すように定義された演算であるということである。
行列積の規則は不自然に見えやすいが、列ベクトルへ作用させる操作と写像の合成を要求すると、この形が自然に現れる。
1Introduction
The product of matrices is not entrywise multiplication. It is defined so that matrices represent composition of linear maps in coordinates.
The rule for matrix multiplication can look unnatural at first, but it appears naturally once we require compatibility with the action on column vectors and with composition of maps.
2用語ようごと定義ていぎ
A を m\times n 行列ぎょうれつmatrix、B を n\times p 行列ぎょうれつmatrixとする。このとき積せき AB は m\times p 行列ぎょうれつmatrixであり、成分せいぶんcomponentは
(AB)_{ij}=\sum_{k=1}^n a_{ik}b_{kj}
で定義ていぎされる。内側うちがわのサイズ n が一致いっちすることが必要ひつようである。
この成分公式せいぶんこうしきは、暗記あんきする規則きそくではない。B の第だい j 列れつcolumnを b^{(j)} と書かくと、AB の第だい j 列れつcolumnは
A b^{(j)}
である。つまり、B が標準基底ひょうじゅんきていstandard basisの第だい j 方向ほうこうを b^{(j)} へ送おくり、その結果けっかに A を作用さようさせたものが、AB の第だい j 列れつcolumnになる。ここから第だい i 成分せいぶんcomponentを取とると、A の第だい i 行ぎょうrowと b^{(j)} の内積的ないせきてきな和わになり、
(AB)_{ij}
=
a_{i1}b_{1j}+a_{i2}b_{2j}+\cdots+a_{in}b_{nj}
=
\sum_{k=1}^n a_{ik}b_{kj}
が得えられる。したがって、列れつcolumnへの作用さようと写像しゃぞうmapの合成ごうせいを先さきに考かんがえると、成分公式せいぶんこうしきは後あとから必然的ひつぜんてきに導みちびかれる。
3方針ほうしん
まず数表すうひょうとして計算けいさんし、つぎに列れつベクトルcolumn vectorへの作用さようとして解釈かいしゃくする。最後さいごに、行列積ぎょうれつせきが線型写像せんけいしゃぞうlinear mapの合成ごうせいを表現ひょうげんすることを確認かくにんする。
data/lecture/math/linear-algebra/matrix-operations.lecture.n.md
4直感的ちょっかんてきな説明せつめい
A の列れつcolumnを a_1,\dots,a_n とする。x=(x_1,\dots,x_n)^T に対たいして
Ax=x_1a_1+\cdots+x_na_n
である。つまり、行列ぎょうれつmatrixは入力にゅうりょくの成分せいぶんcomponentを係数けいすうcoefficientとして、列れつベクトルcolumn vectorを線型結合せんけいけつごうlinear combinationする装置そうちである。
この装置そうちを 2 回かい連続れんぞくで作用さようさせると、行列積ぎょうれつせきが現あらわれる。したがって ABx は「まず B を作用さようさせ、つぎに A を作用さようさせる」ことを意味いみする。
5厳密げんみつな説明せつめい
B:K^p\to K^n、A:K^n\to K^m と考察こうさつする。x\in K^p に対たいして
x\longmapsto Bx\longmapsto A(Bx)
となるため、合成写像ごうせいしゃぞうは A\circ B であり、その表現行列ひょうげんぎょうれつrepresentation matrixが AB である。記号きごうの順序じゅんじょは右みぎから作用さようするため、先さきに実行じっこうする行列ぎょうれつmatrixが右側みぎがわに置おかれる。
2Terms and definitions
Let A be an m\times n matrix行列ぎょうれつ and B an n\times p matrix. Then AB is an m\times p matrix with entries
(AB)_{ij}=\sum_{k=1}^n a_{ik}b_{kj}.
The inner sizes must match.
This formula is not merely a rule to memorize. If b^{(j)} is the j-th column列れつ of B, then the j-th column of AB is
Ab^{(j)}.
Thus B first sends the j-th standard-basis direction to b^{(j)}, and then A acts on that result. Reading the i-th component gives
(AB)_{ij}
=
a_{i1}b_{1j}+a_{i2}b_{2j}+\cdots+a_{in}b_{nj}
=
\sum_{k=1}^n a_{ik}b_{kj}.
3Strategy
First calculate matrix products as tables of numbers, then interpret them as actions on column vectors列れつベクトル. Finally, check that matrix multiplication represents composition of linear maps線型写像せんけいしゃぞう.
data/lecture/math/linear-algebra/matrix-operations.lecture.n.md
4Intuitive explanation
Let the columns of A be a_1,\ldots,a_n. For x=(x_1,\ldots,x_n)^T,
Ax=x_1a_1+\cdots+x_na_n.
A matrix therefore uses the components of the input as coefficients係数けいすう and forms a linear combination線型結合せんけいけつごう of its columns.
Applying this device twice produces matrix multiplication. Thus ABx means: apply B first, then apply A.
5Precise explanation
Regard B:K^p\to K^n and A:K^n\to K^m. For x\in K^p,
x\longmapsto Bx\longmapsto A(Bx).
Therefore the composite map is A\circ B, and its representation matrix表現行列ひょうげんぎょうれつ is AB. Since matrices act from the right on vectors, the matrix applied first appears on the right.
6列れつcolumnによる解釈かいしゃく
A の列れつcolumnを a_1,\ldots,a_n、x=(x_1,\ldots,x_n)^T とすると、
Ax=x_1a_1+\cdots+x_na_n
である。つまり、行列ぎょうれつmatrixは入力にゅうりょくの成分せいぶんcomponentを係数けいすうcoefficientとして、列れつcolumnの線型結合せんけいけつごうlinear combinationを作つくる。B の第だい j 列れつcolumnを b^{(j)} とすると、AB の第だい j 列れつcolumnは
Ab^{(j)}
である。
7合成ごうせいによる解釈かいしゃく
B:K^p\to K^n、A:K^n\to K^m と見みると、
x\mapsto Bx\mapsto A(Bx)
である。したがって合成写像ごうせいしゃぞうは AB で表あらわされる。ABx では、B が先さきに作用さようし、A が後あとに作用さようする。
8具体例ぐたいれい
A=\begin{pmatrix}1&2\\0&1\end{pmatrix},\qquad
B=\begin{pmatrix}3&0\\1&2\end{pmatrix}
とする。このとき
AB=\begin{pmatrix}5&4\\1&2\end{pmatrix},\qquad
BA=\begin{pmatrix}3&6\\1&4\end{pmatrix}
である。したがって一般いっぱんに AB=BA ではない。順序じゅんじょが変かわると、合成ごうせいする写像しゃぞうmapの順序じゅんじょも変化へんかする。
6Column interpretation
If the columns of A are a_1,\ldots,a_n and x=(x_1,\ldots,x_n)^T, then
Ax=x_1a_1+\cdots+x_na_n.
So a matrix uses the components of the input as coefficients and forms a linear combination線型結合せんけいけつごう of its columns. If b^{(j)} is the j-th column of B, then the j-th column of AB is
Ab^{(j)}.
7Composition interpretation
Regard B:K^p\to K^n and A:K^n\to K^m. Then
x\mapsto Bx\mapsto A(Bx),
so the composite map is represented by AB. In ABx, B acts first and A acts second.
8Worked example
Let
A=\begin{pmatrix}1&2\\0&1\end{pmatrix},\qquad
B=\begin{pmatrix}3&0\\1&2\end{pmatrix}.
Then
AB=\begin{pmatrix}5&4\\1&2\end{pmatrix},\qquad
BA=\begin{pmatrix}3&6\\1&4\end{pmatrix}.
Thus AB and BA are generally different because the order of composition is different.
9定理ていりと証明しょうめい:行列積ぎょうれつせきは合成ごうせいを表あらわす
A を m\times n、B を n\times p とする。B の列れつcolumnを b_1,\ldots,b_p と書かく。x\in K^p に対たいして
Bx=x_1b_1+\cdots+x_pb_p
である。A を作用さようさせ、線型性せんけいせいlinearityを使つかうと
A(Bx)=x_1Ab_1+\cdots+x_pAb_p
となる。AB の列れつcolumnは Ab_1,\ldots,Ab_p なので、(AB)x=A(Bx) である。
10よくある誤解ごかい
- 行列積ぎょうれつせきは対応たいおうする成分せいぶんcomponentどうしの積せきではない。
- サイズ条件じょうけんを確認かくにんせずに積せきを計算けいさんしてはならない。
- AB と BA は一般いっぱんに一致いっちしない。合成ごうせいの順序じゅんじょが異ことなるためである。
9Theorem and proof: matrix product行列積ぎょうれつせき represents composition
Let A be m\times n and B be n\times p. Write the columns of B as b_1,\ldots,b_p. For x\in K^p,
Bx=x_1b_1+\cdots+x_pb_p.
Applying A and using linearity gives
A(Bx)=x_1Ab_1+\cdots+x_pAb_p.
The columns of AB are exactly Ab_1,\ldots,Ab_p, so (AB)x=A(Bx).
10Common misunderstandings
- matrix product行列積ぎょうれつせき is not the product of corresponding entries.
- Size compatibility must be checked before calculating.
- AB=BA is not expected unless there is a special reason.
11どこまで成立せいりつするか
行列積ぎょうれつせきは、線型写像せんけいしゃぞうlinear mapの合成ごうせいと整合せいごうするように定義ていぎされる。成分せいぶんcomponentごとの積せきを使用しようする別べつの演算えんざんも存在そんざいするが、それは標準的ひょうじゅんてきな行列積ぎょうれつせきとは別物べつものである。
12最終形さいしゅうけい
\boxed{(AB)_{ij}=\sum_k a_{ik}b_{kj}}
\boxed{ABx=A(Bx)}
\boxed{\text{行列積は写像の合成を表す}}
11Scope
Matrix multiplication is defined so that it agrees with composition of linear maps線型写像せんけいしゃぞう. There are other operations that multiply corresponding entries componentwise, but those are different from the standard matrix product.
12Final forms
\boxed{(AB)_{ij}=\sum_k a_{ik}b_{kj}}
\boxed{ABx=A(Bx)}
\boxed{\text{Matrix multiplication represents composition of maps.}}
13定理ていりと証明しょうめい:行列積ぎょうれつせきは線型写像せんけいしゃぞうの合成ごうせいである
A を m\times n 行列ぎょうれつ、B を n\times p 行列ぎょうれつとする。このとき、AB は「まず B を作用さようさせ、つぎに A を作用さようさせる」線型写像せんけいしゃぞうを表あらわす。
証明しょうめいする。x\in\mathbb{F}^p とする。B の列れつを b_1,\ldots,b_p と書かくと、
Bx=x_1b_1+\cdots+x_pb_p
である。A を作用さようさせると、線型性せんけいせいより
A(Bx)=x_1Ab_1+\cdots+x_pAb_p
である。一方いっぽう、AB の第だい j 列れつは Ab_j である。したがって (AB)x も同おなじ式しきになる。よって
(AB)x=A(Bx)
である。
この証明しょうめいにより、行列積ぎょうれつせきの順番じゅんばんが合成ごうせいの順番じゅんばんを反映はんえいしていることが分わかる。
14演習えんしゅうリンク
data/exercise/math/linear-algebra/matrix-computation-and-linear-transformations.exercise.n.md
13Theorem and proof: matrix product is composition of linear maps
Let A be an m\times n matrix and B an n\times p matrix. Then AB represents the linear map that applies B first and then A.
To prove this, take x\in\mathbb F^p. If the columns of B are b_1,\ldots,b_p, then
Bx=x_1b_1+\cdots+x_pb_p.
Applying A and using linearity線型性せんけいせい gives
A(Bx)=x_1Ab_1+\cdots+x_pAb_p.
On the other hand, the j-th column of AB is Ab_j, so (AB)x has the same expression. Hence
(AB)x=A(Bx).
This proof explains why the order of matrix multiplication reflects the order of composition.
14Exercise links
data/exercise/math/linear-algebra/matrix-computation-and-linear-transformations.exercise.n.md