Matrix Multiplication

A matrix product is defined when the first matrix’s column count equals the second matrix’s row count. Each result entry is a row-by-column dot product. This guide connects dimension checks and calculations to order, matrix squaring, and a two-truck example in which one product gives revenue, cost, and profit totals.

Course cover for Matrix Multiplication

Two Trucks, One Question

Two food trucks sell tacos and smoothies in different amounts. Their owner wants total revenue, total cost, and total profit for each truck from one organized calculation. The data come in two tables: inventory counts and per-item dollar values

TruckTacosSmoothies
Truck 13012
Truck 2825
ItemRevenue per itemCost per itemProfit per item
Taco$6$4$2
Smoothie$5$4$1

Each truck’s item counts must be paired with the corresponding per-item values. Matrix multiplication organizes all these pairings into one product, but the matrix dimensions must be compatible first

The learning tasks are to check whether a product is defined, predict its size, calculate its entries, distinguish the two multiplication orders, square a matrix correctly, and interpret the rows and columns of a real-world result

When Can You Multiply?

Matrix dimensions are written as rows × columns. To see why dimensions matter, try pairing the row

$$2, 5, 1$$

with the column

$$4; 3$$

. Here, semicolons separate rows. The 2 pairs with 4, and the 5 pairs with 3, but the 1 has no partner. A row-by-column calculation requires the same number of entries on both sides

When Can You Multiply?: row strip (3 entries) 2 5 1 column strip (2 entries) 4 3 pair no partner

For example, (2 × 5)(5 × 3) is compatible because the inner numbers are both 5. The product has 2 rows and 3 columns. If the inner numbers do not match, the product is undefined regardless of the entries inside the matrices

Example: Defined or undefined?

A is a 2 × 5 matrix and B is a 3 × 2 matrix. C is a 2 × 5 matrix and D is a 5 × 3 matrix. Is AB defined? Is CD defined? If a product is defined, what is its size?

For AB, write (2 × 5)(3 × 2). The inner numbers are 5 and 3. Since 5 ≠ 3, AB is undefined. For CD, write (2 × 5)(5 × 3). The inner numbers match, so CD is defined and has size 2 × 3

Practice 1: Classify the products

Using R (5 × 2) and T (2 × 4), classify RT, TR, and TT as defined or undefined

RT is defined: (5 × 2)(2 × 4) has matching inner 2s, giving a 5 × 4 result. TR is undefined: (2 × 4)(5 × 2) has inner numbers 4 and 5. TT is undefined: (2 × 4)(2 × 4) has inner numbers 4 and 2. Check each product in its written order, not by whether the matrices look similar

Row Times Column

Once a product passes the dimension check, each entry comes from a dot product: take a row of the first matrix and a column of the second, multiply matching entries in order, and add the products. The entry in row i, column j uses row i of the first matrix and column j of the second

Example: Find MN

Let M =

$$1, −2, 3; 0, 5, −1$$

and N =

$$2, 0; 4, −3; 1, 6$$

. M is 2 × 3 and N is 3 × 2. The inner 3s match, so MN is defined and has size 2 × 2

Row 1, column 1 uses

$$1, −2, 3$$

from M and

$$2; 4; 1$$

from N: 1(2) + (−2)(4) + 3(1) = 2 − 8 + 3 = −3. This is the top-left entry of MN

Row 1, column 2 keeps the same row of M but uses

$$0; −3; 6$$

from N: 1(0) + (−2)(−3) + 3(6) = 0 + 6 + 18 = 24. The first row of MN is therefore

$$−3, 24$$

Row 2 of M is

$$0, 5, −1$$

. Against column 1 of N, it gives 0(2) + 5(4) + (−1)(1) = 0 + 20 − 1 = 19. Against column 2, it gives 0(0) + 5(−3) + (−1)(6) = 0 − 15 − 6 = −21

The completed product is MN =

$$−3, 24; 19, −21$$

. A consistent calculation order is to fix a row, work across all columns of the second matrix, then move to the next row

Practice 2: Complete one entry

Let G =

$$2, −1; 3, 0; −2, 4$$

, a 3 × 2 matrix, and H =

$$1, 5; 2, −1$$

, a 2 × 2 matrix. Complete the dot product for the row 3, column 2 entry of GH: (−2)(___) + (4)(___) = ___. The available values are 5, −1, 1, 2, −14, and −6

The blanks are 5, −1, and −14. Row 3 of G is

$$−2, 4$$

, and column 2 of H is

$$5; −1$$

, read from top to bottom. Thus (−2)(5) + 4(−1) = −10 − 4 = −14. Both factors taken from H must come from column 2, and their negative signs must be retained

Order Matters

For numbers, 3 × 5 = 5 × 3. Matrix multiplication does not follow that commutative rule in general. AB and BA are different calculations: reversing the order can change the result’s shape or make the product undefined

Example: Compare NP and PN

Keep N =

$$2, 0; 4, −3; 1, 6$$

, which is 3 × 2, and let P =

$$2, −1; 0, 3$$

, which is 2 × 2. For NP, the size check is (3 × 2)(2 × 2). The inner 2s match, so NP is defined and has size 3 × 2. For PN, the check is (2 × 2)(3 × 2). Since 2 ≠ 3, PN is undefined

To calculate NP, use the two columns of P,

$$2; 0$$

and

$$−1; 3$$

. Row 1 of N gives 2(2) + 0(0) = 4 and 2(−1) + 0(3) = −2

Row 2 gives 4(2) + (−3)(0) = 8 and 4(−1) + (−3)(3) = −4 − 9 = −13. Row 3 gives 1(2) + 6(0) = 2 and 1(−1) + 6(3) = −1 + 18 = 17

Therefore NP =

