I try to transform Transform $$f(x_1,x_2,x_3)=2{x_1}^2+5{x_2}^2+5{x_3}^2+4x_1x_2-4x_1x_3-8x_2x_3$$ to a diagonal form. I can do it using eigenvalue, but when I directly complete the square to find its diagonal form, I failed. And my textbook tell me that every formula like this can be transformed into diagonal form by completing the square. I have been working this for hours, please help me.
-
Show us what you've been trying. – Kaster Aug 28 '15 at 01:39
-
2But, it's already a quadratic form, isn't it? – Cameron Buie Aug 28 '15 at 01:45
-
Take a look at these: http://math.stackexchange.com/questions/1388421/reference-for-linear-algebra-books-that-teach-reverse-hermite-method-for-symmetr http://math.stackexchange.com/questions/329304/bilinear-form-diagonalisation (user1551) http://math.stackexchange.com/questions/395634/given-a-4-times-4-symmetric-matrix-is-there-an-efficient-way-to-find-its-eige/1392600#1392600 http://math.stackexchange.com/questions/1388281/find-the-transitional-matrix-that-would-transform-this-form-to-a-diagonal-form/1391117#1391117 – Will Jagy Aug 28 '15 at 01:46
-
@CameronBuie, most likely wants a diagonal form. The easy way is Hermite's, but recently a cookie-cutter method has been appearing on MSE, see the links in my previous comment. – Will Jagy Aug 28 '15 at 01:48
-
@Kaster I try to complete the square of $f(x_1,x_2,x_3)=2{x_1}^2+5{x_2}^2+5{x_3}^2+4x_1x_2-4x_1x_3-8x_2x_3$. And I can't find a proper substitution to complete it. This is I have been working with. – Rowan Aug 28 '15 at 01:50
-
1@Rowan what I meant is post your steps, and we might point out the mistake, rather than writing it down from scratch. – Kaster Aug 28 '15 at 01:51
-
@CameronBuie Sorry, I want a diagonal form. I'll edit it. – Rowan Aug 28 '15 at 01:52
4 Answers
Every book on quadratic forms has Hermite's method in one or another disguise. It is easy. First we take care of all terms that contain $x_1.$
$$ 2 (x_1 + x_2 - x_3)^2 = 2 x_1^2 + 2 x_2^2 + 2 x_3^2 - 4 x_2 x_3 -4 x_3 x_1 + 4 x_1 x_2. $$
$$ f - 2 (x_1 + x_2 - x_3)^2 = 3 x_2^2 - 4 x_2 x_3 + 3 x_3^2$$ Next we take care of all remaining terms that contain $x_2.$
$$ 3 \left(x_2 - \frac{2}{3} x_3 \right)^2 = 3 x_2^2 - 4 x_2 x_3 + \frac{4}{3} x_3^2$$ $$ f - 2 (x_1 + x_2 - x_3)^2 - 3 \left(x_2 - \frac{2}{3} x_3 \right)^2 = \frac{5}{3} x_3^2 $$ As you see, all that is left involves only $x_3$ and is (must be) a multiple of $x_3^2.$ $$ f = 2 (x_1 + x_2 - x_3)^2 + 3 \left(x_2 - \frac{2}{3} x_3 \right)^2 + \frac{5}{3} x_3^2 $$

