# Maple Lab 6: Fibonacci and Lucas Sequences with(LinearAlgebra): # Problem 1. # Define A = Matrix(2, 2, {(1, 1) = 0, (1, 2) = 1, (2, 1) = 1, (2, 2) = 1});. Using Maple, compute A^5; and use it to find vector u[5]; and then find Fibonacci number y[5];. y0:=0:y1:=1:A:=<0,1|1,1>;u0:=; = (A^5).u0; # Problem 2. # Show that the eigenvalues of matrix A are lambda[1] = (1+sqrt(5))*(1/2); and lambda[2] = (1-sqrt(5))*(1/2); by solving the characteristic equation of A. chareq:=CharacteristicPolynomial(A,lambda); lambda1,lambda2:=solve(chareq,lambda); # Problem 3. # Show that Vector(2, {(1) = -lambda[2], (2) = 1}); and Vector(2, {(1) = -lambda[1], (2) = 1}); are eigenvectors of A corresponding to lambda[1]; and lambda[2]; respectively. Computations will use lambda[1]+lambda[2] = 1; and lambda[1]*lambda[2] = -1;. # AP=PD verifies the eigenpairs. Check with Eigenvectors(A); P:=<-lambda2,1|-lambda1,1>;DD:=; simplify(A.P-P.DD); # AP=PD verifies the eigenpairs ; # Problem 4. # A 2x2 matrix A is defined to be diagonalizable provided it has 2 eigenpairs. Explain why A is diagonalizable, by exhibiting the 2 eigenpairs. # TO DO: Compute eigenpairs. See problem 3 code. # TO DO: Explain why A is diagonalizable. # Problem 5. # A diagonalizable matrix A satisfies the equation AP=PD where D is a diagonal matrix of eigenvalues and P is the augmented matrix of corresponding eigenvectors (D and P are not unique). Use the results of Problem 4 to find an invertible matrix P and a diagonal matrix D for which A = P D P^(-1);. # Use AP=PD diagonalization theory from the textbook. # Problem 6. # Use Maple to calculate D^10;, then use it to find A^10= PD^(10);1/P;, vector u[10];, and Fibonacci number y[10];. Confirm your result for y[10]; by writing out the Fibonacci sequence by hand and then consulting Wikipedia. In the solution, explain in detail why A^10= PD^(10);P^(-1).; P:=<-lambda2,1|-lambda1,1>;DD:=; DD^10; = simplify(P . DD^10 . (1/P) . u0); # AP=PD explains why A^10 = P D^10 (1/P) # Problem 7. # A formula for y[k]; may be derived using the preceding two problems. Use aleady derived expressions for P, D, and A^k; to obtain the formula for k=1,2,3, ... Ak := 1/sqrt(5) *Matrix( 2,2, [ [ lambda[2]^k*lambda[1], lambda[2]^(k+1)*lambda[1]-lambda[1]^(k+1)*lambda[2] ], [lambda[1]^k-lambda[2]^k, lambda[1]^(k+1)-lambda[2]^(k+1) ] ] ): print( Ak ); # TO DO: Reformulate P, DD with symbols c,d. Then compute # power k of A from the formula AP=PD. # Problem 8. # Use the result of Problem 7 to find vector u[k]; and Fibonacci number y[k];. Simplifications use cd = lambda[1]*lambda[2] = -1;. The answer should be u0 := Vector( 2, [1,1] ): uk := Ak . u0: yk := uk[1]: yk; # y[k]; = 1/sqrt(5); lambda[1]^k-lambda[2]^k; = 1/sqrt(5);((1+sqrt(5))*(1/2))^k-((1-sqrt(5))*(1/2))^k; # Calculate Fibonacci number y[10]; using this formula, and compare your result to that of Problem 6. # Problem 9. # The second eigenvalue lambda[2]; is less than 1 in absolute value, therefore term lambda[2]^k; will approach zero as k;approaches infinity. The following approximate equation results for the k^th;Fibonacci number: # y[k]; ~ 1/sqrt(5);((1+sqrt(5))*(1/2))^k; # Use this approximation to approximate y[k+1]/y[k];. # Problem 10. # Consider the Lucas sequence generated by the difference equation # y[k+2] = 3*y[k+1]-2*y[k]; # with y[0] = 0; and y[1] = 1;. Write out by hand the first seven terms of this sequence and see if you can find the pattern. Then apply eigenanalysis, as was done for the Fiboanacci sequence, to find a formula for y[k];. # Problem 11. # Consider the Lucas sequence generated by the difference equation # y[k+2] = 2*y[k+1]-y[k]; # with y[0] = 0; and y[1] = 1;. Find the pattern by writing out as many terms in the sequence as you need. Will the Fibonacci sequence analysis work in this case? Why or why not? Consult the Wikipedia page on the Lucas Sequence for a solution formula.