# Thread: how do i..

1. ## how do i..

How do I find a matrix P, where there is a matrix A, such that P^(-1)AP is diagonal??

2. Originally Posted by kgpretty
How do I find a matrix P, where there is a matrix A, such that P^(-1)AP is diagonal??
Look up the eigen decompositon either here or here

RonL

3. Originally Posted by CaptainBlack
Look up the eigen decompositon either here or here

RonL
Thankyou very much. I like the explanation wikipedia gave better.

4. Another question asks, for a matrix A, show that it satisfies it's characteristic equation.

Looking at the example on Wikipedia, would the characteristic equation be (Y - 3)(Y - 2)(Y - 1)?

If it is, how do I complete the above question?

5. Originally Posted by kgpretty
Another question asks, for a matrix A, show that it satisfies it's characteristic equation.

Looking at the example on Wikipedia, would the characteristic equation be (Y - 3)(Y - 2)(Y - 1)?

If it is, how do I complete the above question?
The charateristic equation is:

det(A-lambda I) = 0

(as a polynomial in lambda). Now as 3, 2, 1 are the roots of this equation
we know that if we expand the above expression we will have:

(lambda-3)(lambda-2)(lambda-1)=0

for the charateristic equation, and as A should satisfy this we should find
that:

(A-3)(A-2)(A-1)=0

where there is an impicit multiplication of the 3, 2, 1 and 0 by I.

This expands to:

(A-3)(A-2)(A-1) = (A-3)(A^2 - 3A +2) = A^3 - 6A^2 + 11A -6

The powers of A are simply A^2=AA, A^3=A(AA), and the 6 is short hand
for 6 I.

RonKL

6. Does the question stop at A^3 - 6A^2 + 11A -6
Or do I have to break down the above equation even further. Like find A^3, 6A^2 and so on, then do the addition and substraction??

7. Originally Posted by kgpretty
Does the question stop at A^3 - 6A^2 + 11A -6
Or do I have to break down the above equation even further. Like find A^3, 6A^2 and so on, then do the addition and substraction??
I'm a bit confused by what you need to show. With a particular matrix you
can compute the powers and substitute them into the equation and show
that the matrix satisfies it.

For a general matrix you could show this is in general true.

If D is the diagonal matrix then as each element on the diagonal is an eigen
value of A, we have tivialy that D satisfies the charateristic equation.

Also as P D P^-1 = A, and P D^2 P^-1 = P D P^-1 P D P^-1 = A^2,
and so on for higher powers, so P D^n P^-1 = A^n and we have:

if

sum_{r=0,n} a_r x^r = 0

is a polynomial satisfied by D, then it is also satisfied by A, since:

P sum_{r=0,n} a_r D^r P^-1 = sum_{r=0,n} a_r P D^r P^-1

..................=sum_{r=0,n} a_r A^r = 0.

RonL

8. Ok, I think I get it. Thankyou.

However I have a question for which I am completely stumped.
First, it asked you to find the eigenvectors and eigenvalues for matrix A.
Code:
Matrix A:
|1 3|
|2 6|

Here's what I did:
|1 3|
|2 6|x  = Yx

|1 3|
|2 6|x - Yx = 0

|1-Y      3  |
|  2    6 - Y|x    = 0

.:
(1 - Y)(6 - Y) - 6 = 0
6 + Y^2 - 6Y - 1Y - 6 = 0
Y^2 - 7Y + 0 = 0
(Y + 0)(Y - 7) = 0

When Y = 0
|1 3| |x1|
|2 6| |x2| = 0

Since
|1 3| | 3|
|2 6| |-1| = 0

| 3|
|-1| is an eigenvector corresponding to the eigenvalue 0.

When Y = 7
|1-7     3|
|2     6-7|x = 0

|-6   3| |x1|
| 2  -1| |x2| = 0

Since
|-6   3| |1|
| 2  -1| |2| = 0

|1|
|2| is an eigenvector corresponding to the
eigenvalue 7.

Good, so I got the eigenvalues and vectors.
The question then asked to find P for which
P^-1AP is a diagonal matrix.
P = |3   1|
|-1  2|

P-1 = |3   1|
|-1  2|

= | 3   1|1  0|
|-1   2|0  1|

= |1  0|2  -1|
|0  1|1   3|

= |2  -1|
|1   3|

.:
P^-1AP = |2  -1|  |1  3|  | 3  1|
|1   3|  |2  6|  |-1  2|

= |0   0| |3   1|
|7  21| |-1  2|
So you see my problem, P^-1AP is not equal to a diagonal.... All the other problems I did the same way gave me a diagonal.

9. Originally Posted by kgpretty
Ok, I think I get it. Thankyou.

However I have a question for which I am completely stumped.
First, it asked you to find the eigenvectors and eigenvalues for matrix A.
Code:
Matrix A:
|1 3|
|2 6|

