a question about a canonical form of a quadratic form using Gauss theorem Get the following quadratic form:

$$Q(x)=x_1^{2}+x_3^2+4x_1x_2-4x_1x_3 $$

to obtain the canonical form I tried the following: 

$$Q(x)=x_1^{2}+x_3^{2}+4x_1x_2-4x_1x_3=4(x_1^{2})+(x_3^{2})-4x_1x_3-3x_1x_1+4x_1x_2-(4/3)x_2x_2+(4/3)x_2x_2=(2x_1-x_3)^2-... $$

There I stopped because I rememebered that I shouldn't change the coefficient of $x_1^2$. 

From here I don't know how to continue. 

I thank you in anticipation for your understanding and I wait forward your answer!
Since $x_1^2$ appears in $Q(x)$, you should start by writing

$$ Q(x) = (ax_1 + bx_2 + cx_3)^2 + \star $$

for $a, b, c \in \mathbb{R}$ in such a way that $\star$ won't involve $x_1$ at all. Since the terms 

$$ x_1^2, 4x_1x_2, -4x_1x_3 $$

appear in $Q$, we choose $a = 1, b = 2, c = -2$ and get

$$ (x_1 + 2x_2 - 2x_3)^2 = (x_1 + 2x_2)^2 - 4(x_1 + 2x_2)x_3 + 4x_3^2 \\ = \color{blue}{x_1^2} + \color{blue}{4x_1x_2} + 4x_2^2 - \color{blue}{4x_1x_3} - 8x_2x_3 + 4x_3^2 $$

and so

$$ Q(x) = (x_1 + 2x_2 - 2x_3)^2 - 4x_2^2 + 8x_2x_3 - 4x_3^2 + x_3^2 \\ =
 (x_1 + 2x_2 - 2x_3)^2 -4 (\color{green}{x_2^2} - \color{green}{2x_2x_3}) - 3x_3^2. $$ 

Now we can repeat the process for the $x_2$ term. We have

$$ (x_2 - x_3)^2 = \color{green}{x_2^2} - \color{green}{2x_2x_3} + x_3^2 $$ 

and so

$$ Q(x) = (x_1 + 2x_2 - 2x_3)^2 - 4(x_2 - x_3)^2 + 4x_3^2 - 3x_3^2 \\ = 
(x_1 + 2x_2 - 2x_3)^2 - 4(x_2 - x_3)^2 + x_3^2 $$

and we're done.
There is a method I asked about at 
reference for linear algebra books that teach reverse Hermite method for symmetric matrices
The main advantage is that it is a recipe with matrices, no need to carry variable names. The main disadvantage is the need to invert one matrix at the end; however, the matrix has determinant $\pm 1$ and may very well be upper triangular (it is this time).

It leads to $$ x^2 + z^2 + 4 xy - 4 zx = (x +2y-2z)^2 - 4 (y-z)^2 + z^2  $$

and comes from this matrix stuff; I did it first by hand, it did work, but I thought i would check everything. The Pari code is not quite as readable as Latex but is not too bad.

parisize = 4000000, primelimit = 500509

? m = [ 1,2,-2; 2,0,0; -2,0,1]
%2 = 
[1 2 -2]

[2 0 0]

[-2 0 1]

? m - mattranspose(m)
%3 = 
[0 0 0]

[0 0 0]

[0 0 0]

? p1 = [1,-2,2; 0,1,0; 0,0,1]
%4 = 
[1 -2 2]

[0 1 0]

[0 0 1]

? m1 = mattranspose(p1) * m * p1
%5 = 
[1 0 0]

[0 -4 4]

[0 4 -3]

? p2 = [ 1,0,0; 0,1,1; 0,0,1]
%6 = 
[1 0 0]

[0 1 1]

[0 0 1]

? d = mattranspose(p2) * m1 * p2 
%7 = 
[1 0 0]

[0 -4 0]

[0 0 1]

? p = p1 * p2
%8 = 
[1 -2 0]

[0 1 1]

[0 0 1]

? matdet(p)
%9 = 1
? q = matadjoint(p)
%10 = 
[1 2 -2]

[0 1 -1]

[0 0 1]



? confirm =  mattranspose(q) * d * q 
%12 = 
[1 2 -2]

[2 0 0]

[-2 0 1]

? m
%13 = 
[1 2 -2]

[2 0 0]

[-2 0 1]

? m - confirm
%14 = 
[0 0 0]

[0 0 0]

[0 0 0]

? 


? ( x + 2 * y - 2 * z)^2 - 4 * (y - z)^2 + z^2
%1 = x^2 + (4*y - 4*z)*x + z^2


=========================================================

Places on this site I put this, several typeset:

reference for linear algebra books that teach reverse Hermite method for symmetric matrices

Bilinear Form Diagonalisation  

Given a $4\times 4$ symmetric matrix, is there an efficient way to find its eigenvalues and diagonalize it? 

Find the transitional matrix that would transform this form to a diagonal form.

Writing an expression as a sum of squares

Determining matrix $A$ and $B$, rectangular matrix

Method of completing squares with 3 variables