From the book "Bilinear forms and their matrices" by Prof. Joel Kamnitzer:
Consider: $$ A=\pmatrix{0 & 4 \\ 4 & 2} $$ After doing simultaneous row and column operations we reach: $$ Q^tAQ= \pmatrix{-8 & 0 \\ 0 & 2} $$
And then he implies that $ Q= \pmatrix{1 & 0 \\ -2 & 1 }$ , which indeed verifies the result, but I do not know how he found that matrix. So I found the post "How to diagonalize a matrix" and tried to follow those steps. However the eigenvalues I found involve $\sqrt{17}$, and that number does not go away once I try to diagonlize the matrix. So I must be doing something wrong.
So, how can one find Q? A general solution is of course welcome too.
Let $R_1, R_2$ be the first and second row, $C_1, C_2$ be the first and second column.
Then to get to diagonal form take $R_1-2R_2$ then we get the martix $$\begin{bmatrix} -8 & 0 \\ 4 & 2 \end{bmatrix}.$$
Now since we are doing simulataneous row and column transformations we need to take $C_{1}-2C_{2}$. This yields the matrix $$\begin{bmatrix} -8 & 0 \\ 0 & 2 \end{bmatrix}.$$
The elementary matrix that represents $C_{1}-2C_{2}$ is exactly $$Q=\begin{bmatrix} 1 & 0 \\ -2 & 1 \end{bmatrix}.$$
Similarly $$Q^{T}=\begin{bmatrix} 1 & -2 \\ 0 & 1 \end{bmatrix}$$ represents $R_{1}-2R_{2}$. Hence we get $Q^{T}AQ=\begin{bmatrix} -8 & 0 \\ 0 & 2 \end{bmatrix}.$
In general right multiplication by an elementary matrix is equivalent to column operations and left multiplications is row operations and since we are doing simultaneous reduction the left and right matrices are just transposes of each other.