Linear Algebra, Live
Strang §2.7 · Transposes

The transpose: rows become columns, and symmetric matrices

Slides 1 to 4 were about undoing a matrix. Now comes a much simpler move that changes no numbers at all: turning a matrix on its side. Picture a sales sheet with one row per product and one column per month. Turn it so that the months are the rows and the products are the columns. Every number is still there, just in a new place. That turned table is the transpose, written Aᵀ: row 1 of A becomes column 1 of Aᵀ, row 2 becomes column 2, and so on. Some tables look exactly the same after turning, like a table of distances between cities. Those are the symmetric matrices, and they turn up all over science and engineering.

Lesson 3 · slide 5Transpose
123456ᵀ = 135246
Key ideas
  1. Row i of A becomes column i of Aᵀ. An m by n matrix becomes n by m.
  2. (AB)ᵀ = BᵀAᵀ: the order reverses, as for inverses.
  3. Symmetric means S = Sᵀ: entry (i, j), in row i and column j, equals entry (j, i).
  4. AᵀA is always symmetric. Lesson 5 uses it to fit the best line through noisy data.

Turn the table

Entry (i, j) is the number in row i, column j. The transpose moves it to row j, column i: entry (i, j) of Aᵀ is entry (j, i) of A. A 3 by 2 matrix becomes 2 by 3.

A = 123456  →  Aᵀ = 135246
Entry (3, 1) of A is 5. It becomes entry (1, 3) of Aᵀ.
The circled column of A turns into the highlighted row of Aᵀ. A has 3 rows and 2 columns, so Aᵀ has 2 rows and 3 columns.

A vector is a column, an n by 1 matrix. Its transpose is a row, 1 by n: 123ᵀ = 123.

The dot product as a row times a column

Lesson 1's dot product fits right in. Write x as a column and xᵀ as a row. Then xᵀy, a 1 by n row times an n by 1 column, is a 1 by 1 matrix: the dot product x · y.

x = 123, y = 40−1:   xᵀy = 12340−1 = 1·4 + 2·0 + 3·(−1) = 1
The row xᵀ meets the column y. One row times one column gives one number, the dot product.

The order flips again

For a product, (AB)ᵀ = BᵀAᵀ, the same reversal as slide 3. Why? Compare one entry of each side:

(AB)ᵢⱼ = (row i of A)·(column j of B)
(BᵀAᵀ)ⱼᵢ = (row j of Bᵀ)·(column i of Aᵀ) = (column j of B)·(row i of A)
Same dot product, so entry (i, j) of AB equals entry (j, i) of BᵀAᵀ

With the numbers below: entry (1, 2) of AB is row 1 of A times column 2 of B, 11·01 = 1. Entry (2, 1) of BᵀAᵀ is row 2 of Bᵀ, 01, times column 1 of Aᵀ, 11: also 1.

A = 1101, B = 2031:   AB = 5131, so (AB)ᵀ = 5311
BᵀAᵀ = 23011011 = 2 + 30 + 30 + 10 + 1 = 5311 ✓

Inverting then transposing gives the same as transposing then inverting: (A⁻¹)ᵀ = (Aᵀ)⁻¹. Why? Transpose both sides of A⁻¹A = I. The product rule (AB)ᵀ = BᵀAᵀ turns the left side into Aᵀ(A⁻¹)ᵀ, and Iᵀ = I. So Aᵀ(A⁻¹)ᵀ = I, which says (A⁻¹)ᵀ undoes Aᵀ. With slide 2's A:

A = 2153, A⁻¹ = 3−1−52, so (A⁻¹)ᵀ = 3−5−12
Aᵀ = 2513: ad − bc = 6 − 5 = 1, so (Aᵀ)⁻¹ = 3−5−12, the same ✓

Symmetric matrices

Think of a table of distances between cities. Paris to Lyon is the same as Lyon to Paris. Flip the table across its diagonal and nothing changes. A matrix like that is symmetric: S = Sᵀ (here S stands for symmetric, not the S from slides 1 and 3), so entry (i, j) equals entry (j, i).

