Evanalysis
3.1Source-backedEmbedded interactionEstimated reading time: 3 min

3.1 Matrix multiplication and identity matrices

Learn when matrix products are defined, how the row-by-column rule works, and why identity matrices matter for systems and inverses.

Note collections

MATH1030: Linear algebra I

Rigorous linear algebra notes on systems, matrices, structure, and proof, with interaction used only where it clarifies the mathematics.

Chapter 1

Systems of equations

Learn to read equations as full solution sets.

Chapter 2

Matrices and elimination

Build matrix intuition and use row reduction with purpose.

Chapter 3

Matrix algebra

Matrix multiplication, transpose, and structural matrix notation.

Chapter 4

Solution structure

Homogeneous systems, null spaces, and the shape of full solution sets.

Chapter 5

Invertibility

Understand when a matrix can be undone and why that matters.

Matrix multiplication is the first matrix operation that genuinely mixes rows with columns. It is also the operation that lets matrices encode composition, systems of equations, and later inverse matrices. Because of that, you should not memorize the rule as a pattern of symbols only. You should know what the dimensions are doing at each step.

Why multiplication is more subtle than addition

Addition and scalar multiplication act entry by entry. Matrix multiplication is different. To compute one output entry, you compare one row of the left matrix with one column of the right matrix.

That is why dimensions matter so strictly.

Definition

When a matrix product is defined

If AA is an m×nm \times n matrix and BB is an n×pn \times p matrix, then the product AB is defined and is an m×pm \times p matrix.

If the number of columns of AA does not equal the number of rows of BB, then the product AB is undefined.

The inner dimensions must match. The outer dimensions tell you the size of the result.

The row-by-column rule

Definition

Matrix multiplication

Suppose A=[aij]A = [a_{ij}] is an m×nm \times n matrix and B=[bjk]B = [b_{jk}] is an n×pn \times p matrix.

Then the (i,k) entry of AB is

(AB)ik=ai1b1k+ai2b2k++ainbnk.(AB)_{ik} = a_{i1}b_{1k} + a_{i2}b_{2k} + \cdots + a_{in}b_{nk}.

So each output entry is the dot-product-style combination of row i of AA with column k of BB.

This rule explains three important facts at once:

  • multiplication is not entrywise;
  • the inner dimensions must match;
  • the output entry uses every matched position in the row and column.

Worked example

Compute a product carefully

Let

A=[1231],B=[4051].A = \begin{bmatrix} 1 & 2 \\ 3 & -1 \end{bmatrix}, \qquad B = \begin{bmatrix} 4 & 0 \\ 5 & 1 \end{bmatrix}.

Then AB is defined because both matrices are 2×22 \times 2. Its entries are:

(AB)11=14+25=14,(AB)_{11} = 1 \cdot 4 + 2 \cdot 5 = 14,(AB)12=10+21=2,(AB)_{12} = 1 \cdot 0 + 2 \cdot 1 = 2,(AB)21=34+(1)5=7,(AB)_{21} = 3 \cdot 4 + (-1) \cdot 5 = 7,(AB)22=30+(1)1=1.(AB)_{22} = 3 \cdot 0 + (-1) \cdot 1 = -1.

So

AB=[14271].AB = \begin{bmatrix} 14 & 2 \\ 7 & -1 \end{bmatrix}.

Matrix-vector multiplication is a system statement

If x is a column vector, then Ax is a special case of matrix multiplication. It packages the left-hand sides of a linear system into one object.

For

A=[121315],x=[x1x2x3],A = \begin{bmatrix} 1 & 2 & -1 \\ 3 & -1 & 5 \end{bmatrix}, \qquad x = \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix},

we have

Ax=[x1+2x2x33x1x2+5x3].Ax = \begin{bmatrix} x_1 + 2x_2 - x_3 \\ 3x_1 - x_2 + 5x_3 \end{bmatrix}.

So the system Ax=bAx = b is not merely shorthand. It is a matrix product whose entries reproduce the equations of the system.

Identity matrices do nothing, on purpose

Definition

Identity matrix

For each positive integer n, the identity matrix InI_n is the n×nn \times n square matrix with 1 on the main diagonal and 0 everywhere else.

For example,

I2=[1001],I3=[100010001].I_2 = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}, \qquad I_3 = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}.

The identity matrix matters because it preserves any compatible matrix:

AIn=A,ImA=AAI_n = A, \qquad I_m A = A

whenever the sizes match.

Worked example

Why multiplying by the identity changes nothing

Let

A=[2143].A = \begin{bmatrix} 2 & -1 \\ 4 & 3 \end{bmatrix}.

Then

AI2=[2143][1001]=[2143].AI_2 = \begin{bmatrix} 2 & -1 \\ 4 & 3 \end{bmatrix} \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} 2 & -1 \\ 4 & 3 \end{bmatrix}.

The first column of AI2AI_2 reproduces the first column of AA, and the second column reproduces the second column of AA.

That is exactly why inverse matrices are defined through the identity later: if A1A^{-1} exists, then AA1=IAA^{-1} = I.

Multiplication is usually not commutative

One of the first conceptual shocks in linear algebra is that

ABBAAB \ne BA

in general.

Sometimes both products are defined and differ. Sometimes one product is defined and the other is not. So order matters twice: it matters for meaning, and it matters for the final answer.

Use the figure below to watch one output entry being built from a selected row and a selected column.

Read and try

Follow one matrix product entry

The live widget updates each entry of AB as you change the entries of A and B.

Result

89
34

8 = 1×2 + 2×3

Common mistakes

Common mistake

Matrix multiplication is not entrywise multiplication

The entry (AB)ik(AB)_{ik} is not aikbika_{ik}b_{ik}. It is built from the whole ith row of AA and the whole kth column of BB.

Common mistake

Defined products can still appear in only one order

If AA is 2×32 \times 3 and BB is 3×43 \times 4, then AB is defined but BA is not. Never assume the reverse order makes sense automatically.

Quick checks

Quick check

If AA is 2×32 × 3 and BB is 3×53 × 5, what is the size of AB?

Use the inner dimensions to test whether the product is defined, then read the outer dimensions.

Solution

Answer

Quick check

What does multiplying by InI_n do to a compatible matrix?

Answer in one sentence.

Solution

Answer

Exercise

Quick check

Why does Ax=0Ax = 0 always have at least one solution, no matter what AA is?

Think of x as a column vector.

Solution

Guided solution

This note depends on 2.1 Matrix basics. Continue to 3.2 Transpose and special matrices or jump ahead to 5.1 Invertible matrices.

Key terms in this unit