Diagonalizing symmetric real bilinear form I am given the following symmetric matrix:
$$
        A=\begin{pmatrix}
        1 & 2 & 0 & 1\\
        2 & 0 & 3 & 0\\
        0 & 3 & -1 & 1\\
        1 & 0 & 1 & 4\\
        \end{pmatrix}\in M_4(\Bbb R)
$$
Let $f\in Bil(V), f(u,v)=u^tAv.$
I want to find a base $B \subset \Bbb R^4$ such that the matrix representing $f $ in respect to $B$ is diagonal.
I took $
        v_1=\begin{pmatrix}
        1 \\
        0  \\
        0  \\
        0
        \end{pmatrix}
$ and found a vector space $V_2=\{v\in\Bbb R^4$| $f(v,v_1)=0\}$, and got $V_2 =sp\{ \begin{pmatrix}
        -2 \\
        1  \\
        0  \\
        0
        \end{pmatrix},\begin{pmatrix}
        0 \\
        0  \\
        1  \\
        0
        \end{pmatrix},\begin{pmatrix}
        -1 \\
        0  \\
        0  \\
        1
        \end{pmatrix}\} =sp\{v_2,v_3,v_4\}$
Now, the matrix in repect to $B=\{v_1,v_2,v_3,v_4\}$ looks like this:$$
        \begin{pmatrix}
        1 & 0 & 0 & 0\\
        0 & -4 & 3 & -2\\
        0 & 3 & -1 & 1\\
        0 & -2 & 1 & 3\\
        \end{pmatrix}
$$
I want to continue inductively, but I'm not sure how to procceed. 
 A: It doesn't seem that it can be done in a straightforward way. The entries of the main diagonal of the matrix of $f$ with respect to the new basis are the roots of the characteristic polynomial of $A$, which is $x^4-4 x^3-16 x^2+61 x-19$. It seems to be irreducible in $\mathbb{Q}[x]$.
A: To put this another way: you've found an invertible matrix $P_1$ such that
$$
A = P_1^TBP_1
$$ 
(here, $P_1 = [v_1\;v_2\;v_3\;v_4]$). Now, consider the submatrix
$$
B_0 = \pmatrix{-4&3&-2\\3&-1&1\\-2&1&3}
$$
we can find a matrix $P_2$ such that $B_0 = P_2^TCP_2$, where 
$$
C = \pmatrix{\pm 1&0&0\\0&*&*\\0&*&*}
$$
All together, we have
$$
A = P_1^TBP_1 = P_1^T \pmatrix{1&0\\0&B_0} P_1 = 
P_1^T \pmatrix{1&0\\0&P_2^TCP_2} P_1
\\ = 
P_1^T\pmatrix{1&0\\0&P_2}^T \pmatrix{1&0 \\ 0& C}\pmatrix{1&0\\0&P_2}P_1
\\ = 
\left[\pmatrix{1&0\\0&P_2}P_1\right]^T \pmatrix{1 \\ & \pm 1\\ &&*&*\\&&*&*}\left[\pmatrix{1&0\\0&P_2}P_1\right]
$$
We can continue this pattern inductively.
A: The method of repeated completing squares also leads, by nature, to rational entries in this case. However, that is not the end of the story, as the given form is $SL_4 \mathbb Z$ equivalent to a diagonal form. In brief,
$$  (w + 2x+z)^2 + (x-2y+z)^2 - (9x-9y+13z)^2 + 19 (2x-2y+3z)^2 = w^2 - y^2 + 4z^2 + 4wx +6xy +2wz +2yz  $$
$$
A =
\left(
\begin{array}{rrrr}
1 & 2 & 0 & 1 \\
2 & 0 & 3 & 0 \\
0 & 3 & -1 & 1 \\
1 & 0 & 1 & 4
\end{array}
\right)
$$
$$
Q =
\left(
\begin{array}{rrrr}
1 & 2 & 0 & 1 \\
0 & 1 & -2 & 1 \\
0 & 9 & -9 & 13 \\
0 & 2 & -2 & 3
\end{array}
\right)
$$
and
$$
D =
\left(
\begin{array}{rrrr}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & -1 & 0 \\
0 & 0 & 0 & 19
\end{array}
\right)
$$
The one-line formula above is just
$$  Q^T D Q = A  $$
As far as the order the question was asked, we take
$$
P = Q^{-1} =
\left(
\begin{array}{rrrr}
1 & 2 & -6 & 25 \\
0 & -1 & 4 & -17 \\
0 & -1 & 1 & -4 \\
0 & 0 & -2 & 9
\end{array}
\right)
$$
to get
$$  P^T A P = D.  $$ Indeed,
$$
P^T  =
\left(
\begin{array}{rrrr}
1 & 0 & 0 & 0 \\
2 & -1 & -1 & 0 \\
-6 & 4 & 1 & -2 \\
25 & -17 & -4 & 9
\end{array}
\right)
$$ and
$$
\left(
\begin{array}{rrrr}
1 & 0 & 0 & 0 \\
2 & -1 & -1 & 0 \\
-6 & 4 & 1 & -2 \\
25 & -17 & -4 & 9
\end{array}
\right)
\left(
\begin{array}{rrrr}
1 & 2 & 0 & 1 \\
2 & 0 & 3 & 0 \\
0 & 3 & -1 & 1 \\
1 & 0 & 1 & 4
\end{array}
\right)
\left(
\begin{array}{rrrr}
1 & 2 & -6 & 25 \\
0 & -1 & 4 & -17 \\
0 & -1 & 1 & -4 \\
0 & 0 & -2 & 9
\end{array}
\right) =
\left(
\begin{array}{rrrr}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & -1 & 0 \\
0 & 0 & 0 & 19
\end{array}
\right)
$$
