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:
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: