Finding a cube root of
starting from a random 3 by 3 matrix:
First, seed the random number generator to your student ID number. I will use a fictitious student ID number of "671234567".
> readlib(randomize);
> randomize(671234567);
> B:=matrix(3,3,rand(-5..5));
Make sure the matrix isn't singular.
> rank(B);
If the rank isn't 3, then the matrix is singular, and you should re-execute the above "B:=matrix(...)" statement until you get a non-singular matrix.
Let a, b, and c be the column vectors of B:
> a:=col(B,1); b:=col(B,2); c:=col(B,3);
Let's find a linear transformation T, which turns a into b, b into c, and c into a. Obviously, if this linear transformation is done three times, you end up with what you started with. In other words, if T is represented by a matrix A, then AB will simply permute the column vectors of B so that they all move one position to the left, and the leftmost column vector gets put on the far right. This is called a "cyclical permutation". If one performs it 3 times, as in AAAB, one ends up with B again. Let C be the matrix with the column vectors cyclically permuted to the left:
> C:=augment(b,c,a);
We want to find A such that
. Multiplying from the right by the inverse of B, one finds:
. That is:
> A:=evalm(C&*inverse(B));
Let's check that this is indeed a cube root of the 3 by 3 identity:
> evalm(A^3);
It works!
For different random matrices, one in general gets a different root. By re-executing the above commands a few times, here are some of the different roots one can obtain:
>
for i from 1 to 5 do
B:=matrix(3,3,rand(-5..5));
if (rank(B)<>3) then
A.i:=singular;
next;
fi;
C:=augment(col(B,2),col(B,3),col(B,1));
A.i:=evalm(C&*inverse(B));
od:
Explanation of this loop:
- The "." is the concatination operator. In other words "A.i" will become the names A1, A2, A3, etc.
- The "<>" (less than followed by greater than) is the "not equal" operator. We are testing to see if the rank is not equal to 3, in which case the matrix is singular.
- If the matrix is singular then that particular A.i (eg A3) is assigned to the string "singular" rather than trying to compute the matrix and getting an error message. The backquotes are used in Maple to denote a character string.
- The "next" statement causes execution to skip to the next value of "i" in the do loop.
- "fi" is used to mark the end of an "if" statement.
- "od" is used to mark the end of a "do" loop.
Now let's take a look at these 5 matrices A1 to A5:
> evalm(A1),evalm(A2),evalm(A3),evalm(A4),evalm(A5);
> evalm(A1^3),evalm(A2^3),evalm(A3^3),evalm(A4^3),evalm(A5^3);
One sees that these are all different cube roots of the 3 by 3 identity matrix!
The same method can be used to obtain nth roots of the n by n identity matrix.
>