Wednesday, February 16, 2011

Strang's Linear Algebra: rotation & eigenvectors

The rotation matrix R is a fairly basic matrix from linear algebra. When multiplied times a vector, it rotates the vector through the angle θ: We've seen it before (here).


R = [ cos(θ)  -sin(θ) ]
[ sin(θ)   cos(θ) ]


In Strang section 6.2 (first challenge problem), we are asked to prove the reasonable supposition:


R(θ)n = R(nθ)


That is, n sequential applications of the R vector should give the same result as a single rotation through an angle of .

To calculate Rn we'll need the eigenvalues and eigenvectors of R. The interest of this problem comes from consideration of the following question:

what sort of vector could have the same direction after rotation by an arbitrary angle θ?

Use the standard formula:


det (A - λI) = 0

[ cos(θ) - λ  -sin(θ)     ]
[ sin(θ)       cos(θ) - λ ]

[cos(θ) - λ]2 + sin2(θ) = 0
λ2 - 2 λ cos(θ) + cos2(θ) + sin2(θ) = 0
λ2 - 2 λ cos(θ) + 1 = 0


We need the quadratic equation to find λ:


[2 cos(θ) +/- sqrt[4 cos2(θ) - 4]  ] / 2
[2 cos(θ) +/- 2 sqrt[cos2(θ) - 1]  ] / 2
cos(θ) +/- sqrt[cos2(θ) - 1]
cos(θ) +/- sqrt[-sin2(θ)]
cos(θ) +/- i sin(θ)

λ1 = cos(θ) + i sin(θ)
λ2 = cos(θ) - i sin(θ)


Strang gives the eigenvectors as


x1 = (1,i)
x2 = (i,1)


However, I think this is a misprint since R x1 gives:


[ cos(θ)  -sin(θ) ] [ 1 ]   =    [ cos(θ) - i sin(θ) ]
[ sin(θ)   cos(θ) ] [ i ]        [ sin(θ) + i cos(θ) ]


but


λ1 x1 = cos(θ) + i sin(θ)  [ 1 ]
[ i ]

=  [   cos(θ) + i sin(θ) ]
[ - sin(θ) + i cos(θ) ]


We could solve this:


(A - λI1) x1 = 0
(A - λI2) x2 = 0

For x1

[ -i sin(θ)     -sin(θ) ] [ ? ]   =    [ 0 ]
[    sin(θ)   -i sin(θ) ] [ ? ]        [ 0 ]


Without writing it out, it looks like we just need to try a change of sign:


x1 = (-1,i)
A x1 = λ1 x1

[ cos(θ)  -sin(θ) ] [ -1 ] = [ - cos(θ) - i sin(θ) ]
[ sin(θ)   cos(θ) ] [  i ]   [ - sin(θ) + i cos(θ) ]


and λ1 x1 gives the same result:


λ1 x1 = cos(θ) + i sin(θ)  [ -1 ]   = [ - cos(θ) - i sin(θ) ]
[  i ]     [ - sin(θ) + i cos(θ) ]


Similarly, x2 should be (i,-1) because R x2 equals:


[ cos(θ)  -sin(θ) ] [  i ] = [   sin(θ) + i cos(θ) ]
[ sin(θ)   cos(θ) ] [ -1 ]   [ - cos(θ) + i sin(θ) ]


and


λ2 x2 = cos(θ) - i sin(θ)  [  i ]
[ -1 ]

= [   sin(θ) + i cos(θ) ]
[ - cos(θ) + i sin(θ) ]


Everything checks.

Now that we have the eigenvalues and eigenvectors, we need to diagonalize R. We construct the columns of S directly from the eiegenvectors:


S =  [ -1   i  ]
[  i  -1  ]


Λ is just


[  λ1  0  ]
[  0   λ2 ]


To get S-1 let's try the trick for 2 x 2's:


S-1 =  1/2 [  -1  -i ]
[  -i  -1 ]


and multipy to confirm we do get I:


1/2 [  -1  -i ]
[  -i  -1 ]

[ -1   i  ]    [   1   0 ]
[  i  -1  ]    [   0   1 ]


Let's also confirm that S Λ S-1 = R. Part one is:


[  cos(θ) + i sin(θ)             0         ]
[       0                cos(θ) - i sin(θ) ]

[ -1   i  ]   [ -cos(θ) - i sin(θ)     sin(θ) + i cos(θ) ]
[  i  -1  ]   [ -sin(θ) + i cos(θ)    -cos(θ) + i sin(θ) ]

Step 2:

1/2 [  -1  -i ]
[  -i  -1 ]

[ -cos(θ) - i sin(θ)     sin(θ) + i cos(θ) ]    [  a  b ]
[ -sin(θ) + i cos(θ)    -cos(θ) + i sin(θ) ]    [  c  d ]

a = 1/2 [   cos(θ) + i sin(θ) - i sin(θ) +   cos(θ) ] =  cos(θ)
b = 1/2 [ i cos(θ) -   sin(θ) -   sin(θ) - i cos(θ) ] = -sin(θ)
c = 1/2 [   sin(θ) - i cos(θ) + i cos(θ) +   sin(θ) ] =  sin(θ)
d = 1/2 [ i sin(θ) +   cos(θ) +   cos(θ) - i sin(θ) ] =  cos(θ)


And it checks.

To do the exponentiation we just need to calculate Λn. So what is:


λ1n = [ cos(θ) + i sin(θ) ]n
λ2n = [ cos(θ) - i sin(θ) ]n


Strang drops another hint by reminding us of Euler's formula:


e = cos(θ) + i sin(θ)
(e)n = einθ


which is the whole point! But what about:


λ2n = [ cos(θ) - i sin(θ) ]n


If we compare -θ with θ then:


cos(-θ) =  cos(θ)
sin(-θ) = -sin(θ)
cos(θ) - i sin(θ) = cos(-θ) + i sin(-θ) = e-iθ
(e-i&theta)n = e-in&theta


Now all we have to do is convert back to sine and cosine:


λ1n = cos(nθ) + i sin(nθ)
λ2n = cos(nθ) - i sin(nθ)


The big computation we did above (to check that S Λ S-1 = R, is exactly the same with the substitution of nθ for θ.


R(θ)n = 

[ cos(nθ)  -sin(nθ) ]
[ sin(nθ)   cos(nθ) ]


We're done!

No comments: