Eigenvalues
anddeterminants reveal quite a bit of information about a matrix.
In thislab we will learn how to use MATLAB to compute the eigenvalues,eigenvectors, and the determinant of
a matrix. The emphasis will be on
§7.1Determinants
As you should be aware by now, there is a nice formulafor calculating the determinant of a 2x2 matrix. Even the 3x3 case is notthat difficult. But as matrix size increases so does the complexity ofcalculating determinants. This is where MATLAB, or any other computeralgebra program, comes in.
Example 7.1
Lets start by entering the followingmatrices into MATLAB:
To compute the determinants of these matrices we
aregoing to use the command
>>
MATLAB gives us -472 as the answer. Similarly we get
>>
48
Exercise 7.1 |
|
(a) Compute the determinant of B by hand. Make sure you leave enough space in your write-up for the calculations. Show all work. |
|
(b) Use MATLAB to compute the determinants of the following matrices: A + B, A - B, A*B, AT, BT Note: In MATLAB the transpose of a matrix is denoted with an apostrophe; i.e. AT is given by the command >> A' |
|
(c) Which of the above matrices are NOT invertible? Explain your reasoning. |
|
(d) Now we know the determinants of A and B, but suppose then that we lose our original matrices A and B. Which of the determinants in part (b) will we still be able to compute, even without having A or B at hand? Explain your reasoning. |
Remark 7.1
Exercise 7.2 In this exercise we are going to work with the following matrix: Use det() to compute the determinant of N^100. Do you think that N^100 is invertible? Also use the command to compute the determinant of N. Now, using the determinant of N as a known quantity, calculate by hand the determinant of N^100. What do you notice? Hint: look at Remark 7.1 and consider some of the properties of determinants. |
§7.2
For the rest of this lab we'll be looking at
Example 7.2
Compute the eigenvalues of thematrix B and assign the values to a vector b.
We do this by typing the following
>>
b =
1
8
3
2
The eigenvalues are
1, 8, 3,
Exercise 7.3 |
|
(a) Compute the eigenvalues of the 5x5 Vandermonde matrix V and assign them to a vector v. To enter this matrix into MATLAB use the following command: >> V = vander(1:5) If you don't know what a Vandermonde matrix is look here. We strongly encourage you to familiarize yourself with these matrices as they have very nice properties. |
|
(b) Determine if V is invertible by looking at the eigenvalues. Explain your reasoning. |
Let's now compute the eigenvaluesand eigenvectors of B in one command. To do this we type
>>
P =
1.0000 -0.1980 0.2357 0.9074
0 0.6931 -0.2357 -0.1815
0 0.6931 0.9428
0.3630
0 0 0
0.1089
D =
1 0 0
0 8 0 0
0 0
30
0 0
MATLAB defines the matrix P which has theeigenvectors of B as its columns and the matrix D as a diagonalmatrix with the corresponding eigenvalues along thediagonal.
An important use of eigenvaluesand
eigenvectors is in diagonalizing
matrices. You will see why we might want to do that in the next
section. For now,all we want to do is find an invertible matrix Q
such that Q*B*Q-1= diagonal matrix. But before
we do this, we need to make sure thatB is diagonalizable.
In general the way to determining
Remark 7.2
Here is where our two matrices P and D comein. Type the following command:
>>
1.0000
-0.0000 -0.0000 0.0000
0 8.0000 0
-0.0000
0 0.0000 3.0000
0
0 0 0
2.0000
What you should realize is that we are using linearly independent eigenvectors(from the matrix P) to diagonalize our matrixB. The result is a diagonal matrix with eigenvaluesas its diagonal entries.
Remark 7.3
>>
Exercise 7.4 Find matrices P and D for our Vandermonde matrix V. Calculate inv(P)*V*P to check your work. |
§7.3Fibonacci Numbers
The Fibonacci numbers comprise a well-known sequence inmathematics. The idea is very simple. You start with two numbers, 1and 1, and get each consecutive term by summing the two previous terms. That is, the third term would be 1+1=2, the fourth term 1+2=3, the fifth term2+3=5, and so on, resulting in
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, . . .
Remark 7.4 To learn more about the sequence, go to
We are going to use the Fibonacci numbers as a model forour own sequence. Here it is:
1, 1, 3, 5, 11, 21, 43, ...
Instead of adding two consecutive terms to create the next term, we are goingto use the following formula:
an= an-1 + 2an-2
That is, each term in the sequence is the sum of the previous term and twotimes the term before that. Let's try to come up with a formula for the nthterm in our sequence. Looking at it, it is not that obvious that thereactually exists such a formula.
Our approach is to start by formulating the
problem interms of a system of linear equations:
an+1 |
= |
an+2an-1 |
an |
= |
an |
where an is the nthterm. Now, each system of linear equations has its matrix representation.In this case we get
Let's define
We then get the following equation:
fn= F*fn-1
Similarly, fn-1 = F*fn-2, sothat we can replace fn-1 with F*fn-2. Then we can replace fn-2, and so on. This will resultin the following formula:
fn=(F^n)f0
We assume that a0 is the first term in the sequence and
All we have to do now is find the formula for
Exercise 7.5 Find matrices P and D for our matrix F as described above and explain why F is diagonalizable. |
The above exercise tells us that F = P*D*P-1. We use this to get the following equation
F^n=
[P*D*P-1]*[P*D*P-1]*...*[P*D*P-1]
which reduces to
F^n= P*(D^n)*P-1
All we need at this point is D^n,and since D is diagonal the calculation is very simple. The lastthing to do is to plug it all back into the original equation and read off theformula. But before we can do this we have to note that MATLAB likes tonormalize eigenvectors. In this case it means making the entriesirrational, and hence introducing a possibility for floating pointerrors. To counteract this we are going to use the following command:
>>
Exercise 7.6 |
|
(a) Include input and output from the above command |
|
(b) Use the above matrix P (the one with fractions) to hand calculate the inverse of P. |
|
(c) Determine the formula for the nth term in our sequence, i.e., the formula for an. (This is a tricky question. Make sure to count the terms correctly.) Use your formula to calculate the 5th, 15th and 20th terms in our sequence. |
Even though the process of computing determinants
and
Last Modified:
03/25/2005