Matrix Multiplication

Check Dimensions1 #

  1. Inner two numbers must match
  2. Outer two numbers = answer’s dim
(2×3)×(3must match!×2answer’s dimensions)(\underbrace{2 \times \underbrace{3) \times (3}_{\text{must match!}} \times 2}_{\text{answer's dimensions}})

Multiply #

Dot product2 each row in the 1st matrix with every column in the 2nd matrix.

  1. First row, first column.
    [123456]×[789101112]=[58        ]\begin{bmatrix} \color{red}{1} & \color{red}{2} & \color{red}{3} \\ 4 & 5 & 6 \end{bmatrix} \times \begin{bmatrix} \color{blue}{7} & 8 \\ \color{blue}{9} & 10 \\ \color{blue}{11} & 12 \\ \end{bmatrix} = \begin{bmatrix} \color{purple}{58} & ~~~~~ \\ ~~~ & \\ \end{bmatrix}\\

  2. First row, second column.
    [123456]×[789101112]=[5864   ]\begin{bmatrix} \color{red}{1} & \color{red}{2} & \color{red}{3} \\ 4 & 5 & 6 \end{bmatrix} \times \begin{bmatrix} 7 & \color{blue}{8} \\ 9 & \color{blue}{10} \\ 11 & \color{blue}{12} \\ \end{bmatrix} = \begin{bmatrix} 58 & \color{purple}{64} \\ ~~~ & \\ \end{bmatrix}\\

  3. Second row, first column.
    [123456]×[789101112]=[5864139]\begin{bmatrix} 1 & 2 & 3 \\ \color{red}{4} & \color{red}{5} & \color{red}{6} \\ \end{bmatrix} \times \begin{bmatrix} \color{blue}{7} & 8 \\ \color{blue}{9} & 10 \\ \color{blue}{11} & 12 \\ \end{bmatrix} = \begin{bmatrix} 58 & 64 \\ \color{purple}{139} & \\ \end{bmatrix}\\

  4. Second row, second column.
    [123456]×[789101112]=[5864139154]\begin{bmatrix} 1 & 2 & 3 \\ \color{red}{4} & \color{red}{5} & \color{red}{6} \\ \end{bmatrix} \times \begin{bmatrix} 7 & \color{blue}{8} \\ 9 & \color{blue}{10} \\ 11 & \color{blue}{12} \\ \end{bmatrix} = \begin{bmatrix} 58 & 64 \\ 139 & \color{purple}{154} \\ \end{bmatrix}\\

Note: Dot product of red row and blue col = purple num


  1. Dimension = (#rows,#columns)(\#\text{rows}, \#\text{columns}) ↩︎

  2. Dot product formula ↩︎


July 25, 2020
categories: math
tags: matrix, dimensions