Forma de Jordan

En este documento implementamos algunos ejemplos de cálculo de formas canónicas de Jordan (y las matrices de paso).

from sympy import Matrix, eye

El primer ejemplo que vamos a desarrolar usando sympy es el Ejercicio resuelto número 69 de [L. Merino, E. Santos Álgebra Lineal con Métodos Elementales].

Ejemplo 1

Calcula la forma normal de Jordan de la matriz \[ \begin{pmatrix} 0& -4 & 0 & -1 \\ 0 & 2 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 4 & 8 & -12 & 4 \end{pmatrix}. \]

A=Matrix([(0,-4,0,-1),(0,2,0,0),(0,0,0,0),(4,8,-12,4)])
A

\(\displaystyle \left[\begin{matrix}0 & -4 & 0 & -1\\0 & 2 & 0 & 0\\0 & 0 & 0 & 0\\4 & 8 & -12 & 4\end{matrix}\right]\)

Podemos calcular la fórma canónic de Jordan con el método jordan_form.

P,J=A.jordan_form()
P

\(\displaystyle \left[\begin{matrix}3 & -2 & 1 & -2\\0 & 0 & 0 & 1\\1 & 0 & 0 & 0\\0 & 4 & 0 & 0\end{matrix}\right]\)

J

\(\displaystyle \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 2 & 1 & 0\\0 & 0 & 2 & 0\\0 & 0 & 0 & 2\end{matrix}\right]\)

P.inv()*A*P

\(\displaystyle \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 2 & 1 & 0\\0 & 0 & 2 & 0\\0 & 0 & 0 & 2\end{matrix}\right]\)

Hagamos el cálculo “a mano”. Veamos primero cuáles son sus valores propios.

A.eigenvects()
[(0,
  1,
  [Matrix([
   [3],
   [0],
   [1],
   [0]])]),
 (2,
  3,
  [Matrix([
   [-2],
   [ 1],
   [ 0],
   [ 0]]),
   Matrix([
   [-1/2],
   [   0],
   [   0],
   [   1]])])]

Son el 2 con multiplicidad 3, y el 0 con multiplicidad 1. Vemos que la multiplicidad geométrica de 2 es 2, por lo que la matriz no es diagonalizable.

A2=A-2*eye(4)
A2

\(\displaystyle \left[\begin{matrix}-2 & -4 & 0 & -1\\0 & 0 & 0 & 0\\0 & 0 & -2 & 0\\4 & 8 & -12 & 2\end{matrix}\right]\)

A2.nullspace()
[Matrix([
 [-2],
 [ 1],
 [ 0],
 [ 0]]),
 Matrix([
 [-1/2],
 [   0],
 [   0],
 [   1]])]

Por tanto el subespacio propio asociado al 2 tiene dimensión menor que la multiplicidad algebraica de 2 (que es 3). Calculamos \(\operatorname{N}(A-2I)^2\).

V2_2=(A2**2).nullspace()
V2_2
[Matrix([
 [1],
 [0],
 [0],
 [0]]),
 Matrix([
 [0],
 [1],
 [0],
 [0]]),
 Matrix([
 [0],
 [0],
 [0],
 [1]])]

Que ya tiene dimensión tres, igual a la multiplicidad algebraica del autovalor 2. Así el bloque de Jordan correspondiente a este autovalor se formará con una base de \(\operatorname{N}(A-2I)^2\) que contiene a dos vectores de \(\operatorname{N}(A-2I)\).

Escogemos un vector \(u\) de \(\operatorname{N}(A-2I)^2\setminus\operatorname{N}(A-2I)\), calculamos \(Au\), que estará en \(\operatorname{N}(A-2I)\), y luego tomamos un vector que complete una base de \(\operatorname{N}(A-2I)\). Con estos tres vectores tendremos la caja de Jordan asociada al autovalor 2.

u1=V2_2[0]
u1

\(\displaystyle \left[\begin{matrix}1\\0\\0\\0\end{matrix}\right]\)

u2=A2*u1
u2

\(\displaystyle \left[\begin{matrix}-2\\0\\0\\4\end{matrix}\right]\)

Seleccionamos un vector de la base de \(\ker(A-2I)\) que sea linealmente independiente con los dos ya calculados.

cand=[v for v in V2_2 if Matrix.hstack(u1,u2,v).rank()==3]
cand
[Matrix([
 [0],
 [1],
 [0],
 [0]])]
u3=cand[0]
u3

\(\displaystyle \left[\begin{matrix}0\\1\\0\\0\end{matrix}\right]\)

P2=Matrix.hstack(u1,u2,u3)
P2

\(\displaystyle \left[\begin{matrix}1 & -2 & 0\\0 & 0 & 1\\0 & 0 & 0\\0 & 4 & 0\end{matrix}\right]\)

Ahora sólo nos basta completar con la parte de la base correspondiente al autovalor 0.

V0=A.nullspace()
V0
[Matrix([
 [3],
 [0],
 [1],
 [0]])]
P=Matrix.hstack(P2,V0[0])
P

\(\displaystyle \left[\begin{matrix}1 & -2 & 0 & 3\\0 & 0 & 1 & 0\\0 & 0 & 0 & 1\\0 & 4 & 0 & 0\end{matrix}\right]\)

Comprobemos que la matriz \(P\) es una matriz de paso para una forma de Jordan de \(A\).

P.inv()*A*P

\(\displaystyle \left[\begin{matrix}2 & 0 & 0 & 0\\1 & 2 & 2 & 0\\0 & 0 & 2 & 0\\0 & 0 & 0 & 0\end{matrix}\right]\)

Hagamos ahora el Ejemplo III.5.19 de [I. Ojeda, J. Gago, Métodos matemáticos para la Estadística].

Ejemplo

Calcular la forma de Jordan de la matriz \[ A=\begin{pmatrix} 1& -1 & 1 &-1\\ -1 & 0 & 1 & -1\\ -1 & 3 & -10& 9\\ 0 & 4 & -12 & 11 \end{pmatrix}. \]

A=Matrix([(1,-1,1,-1),(-1,0,1,-1),(-1,3,-10,9),(0,4,-12,11)])
A

\(\displaystyle \left[\begin{matrix}1 & -1 & 1 & -1\\-1 & 0 & 1 & -1\\-1 & 3 & -10 & 9\\0 & 4 & -12 & 11\end{matrix}\right]\)

P,J = A.jordan_form()
P

\(\displaystyle \left[\begin{matrix}0 & 0 & -1 & - \frac{1}{2}\\0 & 1 & - \frac{1}{2} & 1\\1 & -3 & \frac{7}{2} & 0\\1 & -4 & 4 & 0\end{matrix}\right]\)

J

\(\displaystyle \left[\begin{matrix}-1 & 0 & 0 & 0\\0 & 1 & 1 & 0\\0 & 0 & 1 & 1\\0 & 0 & 0 & 1\end{matrix}\right]\)

P.inv()*A*P

\(\displaystyle \left[\begin{matrix}-1 & 0 & 0 & 0\\0 & 1 & 1 & 0\\0 & 0 & 1 & 1\\0 & 0 & 0 & 1\end{matrix}\right]\)