Evanalysis
3.2Embedded interactionEstimated reading time: 5 min

3.2 Matrix multiplication and linear systems

Understand matrix multiplication as a row-by-column rule, then connect it back to the linear systems you already know.

Course contents

MATH1030: Linear algebra I

Linear algebra notes.

37 sections

Matrix multiplication is the first matrix operation that feels different from the basic arithmetic in the previous note. Addition, subtraction, and scalar multiplication all work entry by entry. Matrix multiplication does not.

Instead, each output entry is built by pairing:

  • one row from the left matrix, and
  • one column from the right matrix.

That is why the size rule is stricter here.

Intuition first: the middle size has to agree

Suppose AA is m×nm × n and BB is n×pn × p. Then the product AB is defined, and the result has size m×pm × p.

The inner number n appears twice because the n entries in a row of AA must have exactly n partners in a column of BB. If those counts do not agree, there is no row-by-column pairing to carry out.

So the beginner's size rule is:

The inside sizes must match.

Definition

Definition

Matrix multiplication

Suppose AA is an m×nm × n matrix and BB is an n×pn × p matrix. The product AB is the m×pm × p matrix whose (i, j) entry is

[AB]ij=k=1n[A]ik[B]kj.[AB]_{ij} = \sum_{k=1}^{n} [A]_{ik}[B]_{kj}.

In words: take row i of AA, take column j of BB, multiply matching entries, then add the results.

What one entry really means

It is easy to get lost in the notation, so slow the rule down.

To compute [AB]23[AB]_{23}:

  1. Go to row 2 of AA.
  2. Go to column 3 of BB.
  3. Multiply entry by entry.
  4. Add the products.

That means one output entry is a compact summary of several multiplications and one final addition.

Embedded interactive moment

Use the visualizer below to keep one output cell fixed while you change the input entries. This is the quickest way to build the row-by-column habit.

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

Worked example

Worked example

Compute a product by the row-by-column rule

Let

A=[1201],B=[2134].A = \begin{bmatrix} 1 & 2 \\ 0 & 1 \end{bmatrix}, \qquad B = \begin{bmatrix} 2 & 1 \\ 3 & 4 \end{bmatrix}.

Then AB is 2×22 × 2. Compute each entry:

[AB]11=12+23=8,[AB]_{11} = 1 \cdot 2 + 2 \cdot 3 = 8,[AB]12=11+24=9,[AB]_{12} = 1 \cdot 1 + 2 \cdot 4 = 9,[AB]21=02+13=3,[AB]_{21} = 0 \cdot 2 + 1 \cdot 3 = 3,[AB]22=01+14=4.[AB]_{22} = 0 \cdot 1 + 1 \cdot 4 = 4.

So

AB=[8934].AB = \begin{bmatrix} 8 & 9 \\ 3 & 4 \end{bmatrix}.

Why this connects to linear systems

You have already seen systems written as Ax=bAx = b.

That formula is not just shorter notation. It tells you that matrix multiplication packages several linear equations into one object. Each row of AA creates one equation by pairing that row with the column vector x.

If

A=[a11a12a13a21a22a23],x=[x1x2x3],A = \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \end{bmatrix}, \qquad x = \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix},

then

Ax=[a11x1+a12x2+a13x3a21x1+a22x2+a23x3].Ax = \begin{bmatrix} a_{11}x_1 + a_{12}x_2 + a_{13}x_3 \\ a_{21}x_1 + a_{22}x_2 + a_{23}x_3 \end{bmatrix}.

So Ax=bAx = b really means a full system of linear equations, one row at a time.

Theorem

The product order matters

Even when both AB and BA are defined, they usually are not equal.

This is a major change from ordinary number multiplication. With matrices, order carries meaning.

Common mistakes

Common mistake

Checking the wrong dimensions

For AB, compare the number of columns of AA with the number of rows of BB. Do not compare the outside numbers first.

Common mistake

Multiplying rows by rows

The rule is row of AA against column of BB, not row against row.

Common mistake

AssumingAB=BAAssuming AB = BA

Matrix multiplication is generally not commutative. Two products with the same letters can represent different computations or even have different sizes.

Quick checks

Quick check

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

Use the inside-match, outside-survive rule.

Solution

Answer

Quick check

Why does Ax=bAx = b represent several equations at once?

Use the word "rows" in your answer.

Solution

Answer

Exercises

Quick check

Suppose AA is 3×23 × 2 and BB is 2×52 × 5. Is BA defined? If so, what size would it have?

Do not guess from the fact that AB is defined.

Solution

Guided solution

Quick check

Write the first entry of Ax when the first row of AA is (4,1,2)(4, -1, 2) and x=(x1,x2,x3)Tx = (x_1, x_2, x_3)^T.

Use the row-by-column rule.

Solution

Guided solution

Review 2.2 Augmented matrices and row operations if you want to reconnect Ax=bAx = b with the matrix form of a linear system.

Continue to 3.3 Transposes, symmetric matrices, and skew-symmetric matrices for the next important matrix operation.

Key terms in this unit

Premium learning add-ons

Core notes stay free. Advanced exercises, video explanations, and premium exports are available through paid plans.