Here's what I did:
|1 3|
|2 6|x  = Yx

|1 3|
|2 6|x - Yx = 0

|1-Y      3  |
|  2    6 - Y|x    = 0

.:
(1 - Y)(6 - Y) - 6 = 0
6 + Y^2 - 6Y - 1Y - 6 = 0
Y^2 - 7Y + 0 = 0
(Y + 0)(Y - 7) = 0

When Y = 0
|1 3| |x1|
|2 6| |x2| = 0

Since
|1 3| | 3|
|2 6| |-1| = 0

| 3|
|-1| is an eigenvector corresponding to the eigenvalue 0.

When Y = 7
|1-7     3|
|2     6-7|x = 0

|-6   3| |x1|
| 2  -1| |x2| = 0

Since
|-6   3| |1|
| 2  -1| |2| = 0

|1|
|2| is an eigenvector corresponding to the
eigenvalue 7.

Good, so I got the eigenvalues and vectors.
The question then asked to find P for which
P^-1AP is a diagonal matrix.
P = |3   1|
|-1  2|

P-1 = |3   1|
|-1  2|

= | 3   1|1  0|
|-1   2|0  1|

= |1  0|2  -1|
|0  1|1   3|

= |2  -1|
|1   3|

.:
P^-1AP = |2  -1|  |1  3|  | 3  1|
|1   3|  |2  6|  |-1  2|

= |0   0| |3   1|
|7  21| |-1  2|
So you see my problem, P^-1AP is not equal to a diagonal.... All the other problems I did the same way gave me a diagonal.
If:

P = [3 1]
.....[-1 2]

P^-1 =.[4/10 2/10]
...........[2/10 6/10]

Ooops, I appear to have inverted the wrong matrix some how, the inverse
should be:

P^-1= [2/7 -1/7]
.........[1/7...3/7]

RonL

10. Originally Posted by CaptainBlack
If:

P = [3 1]
.....[-1 2]

P^-1 =.[4/10 2/10]
...........[2/10 6/10]

RonL
How did you arrive at
P^-1 = [4/10 2/10]
[2/10 6/10]

11. Originally Posted by kgpretty
How did you arrive at
P^-1 = [4/10 2/10]
[2/10 6/10]
some sort of brain fade has occured, I must have inverted the wrong matrix
(this must be the case as I multiplied what I inverted by this "inverse" and
got the identity matrix)

Checking this, the real inverse is

P^-1= [2/7 -1/7]
.........[1/7...3/7]

obtained by Gaussian elimination with multiple right hand sides.

There are many ways of inverting a 2x2 matrix, there is Gaussian elimination,
Cramers rule, inspection, ..

Code:

Demo of Gaussian elimination
----------------------------

Initial set-up:

3 1  |  1  0
-1 2  |  0  1

multiply the second row by 3 and add the first:

3 1  |  1  0
0 7  |  1  3

multiply the first row by 7 and subtract the second:

21 0  |  6 -3
0 7  |  1  3

Divide the first row through by 21, and the second by 7:

1 0  |  2/7  -1/7
0 1  |  1/7   3/7

So the inverse the the matrix:

[2/7  -1/7]
[1/7   3/7]

Check:

>  p=[3,1;-1,2]
3             1
-1             2
>ip=[2/7,-1/7;1/7,3/7]
0.285714     -0.142857
0.142857      0.428571
>
>
>ip.p
1             0
0             1
>
RonL

12. Originally Posted by CaptainBlack
some sort of brain fade has occured, I must have inverted the wrong matrix
(this must be the case as I multiplied what I inverted by this "inverse" and
got the identity matrix)

Checking this, the real inverse is

P^-1= [2/7 -1/7]
.........[1/7...3/7]

obtained by Gaussian elimination with multiple right hand sides.

There are many ways of inverting a 2x2 matrix, there is Gaussian elimination,
Cramers rule, inspection, ..

Code:

Demo of Gaussian elimination
----------------------------

Initial set-up:

3 1  |  1  0
-1 2  |  0  1

multiply the second row by 3 and add the first:

3 1  |  1  0
0 7  |  1  3

multiply the first row by 7 and subtract the second:

21 0  |  6 -3
0 7  |  1  3

Divide the first row through by 21, and the second by 7:

1 0  |  2/7  -1/7
0 1  |  1/7   3/7

So the inverse the the matrix:

[2/7  -1/7]
[1/7   3/7]

Check:

>  p=[3,1;-1,2]
3             1
-1             2
>ip=[2/7,-1/7;1/7,3/7]
0.285714     -0.142857
0.142857      0.428571
>
>
>ip.p
1             0
0             1
>
RonL

I got the same matrix elements for p^-1 as you did.
You have shown that ip.p is a diagonal matrix. However, the question asked to show P^-1AP is a diagonal and that's where I got stumped because it isn't.