S = 123254346:   (1, 2) = (2, 1) = 2   (1, 3) = (3, 1) = 3   (2, 3) = (3, 2) = 4
Each pair of circled entries sits mirrored across the diagonal, and the two numbers match. So turning S changes nothing: Sᵀ = S.

AᵀA is always symmetric

Row i of Aᵀ is column i of A. So entry (i, j) of AᵀA is column i of A dotted with column j of A. Swap i and j and you get the same dot product, so entry (j, i) is the same number.

A = 123456 is 3 by 2, so AᵀA is 2 by 2.
(1, 1): 1 + 9 + 25 = 35   (1, 2): 2 + 12 + 30 = 44   (2, 1): 2 + 12 + 30 = 44   (2, 2): 4 + 16 + 36 = 56
AᵀA = 35444456
Aᵀ times A. Entry (1, 2) and entry (2, 1) both use columns 1 and 2 of A, so both come out 44.

A bigger example: AAᵀ is 3 × 3

Multiply the other way round and you get a 3 by 3 matrix. Entry (i, j) of AAᵀ is row i of A dotted with row j of A. Swapping i and j gives the same dot product, so AAᵀ is symmetric too:

row 1 · row 1 = 1 + 4 = 5   row 1 · row 2 = 3 + 8 = 11   row 1 · row 3 = 5 + 12 = 17
row 2 · row 2 = 9 + 16 = 25   row 2 · row 3 = 15 + 24 = 39   row 3 · row 3 = 25 + 36 = 61
AAᵀ = 51117112539173961, symmetric again

This is what the lab shows first. With a thousand sensor readings, A is 1000 by 2, so AᵀA is only 2 by 2, and symmetric. That is where lesson 5 starts.

Where this is used

AᵀA shows up whenever we fit a model to many noisy measurements, like a straight line through sensor readings, or tuning a motion sensor in a phone so its readings match reality. And for R from slide 1, which sends pq to −qp, the transpose is the inverse, so undoing R costs nothing to compute (lesson 5 explains which matrices do this). Check it: Rᵀ = 01−10, and RᵀR = 0·0 + 1·10·(−1) + 1·0−1·0 + 0·1(−1)(−1) + 0·0 = I ✓

Next: One more family of matrices hides inside elimination: the ones that only reorder rows. Slide 6 builds them, and their transpose turns out to be their inverse too.

Examples

Example 1 · A wide matrix turned tall

A = 123456 is 2 by 3.

Show solutionHide solution
Aᵀ = 142536 is 3 by 2

Example 2 · The order flips

A = 1101, B = 2031.

Show solutionHide solution
AB = 5131, so (AB)ᵀ = 5311
BᵀAᵀ = 23011011 = 5311 ✓

Example 3 · Dot product as xᵀy

x = 123, y = 40−1.

Show solutionHide solution
xᵀy = 1·4 + 2·0 + 3·(−1) = 1

Example 4

Is 123254346 symmetric?

Show solutionHide solution

Yes: entry (i, j) equals entry (j, i) everywhere. Flip it across the diagonal and nothing changes.

Example 5

Compute AAᵀ for A = 1201.

Show solutionHide solution

AAᵀ = 5221. It is symmetric, as AAᵀ always is.

Exercise In the line G = A @ A.T, change A @ A.T to A.T @ A. The last item, "result", then shows AᵀA: 2 by 2 instead of 3 by 3, and still symmetric. Edit the code and press Run.
slide_5.py Loading Python…
1
Output · Ctrl+Enter runs
Press Run to execute this slide's code. Ctrl+Enter works too.

Enjoying lesson 3? Get the full course: all 8 lessons through the SVD and PCA, your progress saved lesson by lesson, every solution and 5 extra problems per lesson. $20 once, yours for life.

Questions and comments

Stuck on something, or found a mistake? Ask here and I'll answer. You sign in with GitHub.

The full course

From Ax = b to PCA, by running it

Lessons 1 to 3 are free. Finish all eight and you will be able to:

You get: all 8 lessons with Python labs · every worked example and solution · 5 extra problems per lesson · your progress tracked · answers to your questions · every future update.

$20 once · lifetime access
Continue to checkout →

Already a member? Log in to the course