> | with(linalg); |
> | A:=matrix([[1, -1, 0, 0, 0, 0], [4, 5, 0, 0, 0, 0], [0, 0, 0, -1, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1], [0, 0, 0, 0, -1, 0]]); |
> | factor(charpoly(A,t));factor(minpoly(A, t)); |
> | #The matrix is not diagonalizable. Let us do the primary decomposition theorem in this case. We have C^6 = W1+W2+W3 (direct sum) where: |
> | W1:=kernel(A - I); |
> | #Obviously, on W1 the map T is diagonal, equal to multiplication by I |
> | W2:=kernel(A+I); |
> | #Obviously, on W2 the map T is diagonal, equal to multiplication by -I |
> | W3:=kernel((A-3)^2); |
> | w:=multiply(A-3, W3[1]); |
> | #Take as basis for W3 the vectors {w, W3[1]}. (The choice of basis is motivated by the theory of the Jordan canonical form, to be studies soon.) In this basis the transformation is given by |
> | matrix([[3, 1], [0, 3]]); |
> | #Let us check that. |
> | M:=transpose(matrix([W1[1], W1[2], W2[1], W2[2],w, W3[1]])); |
> | multiply(inverse(M), A, M); |
> |