MathorynMathematical Formula Database

Linear Algebra

Matrix Multiplication

Each entry of the product ABAB is the dot product of a row of AA with a column of BB; AA must have as many columns as BB has rows. Matrix multiplication is not commutative in general. It is used to compose linear transformations, in computer graphics and to solve systems of equations.

(AB)ij=∑k=1naik bkj(AB)_{ij}=\sum_{k=1}^{n}a_{ik}\,b_{kj}
LaTeX(AB)_{ij}=\sum_{k=1}^{n}a_{ik}\,b_{kj}

Variables

aika_{ik}
entry of A in row i, column k
bkjb_{kj}
entry of B in row k, column j
nn
columns of A = rows of B

Example

Compute (1234)(5678)\begin{pmatrix}1&2\\3&4\end{pmatrix}\begin{pmatrix}5&6\\7&8\end{pmatrix}.

  1. Row 1: 1⋅5+2⋅7=19, 1⋅6+2⋅8=221\cdot5+2\cdot7=19,\ 1\cdot6+2\cdot8=22.
  2. Row 2: 3⋅5+4⋅7=43, 3⋅6+4⋅8=503\cdot5+4\cdot7=43,\ 3\cdot6+4\cdot8=50.

Answer: (19224350)\begin{pmatrix}19&22\\43&50\end{pmatrix}.

Related formulas