Steply

Diagonalizing a matrix

Linear Algebra Ā· 20 problems, easy to harder

ā–¶ Watch the first one solved

How we do it

  1. Find the eigenvalues
  2. Eigenvector for Ī» = 1
  3. Eigenvector for Ī» = 3
  4. Build P and D
  5. Check

The steps for Diagonalize [2, 1; 1, 2]. Every solution names its steps, so you always know what comes next.

Worked examples

Diagonalize [2, 1; 1, 2] Easy

The question

Question: diagonalize A.

A = [2, 1; 1, 2]

Diagonalizing means writing A as P times D times P inverse.

The columns of P are eigenvectors.

D is diagonal: the eigenvalues down the diagonal, 0s elsewhere.

A = P D Pāˆ’1
P: eigenvectors as columns
D: their λs down the diagonal

1 Find the eigenvalues

As in the eigenvalue lesson: take Ī» off the diagonal of A.

A āˆ’ Ī»I = [2 āˆ’ Ī», 1; 1, 2 āˆ’ Ī»]

Its determinant, down minus up, must be 0.

So (2 āˆ’ Ī»)(2 āˆ’ Ī») āˆ’ 1 Ɨ 1 = 0.

(2 āˆ’ Ī»)(2 āˆ’ Ī») āˆ’ 1 Ɨ 1 = 0

Multiply out the brackets, and 1 Ɨ 1 = 1.

4 āˆ’ 2Ī» āˆ’ 2Ī» + Ī»2 āˆ’ 1 = 0

Like terms together, the highest power first: λ² āˆ’ 4Ī» + 3 = 0.

Ī»2 āˆ’ 4Ī» + 3 = 0

It factors, as in the factoring lesson.

(Ī» āˆ’ 1)(Ī» āˆ’ 3) = 0

So Ī» = 1 or Ī» = 3.

Ī» = 1 or Ī» = 3

2 Eigenvector for Ī» = 1

We take 1 off the diagonal: 2 āˆ’ 1 = 1 and 2 āˆ’ 1 = 1.

A āˆ’ 1I = [1, 1; 1, 1]
→ [1, 1; 0, 0]

A row of 0s: the letter y is free.

That is why there are eigenvectors.

Row 1 as an equation: x + y = 0.

x + y = 0

We want x alone.

To remove + y, we take away y on both sides.

x + y āˆ’ y = āˆ’y

They cancel on the left.

So x = āˆ’y.

x = āˆ’y

We pick y = 1.

So an eigenvector for Ī» = 1 is (āˆ’1, 1).

v = [āˆ’1; 1]

3 Eigenvector for Ī» = 3

We take 3 off the diagonal: 2 āˆ’ 3 = āˆ’1 and 2 āˆ’ 3 = āˆ’1.

A āˆ’ 3I = [āˆ’1, 1; 1, āˆ’1]
→ [1, āˆ’1; āˆ’1, 1]
→ [1, āˆ’1; 0, 0]

A row of 0s: the letter y is free.

That is why there are eigenvectors.

Row 1 as an equation: x āˆ’ y = 0.

x āˆ’ y = 0

We want x alone.

To remove āˆ’ y, we add y on both sides.

x āˆ’ y + y = y

They cancel on the left.

So x = y.

x = y

We pick y = 1.

So an eigenvector for Ī» = 3 is (1, 1).

v = [1; 1]

4 Build P and D

P: the eigenvector for Ī» = 1 is column 1, the one for Ī» = 3 is column 2.

D: 1 first, then 3, in the same order.

P = [āˆ’1, 1; 1, 1], D = [1, 0; 0, 3]

Careful!

The order matters.

The first Ī» in D goes with the first column of P.

Careful: D in the same order as the columns of P

So A = P D P⁻¹, with this P and D.

A = P D Pāˆ’1

5 Check

Let's check without the inverse: A = P D P⁻¹ means A P = P D.

We work out both sides.

First A times P.

A P = [2, 1; 1, 2] Ɨ [āˆ’1, 1; 1, 1]
A P = [2 Ɨ (āˆ’1) + 1 Ɨ 1, 2 Ɨ 1 + 1 Ɨ 1; 1 Ɨ (āˆ’1) + 2 Ɨ 1, 1 Ɨ 1 + 2 Ɨ 1]
A P = [āˆ’1, 3; 1, 3]

