# Matrix decomposition in unipotent matrices

Consider the positive definite and symmetric matrix

$$A = \begin{pmatrix} 1 & 2 & 0 \\ 2 & 6 & -1 \\ 0 & -1 & 1 \end{pmatrix}$$

Find a decomposition with unipotent $U \in \mbox{Mat} (3,3,\mathbb{R})$ and a diagonal matrix $D \in \mbox{Mat} (3,3,\mathbb{R})$ such that $$U^tAU = D$$

I struggle with this task since this is different in the sense that D does not contain the eigenvalues, so it is not just an application of the spectral theorem for symmetric real matrices. Instead, it is $\mbox{diag}(\delta_1, \frac{\delta_2}{\delta_1}, \dots, \frac{\delta_n}{\delta_{n-1}})$ where $\delta_n$ stands for the $n$-th principal minor of the matrix $A$. Thus, to calculate $D$ is easy. However, how do I find those unipotent transformation matrices $U$?

Let us look for matrices $\mathrm U$ and $\mathrm D$ of the form

$$\mathrm U = \begin{bmatrix} 1 & u_1 & u_2\\ 0 & 1 & u_3\\ 0 & 0 & 1\end{bmatrix} \qquad \qquad \qquad \mathrm D = \begin{bmatrix} d_1 & 0 & 0\\ 0 & d_2 & 0\\ 0 & 0 & d_3\end{bmatrix}$$

Using SymPy:

>>> u1, u2, u3 = symbols('u1 u2 u3')
>>> d1, d2, d3 = symbols('d1 d2 d3')
>>> U = Matrix([[1, u1, u2], [0, 1, u3], [0, 0, 1]])
>>> U
[1  u1  u2]
[         ]
[0  1   u3]
[         ]
[0  0   1 ]
>>> D = diag(d1,d2,d3)
>>> D
[d1  0   0 ]
[          ]
[0   d2  0 ]
[          ]
[0   0   d3]
>>> A = Matrix([[1, 2, 0], [2, 6, -1], [0, -1, 1]])
>>> A
[1  2   0 ]
[         ]
[2  6   -1]
[         ]
[0  -1  1 ]
>>> D - (U.T * A * U)
[  d1 - 1                 -u1 - 2                                   -u2 - 2*u3                     ]
[                                                                                                  ]
[ -u1 - 2       d2 - u1*(u1 + 2) - 2*u1 - 6              -u2*(u1 + 2) - u3*(2*u1 + 6) + 1          ]
[                                                                                                  ]
[-u2 - 2*u3  -u1*(u2 + 2*u3) - 2*u2 - 6*u3 + 1  d3 - u2*(u2 + 2*u3) - u3*(2*u2 + 6*u3 - 1) + u3 - 1]


We have $6$ equations in $6$ unknowns. The solution is

$$(u_1, u_2, u_3) = \left(-2,-1,\frac 12\right) \qquad \qquad \qquad (d_1, d_2, d_3) = \left(1,2,\frac 12\right)$$

Using SymPy to verify:

>>> U = Matrix([[1, -2, -1], [0, 1, 0.5], [0, 0, 1]])
>>> U
[1  -2  -1 ]
[          ]
[0  1   0.5]
[          ]
[0  0    1 ]
>>> U.T * A * U
[1  0   0 ]
[         ]
[0  2   0 ]
[         ]
[0  0  0.5]
>>> (U - eye(3))**3
[0  0  0]
[       ]
[0  0  0]
[       ]
[0  0  0]

• Thanks Rodrigo de Azevedo! But isn't there some kind of simplified method for calculation of the U matrix? Like, for example, the transformation matrix that contains the eigenvectors in the diagonalizatiation case? – Taufi Jul 20 '16 at 15:39
• @Taufi I don't know. This is the first time I work with unipotent matrices. – Rodrigo de Azevedo Jul 20 '16 at 15:40
• @Taufi The leading principal minors of $A$ are $1, 2, 1$. Hence, the diagonal of $D$ should be, according to your statement, $1,2,\frac 12$, which is what I obtained using SymPy. – Rodrigo de Azevedo Jul 20 '16 at 16:03
• Yes, that is true. The diagonal matrix is calculated pretty fast. But is there some formula as for the diagonal matrix or just your approach with a system of linear equations? – Taufi Jul 20 '16 at 16:13

Note that since $A$ is positive definite, it has a Cholesky decomposition $A = LL^T$, where $L$ is an lower-triangular matrix. It follows that $L^{-1}$ is also lower-triangular.

Since $L^{-1}$ is lower triangular, there exists a diagonal matrix $M$ such that $ML^{-1} = U^T$ has $1$s on the diagonal. Since $U$ is an upper-triangular matrix with $1$s on the diagonal, it must be unipotent. Moreover, we have $$U^TAU = (ML^{-1})(LL^T)(ML^{-1})^T = M(LL^{-1})(LL^{-1})^T M^T = MM^T = M^2$$ Thus, we have an algorithm to calculate $U$, and the entries of the diagonal matrix $D$ are the squares of the diagonal entries of $L$.