Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Matrix Multiplication

To multiply two matrices, their dimensions must be compatible.


The product ABAB exists only if the number of columns in matrix AA is equal to the number of rows in matrix BB.


If matrix AA is of size m×p\colorOne{m}\times \bm{\colorTwo{p}}, and matrix BB is of size p×n\bm{\colorTwo{p}} \times \colorThree{n}, the product ABAB will be of size: m×n\colorOne{m} \times \colorThree{n}

Am×p Bp×n=(AB)m×nA_{\colorOne{m} \times \bm{\colorTwo{p}}} \ B_{\bm{\colorTwo{p}} \times \colorThree{n}} = (AB)_{\colorOne{m} \times \colorThree{n}}



Multiplying Matrices

The (i,j)(i,j)-entry of the product ABAB is the dot product of row ii of matrix AA with column jj of matrix BB:

[AB]ij=[ai1ai2⋯aip][b1jb2j⋮bpj]=ai1b1j+ai2b2j+⋯+aipbpj[AB]_{ij}= \left[ \begin{array}{cccc} a_{i1} & a_{i2} & \cdots & a_{ip} \end{array} \right] \left[ \begin{array}{c} b_{1j} \\[0.2em] b_{2j} \\[0.2em] \vdots \\[0.2em] b_{pj} \end{array} \right] = a_{i1}b_{1j} + a_{i2}b_{2j}+\cdots+a_{ip}b_{pj}


Example

Consider the rows of the first matrix and the columns of the second matrix.

Take the dot product of each of these pairs of rows and columns:


[124503][3−152]=[1(3)+2(5)1(−1)+2(2)4(3)+5(5)4(−1)+5(2)0(3)+3(5)0(−1)+3(2)]=[133376156]\left[\begin{array}{rr} \colorThree{1} & \colorThree{2}\\[0.5em] {4} & {5}\\[0.5em] \colorFive{0} & \colorFive{3} \end{array}\right] \left[\begin{array}{rr} \colorTwo{3} & \colorOne{-1}\\[0.5em] \colorTwo{5} & \colorOne{2} \end{array} \right] = \left[\begin{array}{rr} \colorThree{1}\colorTwo{(3)} + \colorThree{2}\colorTwo{(5)} & \quad \colorThree{1}\colorOne{(-1)} + \colorThree{2}\colorOne{(2)}\\[0.5em] {4}\colorTwo{(3)} + {5}\colorTwo{(5)} & \quad {4}\colorOne{(-1)} + {5}\colorOne{(2)}\\[0.5em] \colorFive{0}\colorTwo{(3)} + \colorFive{3}\colorTwo{(5)} & \quad \colorFive{0}\colorOne{(-1)} + \colorFive{3}\colorOne{(2)}\\ \end{array}\right] = \left[ \begin{array}{rrr} 13 & 3\\[0.5em] 37 & 6\\[0.5em] 15 & 6\\ \end{array} \right]



Properties of Matrix Multiplication

  • A(B+C)=AB+ACA(B+C)=AB+AC
  • (A+B)C=AC+BC(A+B)C=AC+BC
  • A(BC)=(AB)CA(BC)=(AB)C
  • AI=IA=AAI = IA = A

Note: If AB=0AB=0, it does not necessarily mean that AA or BB is the zero matrix!

Matrix Powers

Just like with real numbers, we can multiply a square matrix by itself, raising it to the power of some integer kk.

Ak=AA⋯A⏟k timesA^k = \underbrace{AA\cdots A}_{k\text{ times}}

Properties

  • A0=IA^0=I
  • (cA)k=ckAk(cA)^k=c^kA^k



Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Example: Matrix Multiplication Criteria

Given that AA is 3×23\times2, BB is 2×22\times2, CC is 4×34\times3, and DD is 5×25\times2, which of the following operations are defined?

A) ABAB

Well-defined. The result is a matrix of size (3×2)⏞A(2×2)⏞B=3×2\overbrace{(3\times \cancel2)}^A \overbrace{(\cancel2\times 2)}^B = 3\times 2 .

B) BABA

Not defined since the inner dimensions do not match: (2×2)⏞A(3×2)⏞B\overbrace{(2\times \colorTwo{2})}^A \overbrace{(\colorTwo{3}\times 2)}^B .