Now P times D.

P D = [āˆ’1, 1; 1, 1] Ɨ [1, 0; 0, 3]
P D = [āˆ’1 Ɨ 1 + 1 Ɨ 0, āˆ’1 Ɨ 0 + 1 Ɨ 3; 1 Ɨ 1 + 1 Ɨ 0, 1 Ɨ 0 + 1 Ɨ 3]
P D = [āˆ’1, 3; 1, 3]

Both give rows āˆ’1, 3 and 1, 3.

So A P = P D, and the answer is right!

Let's look back.

First: find the eigenvalues.

Then: eigenvector for Ī» = 1.

Then: eigenvector for Ī» = 3.

Then: build P and D.

Last: check.

Answer
A = P D Pāˆ’1

ā–¶ Watch it solved

Diagonalize [5, -2; 1, 2] Medium

The question

Question: diagonalize A.

A = [5, āˆ’2; 1, 2]

Diagonalizing means writing A as P times D times P inverse.

The columns of P are eigenvectors.

D is diagonal: the eigenvalues down the diagonal, 0s elsewhere.

A = P D Pāˆ’1
P: eigenvectors as columns
D: their λs down the diagonal

1 Find the eigenvalues

As in the eigenvalue lesson: take Ī» off the diagonal of A.

A āˆ’ Ī»I = [5 āˆ’ Ī», āˆ’2; 1, 2 āˆ’ Ī»]

Its determinant, down minus up, must be 0.

So (5 āˆ’ Ī»)(2 āˆ’ Ī») āˆ’ 1 Ɨ (āˆ’2) = 0.

(5 āˆ’ Ī»)(2 āˆ’ Ī») āˆ’ 1 Ɨ (āˆ’2) = 0

Multiply out the brackets, and 1 Ɨ (āˆ’2) = āˆ’2.

10 āˆ’ 5Ī» āˆ’ 2Ī» + Ī»2 + 2 = 0

Like terms together, the highest power first: λ² āˆ’ 7Ī» + 12 = 0.

Ī»2 āˆ’ 7Ī» + 12 = 0

It factors, as in the factoring lesson.

(Ī» āˆ’ 3)(Ī» āˆ’ 4) = 0

So Ī» = 3 or Ī» = 4.

Ī» = 3 or Ī» = 4

2 Eigenvector for Ī» = 3

We take 3 off the diagonal: 5 āˆ’ 3 = 2 and 2 āˆ’ 3 = āˆ’1.

A āˆ’ 3I = [2, āˆ’2; 1, āˆ’1]
→ [1, āˆ’1; 2, āˆ’2]
→ [1, āˆ’1; 0, 0]

A row of 0s: the letter y is free.

That is why there are eigenvectors.

Row 1 as an equation: x āˆ’ y = 0.

x āˆ’ y = 0

We want x alone.

To remove āˆ’ y, we add y on both sides.

x āˆ’ y + y = y

They cancel on the left.

So x = y.

x = y

We pick y = 1.

So an eigenvector for Ī» = 3 is (1, 1).

v = [1; 1]

3 Eigenvector for Ī» = 4

We take 4 off the diagonal: 5 āˆ’ 4 = 1 and 2 āˆ’ 4 = āˆ’2.

A āˆ’ 4I = [1, āˆ’2; 1, āˆ’2]
→ [1, āˆ’2; 0, 0]

A row of 0s: the letter y is free.

That is why there are eigenvectors.

Row 1 as an equation: x āˆ’ 2y = 0.

x āˆ’ 2y = 0

We want x alone.

To remove āˆ’ 2y, we add 2y on both sides.

x āˆ’ 2y + 2y = 2y

They cancel on the left.

So x = 2y.

x = 2y

We pick y = 1.

So an eigenvector for Ī» = 4 is (2, 1).

v = [2; 1]

4 Build P and D

P: the eigenvector for Ī» = 3 is column 1, the one for Ī» = 4 is column 2.

D: 3 first, then 4, in the same order.

P = [1, 2; 1, 1], D = [3, 0; 0, 4]

Careful!

The order matters.

The first Ī» in D goes with the first column of P.

