1.One which will just multiply two matrices and give the result. The 2x2 matrices can be represented simply as lists of lists.
2.A recursive function that takes two (2) arguments, the matrix and the exponent.
(Hint: Remember the idea in binary powering is to re-write An (or in python notation, say the function binPow(A,n)) as
1.A*An-1 (or A*binPow(A,n-1)) if n is odd.
2.(A2)n/2 (or binPow(A*A,n/2)) if n is even.
Then use the idea that binPow(A,1) is just A to terminate the recursion). Test your program by calculating
1.The 8th power of [[2,1],[-2,-4]]
2.The 17th power of [[1,2],[1,-1]]
Please see the Python program.... View the full answer