Matrix Multiplication

Composition of Linear Transformations
Suppose [math]S:\mathbb{R}^2\to\mathbb{R}^2[/math] and [math]T:\mathbb{R}^2\to\mathbb{R}^2[/math] are two linear transformations. We consider their composition [math]S\circ T:\mathbb{R}^2\to\mathbb{R}^2[/math] i.e. for any vector [math]v[/math] in [math]\mathbb{R}^2[/math], [math](S\circ T)(v)=S(T(v))[/math]. You can verify that [math]S\circ T[/math] is again a linear transformation. [br][br][u]A natural question[/u]: How can we write down the matrix for [math]S\circ T[/math] if we are given the matrices for [math]S[/math] and [math]T[/math]?[br][br]The matrix for [math]S\circ T[/math] is formed by the column vectors [math](S\circ T)(\hat{\mathbf{i}})[/math] and [math](S\circ T)(\hat{\mathbf{j}})[/math]. Suppose [math]A=\begin{pmatrix}a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix}[/math] and [math]B=\begin{pmatrix}b_{11} & b_{12} \\ b_{21} & b_{22} \end{pmatrix}[/math] be the matrices for [math]S[/math] and [math]T[/math] respectively, we have[br][br][math](S\circ T)(\hat{\mathbf{i}})=S(T( \hat{\mathbf{i}}))=S\left(\begin{pmatrix}b_{11} \\ b_{21}\end{pmatrix}\right)=A \begin{pmatrix}b_{11} \\ b_{21}\end{pmatrix}= \begin{pmatrix}a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix} \begin{pmatrix}b_{11} \\ b_{21}\end{pmatrix}=b_{11}\begin{pmatrix}a_{11} \\ a_{21}\end{pmatrix}+b_{21}\begin{pmatrix}a_{12} \\ a_{22}\end{pmatrix}=\begin{pmatrix}a_{11}b_{11}+a_{12}b_{21} \\ a_{21}b_{11}+a_{22}b_{21}\end{pmatrix}[/math][br][math](S\circ T)(\hat{\mathbf{j}})=S(T(\hat{\mathbf{j}}))= S\left(\begin{pmatrix}b_{12} \\ b_{22}\end{pmatrix}\right)=A\begin{pmatrix}b_{12} \\ b_{22}\end{pmatrix}= \begin{pmatrix}a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix} \begin{pmatrix}b_{12} \\ b_{22}\end{pmatrix}= b_{12}\begin{pmatrix}a_{11} \\ a_{21}\end{pmatrix}+b_{22}\begin{pmatrix}a_{12} \\ a_{22}\end{pmatrix}=\begin{pmatrix}a_{11}b_{12}+a_{12}b_{22} \\ a_{21}b_{12}+a_{22}b_{22}\end{pmatrix}[/math][br][br]Hence the matrix for [math]S\circ T[/math] is defined to be the [b]matrix multiplication of [math]A[/math] and [math]B[/math] [/b] as follows:[br][br][math]AB= \begin{pmatrix}a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix} \begin{pmatrix}b_{11} & b_{12} \\ b_{21} & b_{22} \end{pmatrix}=\begin{pmatrix} a_{11}b_{11}+a_{12}b_{21} & a_{11}b_{12}+a_{12}b_{22} \\ a_{21}b_{11}+a_{22}b_{21} & a_{21}b_{12}+a_{22}b_{22} \end{pmatrix}[/math][br][br][br][br]In the following applet, matrix multiplication of 2 x 2 matrices is visualized as a composition of linear transformations. Try the following tasks:[br][br]1. Find [math]A[/math] and [math]B[/math] such that [math]AB\ne BA[/math].[br]2. Find [math]A[/math] and [math]B[/math] such that [math]A\ne 0,B\ne 0[/math], and [math]AB=BA[/math].[br]3. Find [math]A[/math] and [math]B[/math] such that [math]A\ne 0,B\ne 0[/math] but [math]AB=0[/math].[br][br][br]
Matrix Multiplication
Now use the same idea in the most general situation: Let [math]S:\mathbb{R}^r\to\mathbb{R}^m[/math] and [math]T:\mathbb{R}^n\to\mathbb{R}^r[/math] be linear transformations. For [math]S\circ T[/math] to be well-defined, the domain of [math]S[/math] must match the range of [math]T[/math]. Again, you can easily verify that [math]S\circ T:\mathbb{R}^n\to\mathbb{R}^m[/math] is also a linear transformation. As we know, the m x n matrix for [math]S\circ T[/math] is [br][br][math]\left[(S\circ T)(e_1) \ (S\circ T)(e_2) \ \cdots \ (S\circ T)(e_n) \right][/math]. [br][br]Let [math]A[/math] and [math]B[/math] be the matrices for [math]S[/math] and [math]T[/math] respectively. For [math]j=1, \ldots, n[/math], let [math]\mathbf{b}_j[/math] be the [math]j^{\text{th}}[/math] column vector in [math]B[/math] i.e [math]B=\left[ \mathbf{b}_1 \ \mathbf{b}_2 \ \cdots \ \mathbf{b}_n\right] [/math]. Then [math]T(e_j)=\mathbf{b}_j[/math] and we have[br][br][math](S\circ T)(e_j)=S(T(e_j))=S(\mathbf{b}_j)=A\mathbf{b}_j[/math][br][br]Hence, we define [math]AB[/math], [b]the matrix multiplication of [math]A[/math] and [math]B[/math][/b] to be the matrix for [math]S\circ T[/math], which is as follows:[br][br][math]AB=\left[ A\mathbf{b}_1 \ A\mathbf{b}_2 \ \cdots \ A\mathbf{b}_n\right][/math][br][br][u]An example[/u]: Let [math]A=\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}, B= \begin{pmatrix} 0 & 2 & -1 \\ 3 & 1 & 5 \end{pmatrix}[/math]. By the definition above, we need compute the following:[br][br][math]A\mathbf{b}_1= \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\begin{pmatrix}0 \\ 3\end{pmatrix}=\begin{pmatrix}6 \\ 12 \end{pmatrix}[/math][br][math]A\mathbf{b}_2= \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\begin{pmatrix}2 \\ 1\end{pmatrix}=\begin{pmatrix} 4 \\ 10 \end{pmatrix}[/math][br][math]A\mathbf{b}_3= \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\begin{pmatrix}-1 \\ 5\end{pmatrix}=\begin{pmatrix}9 \\ 17\end{pmatrix}[/math][br][br]Therefore, we have [math]AB=\begin{pmatrix} 6 & 4 & 9 \\ 12 & 10 & 17\end{pmatrix}[/math].[br][br][br]The following are some questions about matrix multiplication:
Compute [math]\begin{pmatrix} 1 & 0 & 1 \\ 2 & 3 & -1\end{pmatrix}\begin{pmatrix} 1 & 0 \\ 0 & -1 \\ 2 & 1\end{pmatrix}[/math].
Compute [math]\begin{pmatrix} 1 & 2 & 3 \end{pmatrix}\begin{pmatrix} 2 \\ 3 \\ 4\end{pmatrix}[/math].
Compute [math]\begin{pmatrix} 2 \\ 3 \\ 4\end{pmatrix}\begin{pmatrix} 1 & 2 & 3 \end{pmatrix}[/math].
Compute [math]\begin{pmatrix} 1 & 2 & 3 & 4 \\ 5 & 6 & 7 & 8\end{pmatrix}\begin{pmatrix} 2 & 0 \\ -7 & 1\end{pmatrix}[/math].
Close

Information: Matrix Multiplication