Eigen values & eigen vectors of a 3 by 3..

• Oct 8th 2011, 01:38 PM
moljka
Eigen values & eigen vectors of a 3 by 3..
Hello,

Suppose one has the matrix A:
[2 0 -1;
0 3 0;
-1 0 2]

i found eigenvalues: 1 & 3 using the ABC formula. For 1 im getting the eigenvectors:
q1=1/√(2) & q3=1/√(2) (q2 ending up equal to 0), for 3 im getting: q1=-1/√(2), q2=0, q3=-1/√(2).
Matlab gives me:

3 eigen values: 1, 3 & 3.

And the following, wich i believe are supposed to be the eigen vectors:

(>> [VA,DD]=eig(A) <---matlab command)

VA =
[-0.7071 -0.7071 0;
0 0 1.0000;
-0.7071 0.7071 0]

(1/√(2)=0.7071) it gives 3 eigen vectors with a - sign, while im getting 2 with a - sign.

-Why is matlab giving 3 eigen values? should a 3 by 3 matrix always have 3 eigenvalues?

-Why is the last eigen vector 0 1 0 according to matlab? What am i doing wrong?

I was only taught to compute eigen values/vectors of 2 by 2's.

Kind regards,

Moljka

P.S. please forgive me for not displaying the matrices properly in this message.
• Oct 8th 2011, 06:55 PM
Prove It
Re: Eigen values & eigen vectors of a 3 by 3..
Quote:

Originally Posted by moljka
Hello,

Suppose one has the matrix A:
[2 0 -1;
0 3 0;
-1 0 2]

i found eigenvalues: 1 & 3 using the ABC formula. For 1 im getting the eigenvectors:
q1=1/√(2) & q3=1/√(2) (q2 ending up equal to 0), for 3 im getting: q1=-1/√(2), q2=0, q3=-1/√(2).
Matlab gives me:

3 eigen values: 1, 3 & 3.

And the following, wich i believe are supposed to be the eigen vectors:

(>> [VA,DD]=eig(A) <---matlab command)

VA =
[-0.7071 -0.7071 0;
0 0 1.0000;
-0.7071 0.7071 0]

(1/√(2)=0.7071) it gives 3 eigen vectors with a - sign, while im getting 2 with a - sign.

-Why is matlab giving 3 eigen values? should a 3 by 3 matrix always have 3 eigenvalues?

-Why is the last eigen vector 0 1 0 according to matlab? What am i doing wrong?

I was only taught to compute eigen values/vectors of 2 by 2's.

Kind regards,

Moljka

P.S. please forgive me for not displaying the matrices properly in this message.

You solve for the eigenvalues by solving $\displaystyle \displaystyle \left|\mathbf{A} - \lambda\mathbf{I}\right| = 0$ for $\displaystyle \displaystyle \lambda$...

\displaystyle \displaystyle \begin{align*} \mathbf{A} &= \left[\begin{matrix}\phantom{-}2&\phantom{-}0&-1\\ \phantom{-}0&\phantom{-}3&\phantom{-}0\\-1&\phantom{-}0&\phantom{-}2\end{matrix}\right] \\ \mathbf{A} - \lambda \mathbf{I} &= \left[\begin{matrix}\phantom{-}2 - \lambda&\phantom{-}0&-1\\ \phantom{-}0&\phantom{-}3 - \lambda &\phantom{-}0\\-1&\phantom{-}0&\phantom{-}2 - \lambda \end{matrix}\right] \\ \left|\mathbf{A} - \lambda \mathbf{I}\right| &= \left|\begin{matrix}\phantom{-}2 - \lambda&\phantom{-}0&-1\\ \phantom{-}0&\phantom{-}3 - \lambda &\phantom{-}0\\-1&\phantom{-}0&\phantom{-}2 - \lambda \end{matrix}\right| \\ &= (2 - \lambda)\left|\begin{matrix}3-\lambda & 0 \\ 0 & 2-\lambda\end{matrix}\right| - 0\left|\begin{matrix}\phantom{-}0&0\\-1&2-\lambda\end{matrix}\right| + (-1)\left|\begin{matrix}\phantom{-}0&3-\lambda\\ -1 & 0\end{matrix}\right| \\ &= (2-\lambda)(3-\lambda)(2-\lambda) - (3-\lambda) \\ &= (3 - \lambda)\left[(2 - \lambda)^2 - 1\right] \end{align*}