Careful: D in the same order as the columns of P

So A = P D P⁻¹, with this P and D.

A = P D Pāˆ’1

5 Check

Let's check without the inverse: A = P D P⁻¹ means A P = P D.

We work out both sides.

First A times P.

A P = [5, āˆ’2; 1, 2] Ɨ [1, 2; 1, 1]
A P = [5 Ɨ 1 + (āˆ’2) Ɨ 1, 5 Ɨ 2 + (āˆ’2) Ɨ 1; 1 Ɨ 1 + 2 Ɨ 1, 1 Ɨ 2 + 2 Ɨ 1]
A P = [3, 8; 3, 4]

Now P times D.

P D = [1, 2; 1, 1] Ɨ [3, 0; 0, 4]
P D = [1 Ɨ 3 + 2 Ɨ 0, 1 Ɨ 0 + 2 Ɨ 4; 1 Ɨ 3 + 1 Ɨ 0, 1 Ɨ 0 + 1 Ɨ 4]
P D = [3, 8; 3, 4]

Both give rows 3, 8 and 3, 4.

So A P = P D, and the answer is right!

Let's look back.

First: find the eigenvalues.

Then: eigenvector for Ī» = 3.

Then: eigenvector for Ī» = 4.

Then: build P and D.

Last: check.

Answer
A = P D Pāˆ’1

ā–¶ Watch it solved

Diagonalize [3, 2; 2, 0] Harder

The question

Question: diagonalize A.

A = [3, 2; 2, 0]

Diagonalizing means writing A as P times D times P inverse.

The columns of P are eigenvectors.

D is diagonal: the eigenvalues down the diagonal, 0s elsewhere.

A = P D Pāˆ’1
P: eigenvectors as columns
D: their λs down the diagonal

1 Find the eigenvalues

As in the eigenvalue lesson: take Ī» off the diagonal of A.

A āˆ’ Ī»I = [3 āˆ’ Ī», 2; 2, āˆ’Ī»]

Its determinant, down minus up, must be 0.

So (3 āˆ’ Ī»)(āˆ’Ī») āˆ’ 2 Ɨ 2 = 0.

(3 āˆ’ Ī»)(āˆ’Ī») āˆ’ 2 Ɨ 2 = 0

Multiply out the brackets, and 2 Ɨ 2 = 4.

āˆ’3Ī» + Ī»2 āˆ’ 4 = 0

Like terms together, the highest power first: λ² āˆ’ 3Ī» āˆ’ 4 = 0.

Ī»2 āˆ’ 3Ī» āˆ’ 4 = 0

It factors, as in the factoring lesson.

(Ī» + 1)(Ī» āˆ’ 4) = 0

So Ī» = āˆ’1 or Ī» = 4.

Ī» = āˆ’1 or Ī» = 4

2 Eigenvector for Ī» = āˆ’1

We take āˆ’1 off the diagonal: 3 āˆ’ (āˆ’1) = 4 and 0 āˆ’ (āˆ’1) = 1.

A āˆ’ (āˆ’1)I = [4, 2; 2, 1]
→ [1, 1 over 2; 2, 1]
→ [1, 1 over 2; 0, 0]

A row of 0s: the letter y is free.

That is why there are eigenvectors.

Row 1 as an equation: x + y/2 = 0.

x + y2 = 0

We want x alone.

To remove + y/2, we take away y/2 on both sides.

x + y2 āˆ’ y2 = āˆ’y2

They cancel on the left.

So x = āˆ’y/2.

x = āˆ’y2

We pick y = 2 to keep whole numbers.

So an eigenvector for Ī» = āˆ’1 is (āˆ’1, 2).

v = [āˆ’1; 2]

3 Eigenvector for Ī» = 4

We take 4 off the diagonal: 3 āˆ’ 4 = āˆ’1 and 0 āˆ’ 4 = āˆ’4.

A āˆ’ 4I = [āˆ’1, 2; 2, āˆ’4]
→ [1, āˆ’2; 2, āˆ’4]
→ [1, āˆ’2; 0, 0]

A row of 0s: the letter y is free.

That is why there are eigenvectors.

Row 1 as an equation: x āˆ’ 2y = 0.

x āˆ’ 2y = 0

We want x alone.