C) DB2DB^2

Well-defined. The result is a matrix of size (5×2)⏞D(2×2)⏞B(2×2)⏞B=5×2\overbrace{(5\times \cancel{\colorThree{2}})}^D \overbrace{(\cancel{\colorThree{2}} \times \cancel{\colorOne{2}})}^B \overbrace{(\cancel{\colorOne{2}} \times 2)}^B = 5\times 2.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Example: Matrix Multiplication

Compute the products ABAB and BABA given the following matrices:

A=[135−2−4−6]A=\left[\begin{array}{rrr}1&3&5\\-2&-4&-6\end{array}\right], B=[2−11201]B=\left[\begin{array}{rr}2 & -1\\1&2\\0&1\end{array}\right]

Note that AA is 2×32\times 3 and BB is 3×23\times 2, so the product ABAB is well-defined and is of size (2×3)⏞A(3×2)⏞B=2×2\overbrace{(2\times \cancel3)}^A \overbrace{(\cancel3\times 2)}^B = 2\times 2.

AB=[135−2−4−6][2−11201]=[1(2)+3(1)+5(0)1(−1)+3(2)+5(1)−2(2)−4(1)−6(0)−2(−1)−4(2)−6(1)]=[510−8−12]\begin{array}{rcl} AB&=&\left[\begin{array}{rrr}1&3&5\\-2&-4&-6\end{array}\right]\left[\begin{array}{rr}2 & -1\\1&2\\0&1\end{array}\right]\\[2em] &=&\left[\begin{array}{cc} 1(2)+3(1)+5(0) & 1(-1)+3(2)+5(1)\\[0.5em] -2(2)-4(1)-6(0)&-2(-1)-4(2)-6(1) \end{array}\right]\\[2em] &=&\left[\begin{array}{rr} 5 & 10\\ -8&-12 \end{array}\right]\\[2em] \end{array}

The product BABA is also well-defined, and will be of size (3×2)⏞B(2×3)⏞A=3×3\overbrace{(3\times \cancel2)}^B \overbrace{(\cancel2\times 3)}^A = 3\times 3.

BA=[2−11201][135−2−4−6]=[2(1)−1(−2)2(3)−1(−4)2(5)−1(−6)1(1)+2(−2)1(3)+2(−4)1(5)+2(−6)0(1)+1(−2)0(3)+1(−4)0(5)+1(−6)]=[41016−3−5−7−2−4−6]\begin{array}{rcl} BA&=&\left[\begin{array}{rr}2 & -1\\1&2\\0&1\end{array}\right]\left[\begin{array}{rrr}1&3&5\\-2&-4&-6\end{array}\right]\\[2.5em] &=& \left[\begin{array}{cc} 2(1)-1(-2) & \quad2(3)-1(-4) & \quad2(5)-1(-6)\\[0.5em] 1(1)+2(-2) & \quad1(3)+2(-4) & \quad1(5)+2(-6)\\[0.5em] 0(1)+1(-2) & \quad0(3)+1(-4) & \quad0(5)+1(-6)\\ \end{array}\right]\\[3em] &=&\left[\begin{array}{rr} 4 & 10 & 16\\[0.5em] -3 & -5 & -7\\[0.5em] -2 & -4 & -6 \end{array}\right]\\[2em] \end{array}


Practice: Matrix Multiplication

M=[6−103],N=[−1−301]M=\left[ \begin{array}{rrrr} 6&-1&0&3\end{array} \right] ,\qquad N=\left[ \begin{array}{r} -1\\[0.5em] -3\\[0.5em] 0\\[0.5em] 1 \end{array} \right]

Compute MNMN.

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Given the matrix A=[1011]A=\begin{bmatrix} 1&0\\1&1 \end{bmatrix}, find AnA^n for any integer n≥1n \ge 1.


Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Practice: Matrix Multiplication

A=[−331−220−112],B=[2−1−301−1003]A=\left[ \begin{array}{rrr} -3&3&1\\ -2&2&0\\ -1&1&2 \end{array} \right] ,\qquad B=\left[ \begin{array}{rrr} 2&-1&-3\\ 0&1&-1\\ 0&0&3 \end{array} \right]

Compute ABAB.


Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Extra Practice