Elimination of Cross Terms in Equation of Surface By Completion of Square Example

Suppose we have a quadratic equation  
\[\sum_{ij, \: i \leq j}^n a_{ij}x_ix_j\]
  that describes a surface in  
\[\mathbb{R}^n\]
. We can eliminated the cross terms  
\[Ax_ix_j, \: i \neq j\]
  by completing the square.
Example:  
\[x_1^2-2x_1x_2+4x_2x_3-2x_2^2+4x_3^2=1\]

We can complete the square for  
\[x_1^2-2x_1x_2=(x_1-x_2)^2-x_2^2\]

Hence  
\[(x_1-x_2)^2-x_2^2+4x_2x_3-2x_2^2+4x_3^2=(x_1-x_2)^2-3x_2^2+4x_2x_3+4x_3^2=1\]

Add and subtract  
\[x_2^2\]

\[(x_1-x_2)^2-4x_2^2+x_2^2+4x_2x_3+4x_3^2=(x_1-x_2)^2-4x_2^2+(x_2+2x_3)^2=1\]

Now set  
\[y_1=x_1-x_2, \: y_2=2x_2, \: y_3 =x_2+2x_3\]
  to give
\[y_1^2-y_2^2+y_3^2=1\]