To remove āˆ’ 2y, we add 2y on both sides.

x āˆ’ 2y + 2y = 2y

They cancel on the left.

So x = 2y.

x = 2y

We pick y = 1.

So an eigenvector for Ī» = 4 is (2, 1).

v = [2; 1]

4 Build P and D

P: the eigenvector for Ī» = āˆ’1 is column 1, the one for Ī» = 4 is column 2.

D: āˆ’1 first, then 4, in the same order.

P = [āˆ’1, 2; 2, 1], D = [āˆ’1, 0; 0, 4]

Careful!

The order matters.

The first Ī» in D goes with the first column of P.

Careful: D in the same order as the columns of P

So A = P D P⁻¹, with this P and D.

A = P D Pāˆ’1

5 Check

Let's check without the inverse: A = P D P⁻¹ means A P = P D.

We work out both sides.

First A times P.

A P = [3, 2; 2, 0] Ɨ [āˆ’1, 2; 2, 1]
A P = [3 Ɨ (āˆ’1) + 2 Ɨ 2, 3 Ɨ 2 + 2 Ɨ 1; 2 Ɨ (āˆ’1) + 0 Ɨ 2, 2 Ɨ 2 + 0 Ɨ 1]
A P = [1, 8; āˆ’2, 4]

Now P times D.

P D = [āˆ’1, 2; 2, 1] Ɨ [āˆ’1, 0; 0, 4]
P D = [āˆ’1 Ɨ (āˆ’1) + 2 Ɨ 0, āˆ’1 Ɨ 0 + 2 Ɨ 4; 2 Ɨ (āˆ’1) + 1 Ɨ 0, 2 Ɨ 0 + 1 Ɨ 4]
P D = [1, 8; āˆ’2, 4]

Both give rows 1, 8 and āˆ’2, 4.

So A P = P D, and the answer is right!

Let's look back.

First: find the eigenvalues.

Then: eigenvector for Ī» = āˆ’1.

Then: eigenvector for Ī» = 4.

Then: build P and D.

Last: check.

Answer
A = P D Pāˆ’1

ā–¶ Watch it solved

Practice

Try each one, then open the answer. Stuck? Open the problem to watch every step.

Easy

  1. diagonalize [2, 1; 1, 2]
    Answer
    A = P D Pāˆ’1
  2. diagonalize [4, 1; 2, 3]
    Answer
    A = P D Pāˆ’1
  3. diagonalize [1, 2; 2, 1]
    Answer
    A = P D Pāˆ’1
  4. diagonalize [3, 0; 1, 2]
    Answer
    A = P D Pāˆ’1
  5. diagonalize [2, 0; 0, 5]
    Answer
    A = P D Pāˆ’1
  6. diagonalize [3, 1; 0, 2]
    Answer
    A = P D Pāˆ’1

Medium

  1. diagonalize [5, -2; 1, 2]
    Answer
    A = P D Pāˆ’1
  2. diagonalize [0, 1; -2, 3]
    Answer
    A = P D Pāˆ’1
  3. diagonalize [6, -2; 2, 1]
    Answer
    A = P D Pāˆ’1
  4. diagonalize [2, 2; 1, 3]
    Answer
    A = P D Pāˆ’1
  5. diagonalize [4, -1; 2, 1]
    Answer
    A = P D Pāˆ’1
  6. diagonalize [7, -4; 2, 1]
    Answer
    A = P D Pāˆ’1
  7. diagonalize [1, 2; 0, 3]
    Answer
    A = P D Pāˆ’1

Harder

  1. diagonalize [3, 2; 2, 0]
    Answer
    A = P D Pāˆ’1
  2. diagonalize [-2, 1; 1, -2]
    Answer
    A = P D Pāˆ’1
  3. diagonalize [5, 4; 1, 2]
    Answer
    A = P D Pāˆ’1
  4. diagonalize [1, 4; 2, -1]
    Answer
    A = P D Pāˆ’1
  5. diagonalize [2, 3; 0, 0]
    Answer
    A = P D Pāˆ’1
  6. diagonalize [1, 1; 0, 1]
    Answer
    = only one direction: cannot be diagonalized
  7. diagonalize [2, 1; 0, 2]
    Answer
    = only one direction: cannot be diagonalized