$$ P^T H P = D $$
$$\left(
\begin{array}{rrr}
1 & 0 & 0 \\
- \frac{ 3 }{ 5 } & 1 & 0 \\
0 & - 1 & 1 \\
\end{array}
\right)
\left(
\begin{array}{rrr}
5 & 3 & 3 \\
3 & 3 & 3 \\
3 & 3 & 8 \\
\end{array}
\right)
\left(
\begin{array}{rrr}
1 & - \frac{ 3 }{ 5 } & 0 \\
0 & 1 & - 1 \\
0 & 0 & 1 \\
\end{array}
\right)
= \left(
\begin{array}{rrr}
5 & 0 & 0 \\
0 & \frac{ 6 }{ 5 } & 0 \\
0 & 0 & 5 \\
\end{array}
\right)
$$
O
$$\left(
\begin{array}{rrr}
5 & 0 & 0 \\
- 3 & 5 & 0 \\
0 & - 5 & 5 \\
\end{array}
\right)
\left(
\begin{array}{rrr}
5 & 3 & 3 \\
3 & 3 & 3 \\
3 & 3 & 8 \\
\end{array}
\right)
\left(
\begin{array}{rrr}
5 & - 3 & 0 \\
0 & 5 & - 5 \\
0 & 0 & 5 \\
\end{array}
\right)
= \left(
\begin{array}{rrr}
125 & 0 & 0 \\
0 & 30 & 0 \\
0 & 0 & 125 \\
\end{array}
\right)
$$
Si conseguimos $25 u^2 + 6 v^2 + 25 w^2 \equiv 0 \pmod {13^2}$ tenemos una transformación lineal que lleva a que el vector a uno que es nulo para el original de la forma cuadrática. Ya que no es una terna Pitagórica (5,12,13) o $5^2 + 12 ^2 = 13 ^2,$ hacemos uso de la coincidencia de los coeficientes de 25 y tome $u=5,v=0,w=12.$
$$
\left(
\begin{array}{rrr}
5 & - 3 & 0 \\
0 & 5 & - 5 \\
0 & 0 & 5 \\
\end{array}
\right)
\left(
\begin{array}{r}
5 \\
0 \\
12 \\
\end{array}
\right) =
\left(
\begin{array}{r}
25 \\
-60 \\
60 \\
\end{array}
\right)
$$
Dividir el último vector por $5$ para obtener
$$
\left(
\begin{array}{r}
5 \\
-12 \\
12 \\
\end{array}
\right)
$$
Con $$ x = 5 , y = -12, z = 12, $$
$$ 5 x^2 + 3 y^2 + 8 z^2 + 6 (yz + z x + x y) = 845 = 5 \cdot 13^2 $$
==============================================================================
$$ E_j^T D_{j-1} E_j = D_j $$
$$ P_{j-1} E_j = P_j $$
$$ E_j^{-1} Q_{j-1} = Q_j $$
$$ P_j Q_j = I $$
$$ P_j^T H P_j = D_j $$
$$ Q_j^T D_j Q_j = H $$
$$ H = \left(
\begin{array}{rrr}
5 & 3 & 3 \\
3 & 3 & 3 \\
3 & 3 & 8 \\
\end{array}
\right)
$$
==============================================
$$ E_{1} = \left(
\begin{array}{rrr}
1 & - \frac{ 3 }{ 5 } & 0 \\
0 & 1 & 0 \\
0 & 0 & 1 \\
\end{array}
\right)
$$
$$ P_{1} = \left(
\begin{array}{rrr}
1 & - \frac{ 3 }{ 5 } & 0 \\
0 & 1 & 0 \\
0 & 0 & 1 \\
\end{array}
\right)
, \; \; \; Q_{1} = \left(
\begin{array}{rrr}
1 & \frac{ 3 }{ 5 } & 0 \\
0 & 1 & 0 \\
0 & 0 & 1 \\
\end{array}
\right)
, \; \; \; D_{1} = \left(
\begin{array}{rrr}
5 & 0 & 3 \\
0 & \frac{ 6 }{ 5 } & \frac{ 6 }{ 5 } \\
3 & \frac{ 6 }{ 5 } & 8 \\
\end{array}
\right)
$$
==============================================
$$ E_{2} = \left(
\begin{array}{rrr}
1 & 0 & - \frac{ 3 }{ 5 } \\
0 & 1 & 0 \\
0 & 0 & 1 \\
\end{array}
\right)
$$
$$ P_{2} = \left(
\begin{array}{rrr}
1 & - \frac{ 3 }{ 5 } & - \frac{ 3 }{ 5 } \\
0 & 1 & 0 \\
0 & 0 & 1 \\
\end{array}
\right)
, \; \; \; Q_{2} = \left(
\begin{array}{rrr}
1 & \frac{ 3 }{ 5 } & \frac{ 3 }{ 5 } \\
0 & 1 & 0 \\
0 & 0 & 1 \\
\end{array}
\right)
, \; \; \; D_{2} = \left(
\begin{array}{rrr}
5 & 0 & 0 \\
0 & \frac{ 6 }{ 5 } & \frac{ 6 }{ 5 } \\
0 & \frac{ 6 }{ 5 } & \frac{ 31 }{ 5 } \\
\end{array}
\right)
$$
==============================================
$$ E_{3} = \left(
\begin{array}{rrr}
1 & 0 & 0 \\
0 & 1 & - 1 \\
0 & 0 & 1 \\
\end{array}
\right)
$$
$$ P_{3} = \left(
\begin{array}{rrr}
1 & - \frac{ 3 }{ 5 } & 0 \\
0 & 1 & - 1 \\
0 & 0 & 1 \\
\end{array}
\right)
, \; \; \; Q_{3} = \left(
\begin{array}{rrr}
1 & \frac{ 3 }{ 5 } & \frac{ 3 }{ 5 } \\
0 & 1 & 1 \\
0 & 0 & 1 \\
\end{array}
\right)
, \; \; \; D_{3} = \left(
\begin{array}{rrr}
5 & 0 & 0 \\
0 & \frac{ 6 }{ 5 } & 0 \\
0 & 0 & 5 \\
\end{array}
\right)
$$
==============================================
$$ P^T H P = D $$
$$\left(
\begin{array}{rrr}
1 & 0 & 0 \\
- \frac{ 3 }{ 5 } & 1 & 0 \\
0 & - 1 & 1 \\
\end{array}
\right)
\left(
\begin{array}{rrr}
5 & 3 & 3 \\
3 & 3 & 3 \\
3 & 3 & 8 \\
\end{array}
\right)
\left(
\begin{array}{rrr}
1 & - \frac{ 3 }{ 5 } & 0 \\
0 & 1 & - 1 \\
0 & 0 & 1 \\
\end{array}
\right)
= \left(
\begin{array}{rrr}
5 & 0 & 0 \\
0 & \frac{ 6 }{ 5 } & 0 \\
0 & 0 & 5 \\
\end{array}
\right)
$$
$$ Q^T D Q = H $$
$$\left(
\begin{array}{rrr}
1 & 0 & 0 \\
\frac{ 3 }{ 5 } & 1 & 0 \\
\frac{ 3 }{ 5 } & 1 & 1 \\
\end{array}
\right)
\left(
\begin{array}{rrr}
5 & 0 & 0 \\
0 & \frac{ 6 }{ 5 } & 0 \\
0 & 0 & 5 \\
\end{array}
\right)
\left(
\begin{array}{rrr}
1 & \frac{ 3 }{ 5 } & \frac{ 3 }{ 5 } \\
0 & 1 & 1 \\
0 & 0 & 1 \\
\end{array}
\right)
= \left(
\begin{array}{rrr}
5 & 3 & 3 \\
3 & 3 & 3 \\
3 & 3 & 8 \\
\end{array}
\right)
$$