# Minimal polynomial

## 2260 days ago by bigdata2016

Characteristic polynomial

A=matrix(QQ,[[2,1,1,0,0,0,0,0],[0,2,1,0,1,0,0,0],[0,0,2,1,0,1,0,0],[0,0,0,2,0,0,0,0],[0,0,0,0,2,1,0,0],[0,0,0,0,0,2,0,0],[0,0,0,0,0,0,3,1],[0,0,0,0,0,0,0,3]]) p=A.characteristic_polynomial() html('$A=%s$' %latex(A)) html('<br>Characteristic Polynomial is $%s=%s$'%(latex(p),latex(p.factor())))
 $A=\left(\begin{array}{rrrrrrrr} 2 & 1 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 2 & 1 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 2 & 1 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 2 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 2 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 2 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 3 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 3 \end{array}\right)$ Characteristic Polynomial is $x^{8} - 18 x^{7} + 141 x^{6} - 628 x^{5} + 1740 x^{4} - 3072 x^{3} + 3376 x^{2} - 2112 x + 576=(x - 3)^{2} \cdot (x - 2)^{6}$  Characteristic Polynomial is 

Eigenvectors of matrix A corresponding to each eigenvalues

ev=A.eigenvectors_right() X1=ev Y1=ev Z1=ev html('Eigenvector of matrix A corresponding to the eigenvalue $%s$ is $x_1=%s$' %(ev, latex(X1)) ) print html('Eigenvector of matrix A corresponding to the eigenvalue $%s$ is $y_1=%s$' %(ev, latex(Y1)) ) print html('Eigenvector of matrix A corresponding to the eigenvalue $%s$ is $z_1=%s$' %(ev, latex(z1)) )
 Eigenvector of matrix A corresponding to the eigenvalue $3$ is $x_1=\left(0,\,0,\,0,\,0,\,0,\,0,\,1,\,0\right)$ Eigenvector of matrix A corresponding to the eigenvalue $2$ is $y_1=\left(1,\,0,\,0,\,0,\,0,\,0,\,0,\,0\right)$ Eigenvector of matrix A corresponding to the eigenvalue $2$ is $z_1=\left(0,\,1,\,-1,\,0,\,1,\,0,\,0,\,0\right)$ Eigenvector of matrix A corresponding to the eigenvalue is Eigenvector of matrix A corresponding to the eigenvalue is Eigenvector of matrix A corresponding to the eigenvalue is 

Generalized eigenvectors of matrix A corresponding to each eigenvalues

EYE=identity_matrix(A.nrows()) X2=(A-ev*EYE).solve_right(X1) Y2=(A-ev*EYE).solve_right(Y1) Z2=(A-ev*EYE).solve_right(Z1) html('Generalized eigenvector of matrix A corresponding to the eigenvalue $%s$ is $x_2=%s$' %(ev, latex(X2)) ) print html('Generalized eigenvector of matrix A corresponding to the eigenvalue $%s$ is $y_2=%s$' %(ev, latex(Y2)) ) print html('Generalized eigenvector of matrix A corresponding to the eigenvalue $%s$ is $z_2=%s$' %(ev, latex(Z2)) )
 Generalized eigenvector of matrix A corresponding to the eigenvalue $3$ is $x_2=\left(0,\,0,\,0,\,0,\,0,\,0,\,0,\,1\right)$ Generalized eigenvector of matrix A corresponding to the eigenvalue $2$ is $y_2=\left(0,\,1,\,0,\,0,\,0,\,0,\,0,\,0\right)$ Generalized eigenvector of matrix A corresponding to the eigenvalue $2$ is $z_2=\left(0,\,-1,\,1,\,-2,\,0,\,1,\,0,\,0\right)$ Generalized eigenvector of matrix A corresponding to the eigenvalue is Generalized eigenvector of matrix A corresponding to the eigenvalue is Generalized eigenvector of matrix A corresponding to the eigenvalue is 
Y3=(A-ev*EYE).solve_right(Y2) print html('Generalized eigenvector of matrix A corresponding to the eigenvalue $%s$ is $y_3=%s$' %(ev, latex(Y3)) ) print Y4=(A-ev*EYE).solve_right(Y3) html('Generalized eigenvector of matrix A corresponding to the eigenvalue $%s$ is $y_4=%s$' %(ev, latex(Y4)) )
 Generalized eigenvector of matrix A corresponding to the eigenvalue $2$ is $y_3=\left(0,\,-1,\,1,\,0,\,0,\,0,\,0,\,0\right)$ Generalized eigenvector of matrix A corresponding to the eigenvalue $2$ is $y_4=\left(0,\,1,\,-1,\,1,\,0,\,0,\,0,\,0\right)$ Generalized eigenvector of matrix A corresponding to the eigenvalue is Generalized eigenvector of matrix A corresponding to the eigenvalue is 

Jordan Canonical Form of the given matrix

P=[X1,X2,Y1,Y2,Y3,Y4,Z1,Z2] P=matrix(P) P=P.transpose() J1=jordan_block(3,2) J2=jordan_block(2,4) J3=jordan_block(2,2) Ja=block_matrix([[J1,0,0],[0,J2,0],[0,0,J3]]) html('$P=%s$, $J_A=%s$' %(latex(P),latex(Ja)) )
 $P=\left(\begin{array}{rrrrrrrr} 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & -1 & 1 & 1 & -1 \\ 0 & 0 & 0 & 0 & 1 & -1 & -1 & 1 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & -2 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \end{array}\right)$, $J_A=\left(\begin{array}{rr|rrrr|rr} 3 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 3 & 0 & 0 & 0 & 0 & 0 & 0 \\ \hline 0 & 0 & 2 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 2 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 2 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 2 & 0 & 0 \\ \hline 0 & 0 & 0 & 0 & 0 & 0 & 2 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 2 \end{array}\right)$ ,

Checking

html('$P^{-1}\cdot J_A\cdot P=%s$' %latex(P^(-1)*A*P))
 $P^{-1}\cdot J_A\cdot P=\left(\begin{array}{rrrrrrrr} 3 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 3 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 2 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 2 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 2 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 2 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 2 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 2 \end{array}\right)$

Minimal polynomial of the matrix

R, x = QQ['x'].objgen() f=(x-3)^2*(x-2)^4 print html('Minimal polynomial of the matrix is $%s=%s$' %(latex(f),latex(f.factor())))
 Minimal polynomial of the matrix is $x^{6} - 14 x^{5} + 81 x^{4} - 248 x^{3} + 424 x^{2} - 384 x + 144=(x - 3)^{2} \cdot (x - 2)^{4}$ Minimal polynomial of the matrix is