JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Matrix Multiplication and the Identity

Matrix multiplication is the one operation that surprises everyone: it is row-times-column, the inner sizes must match, and the order matters. Here is the recipe, worked slowly, plus why the identity matrix leaves things unchanged.

When you can multiply, and what shape you get

Matrix multiplication is not entrywise — it pairs each row of the left matrix with each column of the right matrix. The deal: to multiply A · B, the number of columns of A must equal the number of rows of B. These are the “inner” numbers; the “outer” numbers give the size of the answer.

A is (2 x 3),  B is (3 x 2)
        inner: 3 = 3  -> OK to multiply
        outer: 2   2  -> product is (2 x 2)

( m x n ) * ( n x p ) = ( m x p )
The inner n's must match and then vanish.
The shape rule: inner dimensions must match; outer dimensions give the result's size.

The row-times-column recipe

The entry in row i, column j of the product is the dot product of row i of A with column j of B: multiply matching numbers and add them up. Walk through every (row, column) pairing and you fill in the whole product.

  1. Pick a row of A and a column of B.
  2. Multiply their first entries, their second entries, and so on.
  3. Add those products into one number — that is one entry of the answer.
  4. Repeat for every row-column pairing to fill the whole product.
[ 1  2 ]   [ 5  6 ]
[ 3  4 ] * [ 7  8 ]

row1 . col1 = 1*5 + 2*7 = 5 + 14 = 19
row1 . col2 = 1*6 + 2*8 = 6 + 16 = 22
row2 . col1 = 3*5 + 4*7 = 15 + 28 = 43
row2 . col2 = 3*6 + 4*8 = 18 + 32 = 50

Result = [ 19  22 ]
         [ 43  50 ]
Multiplying two 2×2 matrices, one entry at a time.

Order matters; the identity does not change anything

Unlike numbers, matrix multiplication is not commutative: in general A · B ≠ B · A. Sometimes B · A is not even a legal product because the shapes do not line up. So the commutative property fails here — order is part of the meaning.

The identity matrix I is the multiplicative anchor: for any square matrix A of matching size, A · I = I · A = A. It plays exactly the role the number 1 plays for ordinary multiplication, which is why the next guide can talk about an inverse — the matrix that multiplies A back to I.