And since $\displaystyle \displaystyle \left|\mathbf{A} - \lambda\mathbf{I}\right| = 0$, that means

\displaystyle \displaystyle \begin{align*} (3 - \lambda)\left[(2 - \lambda)^2 - 1\right] &= 0 \\ 3 - \lambda = 0 \textrm{ or }(2 - \lambda)^2 - 1 &= 0 \\ \lambda = 3 \textrm{ or }(2 - \lambda)^2 &= 1 \\ \lambda = 3 \textrm{ or } 2 - \lambda &= \pm 1 \\ \lambda = 3 \textrm{ or }\lambda = 1 \textrm{ or }\lambda &= 3 \end{align*}

So I agree with your eigenvalues, of course making note that $\displaystyle \displaystyle \lambda = 3$ is a repeated eigenvalue.

Now for the eigenvectors, we need to solve $\displaystyle \displaystyle \mathbf{A}\mathbf{x} = \lambda \mathbf{x}$, where $\displaystyle \displaystyle \mathbf{x} = \left[\begin{matrix}x_1 \\ x_2 \\ x_3\end{matrix}\right]$

Case 1: $\displaystyle \displaystyle \lambda = 1$

\displaystyle \displaystyle \begin{align*}\mathbf{A}\mathbf{x} &= \lambda \mathbf{x} \\ \left[\begin{matrix}\phantom{-}2&\phantom{-}0&-1\\ \phantom{-}0&\phantom{-}3&\phantom{-}0\\-1&\phantom{-}0&\phantom{-}2\end{matrix}\right]\left[\begin{matrix}x_1 \\ x_2 \\ x_3\end{matrix}\right] &= 1 \left[\begin{matrix}x_1 \\ x_2 \\ x_3\end{matrix}\right] \\ \left[\begin{matrix}\phantom{-}2x_1&\phantom{-}0&-x_3\\ \phantom{-}0&\phantom{-}3x_2&\phantom{-}0\\-x_1&\phantom{-}0&\phantom{-}2x_3\end{matrix}\right] &= \left[\begin{matrix}x_1 \\ x_2 \\ x_3\end{matrix}\right] \end{align*}

Row 1: $\displaystyle \displaystyle 2x_1 - x_3 = x_1 \implies x_1 - x_3 = 0 \implies x_1 = x_3$

Row 2: $\displaystyle \displaystyle 3x_2 = x_2 \implies 2x_2 = 0 \implies x_2 = 0$

Row 3: $\displaystyle \displaystyle -x_1 + 2x_3 = x_3 \implies -x_1 = -x_3 \implies x_1 = x_3$

So setting $\displaystyle \displaystyle x_3 = t$ we find that the corresponding eigenvector to the eigenvalue $\displaystyle \displaystyle \lambda = 1$ is $\displaystyle \displaystyle \left[\begin{matrix}t \\ 0 \\ t\end{matrix}\right]$, where you can let $\displaystyle \displaystyle t$ be any value you like.

Case 2: $\displaystyle \displaystyle \lambda = 3$

