# _____________________________________________________________________

Matrices

28-7-14

_____________________________________________________________________
The 2 x 2 matrix
_____________________________________________________________________
The determinate:
[a b]
[c d]

[1 -2]
[1 4]

=> det = 1.4 - -2.1 = 6

The eigenvalues L1 and L2 are:
[a-L
[c

b ]
d-L] = (a-L)(d-L) - b.c

[1-L
[1

-2 ]
4-L] = (1-L)(4-L) - -2.1

=> L^2 - 5L + 6 = 0
L^2 - 5L + 6 = (L - 2)(L - 3)
L1 = 2
L2 = 3

Find the eigenvector for L1:
[1-2
[1

-2 ] [-1 -2]
[-1]
4-2] = [ 1 2] ---> [ 1]

Find the eigenvector for L2:
[1-3
[1

-2 ] [-2 -2]
[-2]
4-3] = [ 1 1] ---> [ 1]

Check L1 eigenvector:

[1 -2][-1] [-3]
[1 4][ 1] = [ 3]
Check L2 eigenvector:
[1 -2][-2] [-4]
[1 4][ 1] = [ 2]
_____________________________________________________________________
The html file below finds the eigenvalue and eigenvector
for a 2 x 2 matrix
_____________________________________________________________________
<!DOCTYPE HTML PUBLIC " - //W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
">
<html xmlns="http://www.w3.org/1999/xhtml">
<title>A for loop</title>
<body>
<script type="text/javascript" language="javascript">
document.write("<h3>2 x 2 Matrix<h3>")
a=6;
b=-2;
c=1;
d=3;
det=a*d-b*c;
document.write("<h3>[a b][",a," ",b,"]")
document.write("<h3>[c d][",c," ",d,"]")

=> det = 1.4 - -2.1 = 6

document.write("<h3>The determinent = ",det,"<h3>")
<h3>")
a1=1;
b1=0-a-d;
c1=det;
F=0-b1/2;
S=(a+d)*(a+d)-4*c1;
D=Math.sqrt(S);
L1=F-D/2;
document.write("<h3>If (a+d)*(a+d)-4*det is negative then the solution is an ima
ginary number.<h3>")
document.write("<h3> (a+d)*(a+d)-4*det = ",S,"<h3>")

document.write("<h3>L1 = ",L1,"<h3>")
L2=F+D/2;
document.write("<h3>L2 = ",L2,"<h3>")
document.write("<h3> The eigenvector for L1 is:<h3>")
//Find the eigenvector for L1:
//[1-2 -2 ] [-1 -2]
[-1]
//[1
4-2] = [ 1 2] ---> [ 1]
document.write("<h3> [",a-L1,"]")
document.write("<h3> [",c,"]")
document.write("<h3> The eigenvector for L2 is:<h3>")
//Find the eigenvector for L2:
//[1-3 -2 ] [-2 -2]
[-2]
//[1
4-3] = [ 1 1] ---> [ 1]
document.write("<h3> [",a-L2,"]")
document.write("<h3> [",c,"]")
document.write("<h3>Check L1 eigenvector:<h3>")
//Check L1 eigenvector:
//[1 -2][-1] [-3]
//[1 4][ 1] = [ 3]
document.write("<h3>[",a," ",b,"][",a-L1,"]
document.write("<h3>[",c," ",d,"][",c,"] =

[",(a-L1)*a+b*c,"]")
[",(a-L1)*c+d*c,"]")

document.write("<h3>Check L2 eigenvector:<h3>")
//Check L2 eigenvector:
//[1 -2][-2] [-4]
//[1 4][ 1] = [ 2]
document.write("<h3>[",a," ",b,"][",a-L2,"]
document.write("<h3>[",c," ",d,"][",c,"] =

[",(a-L2)*a+b*c,"]")
[",(a-L2)*c+d*c,"]")

</script>
</body>
</html>
_____________________________________________________________________
Below is the output of the above html file.
_____________________________________________________________________
2 x 2 Matrix
[a b][6 -2]
[c d][1 3]
The determinent = 20

If (a+d)*(a+d)-4*det is negative then the solution is an imaginary number.
(a+d)*(a+d)-4*det = 1
L1 = 4
L2 = 5
The eigenvector for L1 is:
[2]
[1]
The eigenvector for L2 is:
[1]
[1]
Check L1 eigenvector:
[6 -2][2] [10]
[1 3][1] = [5]
Check L2 eigenvector:
[6 -2][1] [4]
[1 3][1] = [4]
_____________________________________________________________________