Quadratic forms, change of variables

If one has a symmetric matrix $A$, one can diagonalize it with an orthonormal change of basis vectors, e.g. $S^TAS$ is diagonal. Now lets consider the following matrix $$A=\begin 1&1\\ 1&2 \end. $$ This matrix corresponds to the symmetric form $$x_1^2+2x_1x_2+2x_2^2=(x_1+x_2)^2+x_2^2.$$ For me this looks like there has to be a way of determining some $S$ as above (without having to diagonalize etc., just by completing of the square) by taking some change of variables $x_1\leadsto x_1+x_2,\ x_2\leadsto x_2$. This would be done by the matrix $$S=\begin 1&1\\ 0&1 \end$$ but this doesn't work out for me. Any help will be gratefully appreciated. Edit: Let me reformulate my question. By Sylvester's law of inertia there exists for every symmetric matrix $A$ some basis such that $S^TAS$ is diagonal with only 1,-1 and 0 on the diagonal, where $S$ is a (not necessarily orthogonal) invertible matrix. I want to determine $S$ without having to calculate all the eigenvalues and diagonalize $A$, because the eigenvalues dont occur in the wanted form.

Luke Mathwalker asked Aug 5, 2018 at 11:18 Luke Mathwalker Luke Mathwalker 803 5 5 silver badges 17 17 bronze badges

$\begingroup$ Generally the method of completing squares may not deduce the same result as orthogonal diagonalization. Maybe you could try another way to complete squares. $\endgroup$

Commented Aug 5, 2018 at 11:22 $\begingroup$ Why not? Isnt there any way to find $S$ by this procedure? $\endgroup$ Commented Aug 5, 2018 at 11:43

$\begingroup$ Completing squares you remain in the same field containing the coefficients, since you only need to divide by $2$ sometimes, take squares, add and multiply. On the other hand, in some cases, and your example is one of those, the eigenvalues don't belong to the same field. In your example, the coefficients are all rational numbers, while the eigenvalues are not. The algorithm will need to have some step that takes you out of the same field. $\endgroup$

– user580373 Commented Aug 5, 2018 at 12:10

$\begingroup$ Ok I see. I dont want to get the eigenvalues, just some diagonal matrix, I'm interested in the signature of the form and a change of basis vectors, so that $S^TAS$ is in the "signature form" with 1,-1 and 0 on the diagonal, so we can reduce modulo square numbers which we write in $S$ to leave the field in the last step. I still believe that this should be possible without having to calculate all the eigenvalues. $\endgroup$

Commented Aug 5, 2018 at 12:29

$\begingroup$ Your $S$ isn't orthogonal. The special thing about symmetric matrices is that they are orthogonally (or unitarily) diagonalizable (that's why you see $S^TAS$, not $S^AS$). $\endgroup$