\displaystyle \displaystyle \begin{align*}\mathbf{A}\mathbf{x} &= \lambda \mathbf{x} \\ \left[\begin{matrix}\phantom{-}2&\phantom{-}0&-1\\ \phantom{-}0&\phantom{-}3&\phantom{-}0\\-1&\phantom{-}0&\phantom{-}2\end{matrix}\right]\left[\begin{matrix}x_1 \\ x_2 \\ x_3\end{matrix}\right] &= 3 \left[\begin{matrix}x_1 \\ x_2 \\ x_3\end{matrix}\right] \\ \left[\begin{matrix}\phantom{-}2x_1&\phantom{-}0&-x_3\\ \phantom{-}0&\phantom{-}3x_2&\phantom{-}0\\-x_1&\phantom{-}0&\phantom{-}2x_3\end{matrix}\right] &= \left[\begin{matrix}3x_1 \\ 3x_2 \\ 3x_3\end{matrix}\right] \end{align*}

Row 1: $\displaystyle \displaystyle 2x_1 - x_3 = 3x_1 \implies x_1 = -x_3$

Row 2: $\displaystyle \displaystyle 3x_2 = 3x_2 \implies x_2 = s$ where $\displaystyle \displaystyle s$ can be any value you like.

Row 3: $\displaystyle \displaystyle -x_1 + 2x_3 = 3x_3 \implies x_1 = -x_3$

So set $\displaystyle \displaystyle x_3 = r$ where $\displaystyle \displaystyle r$ can be any value you like, and you find that the eigenvector corresponding to $\displaystyle \displaystyle \lambda = 3$ is $\displaystyle \displaystyle \left[\begin{matrix}-r \\ \phantom{-}s \\ \phantom{-}r\end{matrix}\right]$

It is common practice to have the same number of eigenvectors as eigenvalues, and to give a value to your parameters. This is what MatLab has done.
• Oct 9th 2011, 04:13 AM
moljka
Re: Eigen values & eigen vectors of a 3 by 3..

I see that i missed the (3-λ) part when solving |A-λI|=0 so i only had 3 eigen values. The - signs Matlab gives are different for some reason.

I must obtain a matrix Q consisting of the eigenvectors. Q must be orthogonal, satisfying: Q*Transpose(Q)=I. (A is symmetric)
Creating a matrix Q from the column vectors [t 0 t] , [-r 0 r] & Matlab's [0 1 0] gives a matrix Q:
t -r 0
0 0 1
t r 0

r & t are both: 1/√(2) (||q||=1 euclidean distance condition)

This satisfies Q=transpose(Q).

But it leaves me with 1 question, how was i supposed to obtain the last column (eigen?)vector [0 1 0]? Is there some rule that provides a fast solution?
Thank you for helping me out.

Regards,

Moljka
• Oct 9th 2011, 04:23 AM
Deveno
Re: Eigen values & eigen vectors of a 3 by 3..
we can write (-r,s,r) as r(-1,0,1) + s(0,1,0).

since (-1,0,1) and (0,1,0) are linearly independent, we are free to choose r and s ....independently (ha!).

since we desire an orthogonal matrix, we need r(-1,0,1) to be a unit vector, which is how you got r = 1/√2.

since (0,1,0) is already a unit vector, we can take s = 1.
• Oct 9th 2011, 07:10 AM
moljka
Re: Eigen values & eigen vectors of a 3 by 3..
You "split" (-r s r) to obtain the 3rd column (0 1 0) of Q. Is (0 1 0) considered an eigenvector too? For instance, if i am asked to get the eigen vectors of A do i mention (0 1 0) in a case like this? or do i only mention it when im asked to get the matrix Q?

Thank you very much for helping me out.

Regards,

Moljka
• Oct 9th 2011, 07:35 AM
Deveno
Re: Eigen values & eigen vectors of a 3 by 3..
an eigenvalue may have more than one eigenvector. in this case both (-1/√2,0,1/√2) and (0,1,0) are eigenvectors corresponding to the (repeated) eigenvalue 3.

one of the reasons for finding eigenvectors is to find an eigenbasis, that is, an invertible matrix that diagonalizes your original one. as you need all three vectors to obtain this eigenbasis, you should list all 3.