Matrix multiplication means combining two matrices to produce a new matrix by using row–column dot products.

Quick Scoop

1. When you can multiply

To multiply a matrix AAA by a matrix BBB, their inner dimensions must match.

  • If AAA is m×nm\times nm×n (m rows, n columns) and BBB is n×pn\times pn×p, then ABABAB is defined and will be an m×pm\times pm×p matrix.
  • If the number of columns of AAA is not equal to the number of rows of BBB, the product ABABAB is not defined.
  • The order matters: usually AB≠BAAB\neq BAAB=BA; sometimes one of them isn’t even defined.

2. Core idea: row · column

Each entry of the product is a dot product of a row of the first matrix and a column of the second.

  • Label the product C=ABC=ABC=AB.
  • The entry cijc_{ij}cij​ (row iii, column jjj of CCC) is:

cij=ai1b1j+ai2b2j+⋯+ainbnjc_{ij}=a_{i1}b_{1j}+a_{i2}b_{2j}+\dots +a_{in}b_{nj}cij​=ai1​b1j​+ai2​b2j​+⋯+ain​bnj​

where row iii of AAA has nnn entries and column jjj of BBB has nnn entries.

  • In words: multiply matching elements, then add them up.

A useful way to picture it is: slide row iii of AAA over column jjj of BBB, multiply each aligned pair, and sum those products to get cijc_{ij}cij​.

3. Step‑by‑step example (2×2)

Take

A=(1234),B=(5678)A=\begin{pmatrix}1&2\\3 &4\end{pmatrix},\quad B=\begin{pmatrix}5&6\\7 &8\end{pmatrix}A=(13​24​),B=(57​68​)

  • Both are 2×22\times 22×2, so the product ABABAB is defined and will be 2×22\times 22×2.
  • Compute entries via row–column dot products:
* c11c_{11}c11​: first row of AAA with first column of BBB:  

1⋅5+2⋅7=5+14=191\cdot 5+2\cdot 7=5+14=191⋅5+2⋅7=5+14=19.

* c12c_{12}c12​: first row of AAA with second column of BBB:  

1⋅6+2⋅8=6+16=221\cdot 6+2\cdot 8=6+16=221⋅6+2⋅8=6+16=22.

* c21c_{21}c21​: second row of AAA with first column of BBB:  

3⋅5+4⋅7=15+28=433\cdot 5+4\cdot 7=15+28=433⋅5+4⋅7=15+28=43.

* c22c_{22}c22​: second row of AAA with second column of BBB:  

3⋅6+4⋅8=18+32=503\cdot 6+4\cdot 8=18+32=503⋅6+4⋅8=18+32=50.

So the product is

AB=(19224350).AB=\begin{pmatrix}19&22\\43 &50\end{pmatrix}.AB=(1943​2250​).

4. General algorithm you can follow

You can think of it as a simple mechanical recipe.

  1. Check dimensions.
    • Write down sizes: A=m×nA=m\times nA=m×n, B=n×pB=n\times pB=n×p. If inner numbers differ, stop (cannot multiply).
  1. Set up the result.
    • Draw a blank m×pm\times pm×p grid for the result matrix.
  1. For each position (i,j)(i,j)(i,j) in the result:
    • Take row iii from AAA.
    • Take column jjj from BBB.
    • Multiply each pair of matching elements and add them to get a single number.
    • Put that number into row iii, column jjj of the result.
  1. Repeat until all positions in the result matrix are filled.

5. Key properties (what’s special about it)

Matrix multiplication behaves differently from ordinary number multiplication in important ways.

  • Not commutative: Usually AB≠BAAB\neq BAAB=BA, and sometimes one of them doesn’t exist at all.
  • Associative: If dimensions fit, (AB)C=A(BC)(AB)C=A(BC)(AB)C=A(BC).
  • Distributive over addition: A(B+C)=AB+ACA(B+C)=AB+ACA(B+C)=AB+AC and (A+B)C=AC+BC(A+B)C=AC+BC(A+B)C=AC+BC when sizes allow.
  • Identity matrix: Multiplying by an identity matrix III leaves a matrix unchanged, AI=AAI=AAI=A and IA=AIA=AIA=A.

These properties are what make matrix multiplication central in linear algebra and applications like solving systems of equations and transforming vectors.

6. Tiny story to remember it

You can imagine each row of the first matrix as a recipe and each column of the second matrix as the ingredients available for a specific scenario.

When you take a row and a column, you’re combining that recipe with those ingredients: multiply how much of each ingredient you use and add to get the total effect. TL;DR:
To do matrix multiplication, make sure “inner dimensions” match, then for every position in the result, take the corresponding row of the first matrix and column of the second, multiply matching entries and add them up.

Information gathered from public forums or data available on the internet and portrayed here.