$$4, −2; 8, −13; 2, 17$$

. Its three rows and two columns agree with the size predicted before calculating

Practice 3: Reason about both orders

E is 3$$\times$$ 1 and F is 1$$\times$$ 3. Which statement about EF and FE is true?

A

Both are defined, but EF is 3$$\times$$ 3 and FE is 1$$\times$$ 1, so they cannot be equal

B

Both are defined and EF = FE, since the same two matrices are used

C

EF is undefined because the two matrices have different shapes

Squaring a Matrix

For example, let B =

$$1, 2, 0; 3, −1, 4$$

, which is 2 × 3. The size check for B² is (2 × 3)(2 × 3). The inner numbers are 3 and 2, so B² is undefined. A square matrix passes this check because its row and column counts are equal

Example: Square a 2 × 2 matrix

Let A =

$$3, −1; 0, 2$$

. Find A². Since A is 2 × 2, A² is defined and is also 2 × 2. Write A² =

$$3, −1; 0, 2$$

$$3, −1; 0, 2$$

and calculate all four dot products

Top-left: 3(3) + (−1)(0) = 9. Top-right: 3(−1) + (−1)(2) = −3 − 2 = −5

Bottom-left: 0(3) + 2(0) = 0. Bottom-right: 0(−1) + 2(2) = 4. Therefore A² =

$$9, −5; 0, 4$$

Squaring each entry would instead produce

$$9, 1; 0, 4$$

, which is not A². The top-right entry exposes the mistake: matrix multiplication gives −5, not 1

Practice 4: Check a squaring claim

A student claims that for C =

$$2, 1; −3, 0$$

, C² =

$$4, 1; 9, 0$$

, made by squaring each entry. Check the claim by finding the correct top-left entry of C²

What is the correct row 1, column 1 entry of C^2?

A

1

B

4

C

7

Back to the Trucks

Return to the owner’s two tables. Write inventory as

$$30, 12; 8, 25$$

, with rows Truck 1 and Truck 2 and columns Tacos and Smoothies. Write per-item values as

$$6, 4, 2; 5, 4, 1$$

, with rows Taco and Smoothie and columns Revenue, Cost, and Profit, in dollars per item

Multiply inventory by values:

$$30, 12; 8, 25$$

$$6, 4, 2; 5, 4, 1$$

. The shared item dimension is the inner dimension: the first matrix’s columns and the second matrix’s rows both list tacos followed by smoothies. The size check is (2 × 2)(2 × 3), so the result is 2 × 3

Back to the Trucks: items = inner dimension

The result has one row per truck and one column per money category. Calculate the six entries to find every truck total in dollars

Example: Every total at once

Truck 1 revenue is 30(6) + 12(5) = 180 + 60 = $240. Its cost is 30(4) + 12(4) = 120 + 48 = $168. Its profit is 30(2) + 12(1) = 60 + 12 = $72

Truck 2 revenue is 8(6) + 25(5) = 48 + 125 = $173. Its cost is 8(4) + 25(4) = 32 + 100 = $132. Its profit is 8(2) + 25(1) = 16 + 25 = $41

The product is

$$240, 168, 72; 173, 132, 41$$

. Its meanings are shown below

TruckTotal revenueTotal costTotal profit
Truck 1$240$168$72
Truck 2$173$132$41

Revenue minus cost provides a check on the profit column: 240 − 168 = 72 for Truck 1, and 173 − 132 = 41 for Truck 2. Both agree with the calculated profits

Practice 5: Match positions to meanings

Match these positions in the result matrix to their business meanings: row 1, column 1 (240); row 2, column 1 (173); and row 2, column 3 (41). The meanings are Truck 1 total revenue, Truck 2 total revenue, and Truck 2 total profit

Row 1, column 1 is Truck 1 total revenue, $240. Row 2, column 1 is Truck 2 total revenue, $173. Row 2, column 3 is Truck 2 total profit, $41. Result rows inherit the first matrix’s truck meanings, while result columns inherit the second matrix’s money-category meanings

Summary

1. Check dimensions first. A product with sizes (m × n)(n × p) is defined because the inner numbers match, and its size is m × p

2. Calculate each entry with a dot product. Use row i of the first matrix and column j of the second for the row i, column j entry. Multiply matching entries, then add

3. Respect the written order. AB and BA are different calculations. Reversing the order can change the product or make it undefined

4. Square by multiplying the matrix by itself. A² = A · A, not entry-by-entry squaring. Only square matrices can be squared

5. Interpret positions using inherited meanings. In applications, result rows keep the first matrix’s row meaning, and result columns keep the second matrix’s column meaning

Quiz

Quiz 1: Check a product

G is 3$$\times$$ 5 and H is 5$$\times$$ 2. Which statement about GH is true?

A

GH is defined and is 3$$\times$$ 2

B

GH is defined and is 5$$\times$$ 5

C

GH is undefined because the two sizes are different

Quiz 2: Compute an entry

For this question, D =

$$4, −2; 1, 3$$

and E =

$$0, 2; 5, −1$$

. Find one entry of their 2 × 2 product DE

What is the row 1, column 2 entry of DE?

A

10

B

6

C

-4

D

8

Quiz 3: Find a real total

A snack stand wants its total profit from one matrix product. It has 15 muffins and 20 cookies. Profit is $3 per muffin and $2 per cookie. The setup is the row matrix

$$15, 20$$

times the column matrix

$$3; 2$$

. Complete: total profit = 15(___) + 20(___) = $ ___. The available values are 3, 2, 85, 90, and 45

The blanks are 3, 2, and 85. Pair the 15 muffins with the muffin profit and the 20 cookies with the cookie profit: 15(3) + 20(2) = 45 + 40 = $85 total profit

Continue with the interactive lesson