- 139,541
-
Start with all terms start with$x_1$ and do it again and again. Does this always work? Actually, Cameron's answer is complicated but more reasonable to me. But your answer is the one that I can handle. And thanks for posting links related to this question. It's quite useful :) – Rowan Aug 28 '15 at 02:34
-
1@Rowan, the main extra step, not needed for your question, is when all that is left (no explicit squares) is of type $xy$ or, for ease, $4 xy.$ Here we use the trick $(x+y)^2 - (x-y)^2 = 4xy $ – Will Jagy Aug 28 '15 at 02:38
\begin{align} 2x_1^2 + 5x_2^2+5x_3^2 + 4x_1x_2-4x_1x_3-8x_2x_3 = \\ 2\left( x_1^2+2x_1x_2-2x_1x_3-2x_2x_3\right) + 5x_2^2+5x_3^2 - 4x_2x_3 = \\ 2 \left( x_1^2 + x_2^2 + x_3^2 + 2x_1x_2 - 2x_1x_3 - 2x_2x_3\right) + 3x_2^2 + 3x_3^2 - 4x_2x_3 = \\ 2(x_1 + x_2 - x_3)^2 + 3 \left (x_2^2 - \frac 43 x_2x_3 + \frac 49 x_3^2 \right ) - \frac 43 x_3^2 + 3x_3^2 = \\ 2\left( x_1 + x_2 - x_3\right)^2 + 3 \left( x_2 - \frac 23 x_3\right )^2 + \frac 53 x_3^2 \end{align}

- 9,722
-
Thanks Kaster. What I have been trying is similar to BolzWeir's answer. I don't put $x_1,x_2,x_3$ together, so I failed. – Rowan Aug 28 '15 at 02:38
I'm not sure if this is what you want, but we can note that $$2x_1^2+4x_1x_2-4x_1x_3=2x_1(x_1+2(x_2-x_3)),$$ which we can instead write as $$2(x_1+(x_2-x_3)-(x_2-x_3))(x_1+(x_2-x_3)+(x_2-x_3)),$$ or as $$2(x_1+x_2-x_3-(x_2-x_3))(x_1+x_2-x_3+(x_2-x_3)).$$ Applying the difference of squares formula and distributing the $2$ yields $$2(x_1+x_2-x_3)^2-2(x_2-x_3)^2=2(x_1+x_2-x_3)^2-2x_2^2-2x_3^2+4x_2x_3.$$ Hence, by substitution and gathering like terms, we have $$f(x_1,x_2,x_3)=2(x_1+x_2-x_3)^2+3x_2^2-4x_2x_3+3x_3^2.$$ Note that from this point, we could apply yet another instance of the difference of squares formula in the other direction, and obtain a factorization of $f.$ However, I suspect that instead, you'd rather observe that $3x_2^2-4x_2x_3$ can be rewritten (in a similar fashion to the work above) as $$3\left(x_2-\frac23x_3+\frac23x_3\right)\left(x_2-\frac23x_3-\frac23x_3\right),$$ whence we can show (again, similarly to the work above) that $$3x_2^2-4x_2x_3=3\left(x_2-\frac23x_3\right)^2-\frac43x_3^2,$$ and so $$f(x_1,x_2,x_3)=2(x_1+x_2-x_3)^2+3\left(x_2-\frac23x_3\right)^2+\frac53x_3^2.$$ Finally, putting $$\bar x_1=\sqrt2(x_1+x_2-x_3),\\\bar x_2=\sqrt3\left(x_2-\frac23x_3\right),\\\bar x_3=\sqrt{\frac53}x_3,$$ we have $$f(x_1,x_2,x_3)=\bar x_1^2+\bar x_2^2+\bar x_3^2.$$
So, there you have it. Completing the square does allow us to rewrite it in the desired fashion. However, it's rather tedious, and it's far more preferable to use slicker, quicker tricks.

- 102,994
Do you know about the Gaussian method? It goes like this:
$$f(x_1,x_2,x_3) = 2\left[x_1^2 + \frac52 x_2^2 + \frac52 x_3^2 + 2x_1x_2 - 2x_1 x_3 - 8x_2 x_3 \right] \\ =2\left[ (x_1 ^2 + 2x_1x_2 \color{red}{+ x_2^2}) \color{red} {- x_2^2} + \frac52x_2^2 + \frac52x_3^2 - 2x_1x_3 -8x_2x_3 \right] \\ = 2\left[ (x_1 + x_2)^2 + ...\right]$$
You keep on doing that, and eventually put: $y_1 = x_1 + x_2$, etc.
-
This is what I want to do. But there are always some items can not be eliminated. – Rowan Aug 28 '15 at 02:02