Linear Algebra - QF correct coefficient matrix?

202 Views Asked by At

Right, so I've completed the square of a quadratic form:

$$ q(x) = x_1^2 - 4x_1x_2 + 6x_1x_3 + 5x_2^2 - 10x_2x_3 + 11x_3^2$$

I found the coefficient matrix to be:

$$ \begin{matrix} 1 & -2 & 3 \\ 0 & -1 & 1 \\ 0 & 0 & 1 \\ \end{matrix} $$

So solving for $$ D = P^tAP$$

I keep getting:

$$ \begin{matrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & -2 & 5 \\ \end{matrix} $$

Why do I keep getting -2 where it should be 0? Maybe a possible miscalculation somewhere or maybe I completed the squares wrong or something...?

2

There are 2 best solutions below

0
On BEST ANSWER

It happens that the "diagonal matrix" can be taken to be the identity matrix, expressed as quadratic forms: $$(x-2y+3z)^2 +(y+z)^2 + z^2 = x^2 + 5 y^2 + 11 z^2 -10 yz + 6 zx - 4 xy $$

$$ P^T H P = D $$ $$ Q^T D Q = H $$ $$ H = \left( \begin{array}{rrr} 1 & - 2 & 3 \\ - 2 & 5 & - 5 \\ 3 & - 5 & 11 \\ \end{array} \right) $$

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

$$\left( \begin{array}{rrr} 1 & 2 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) $$ $$ P = \left( \begin{array}{rrr} 1 & 2 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q = \left( \begin{array}{rrr} 1 & - 2 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D = \left( \begin{array}{rrr} 1 & 0 & 3 \\ 0 & 1 & 1 \\ 3 & 1 & 11 \\ \end{array} \right) $$

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

$$\left( \begin{array}{rrr} 1 & 0 & - 3 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) $$ $$ P = \left( \begin{array}{rrr} 1 & 2 & - 3 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q = \left( \begin{array}{rrr} 1 & - 2 & 3 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D = \left( \begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & 1 \\ 0 & 1 & 2 \\ \end{array} \right) $$

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

$$\left( \begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & - 1 \\ 0 & 0 & 1 \\ \end{array} \right) $$ $$ P = \left( \begin{array}{rrr} 1 & 2 & - 5 \\ 0 & 1 & - 1 \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q = \left( \begin{array}{rrr} 1 & - 2 & 3 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D = \left( \begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) $$

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

$$ P^T H P = D $$ $$\left( \begin{array}{rrr} 1 & 0 & 0 \\ 2 & 1 & 0 \\ - 5 & - 1 & 1 \\ \end{array} \right) \left( \begin{array}{rrr} 1 & - 2 & 3 \\ - 2 & 5 & - 5 \\ 3 & - 5 & 11 \\ \end{array} \right) \left( \begin{array}{rrr} 1 & 2 & - 5 \\ 0 & 1 & - 1 \\ 0 & 0 & 1 \\ \end{array} \right) = \left( \begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) $$ $$ Q^T D Q = H $$ $$\left( \begin{array}{rrr} 1 & 0 & 0 \\ - 2 & 1 & 0 \\ 3 & 1 & 1 \\ \end{array} \right) \left( \begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) \left( \begin{array}{rrr} 1 & - 2 & 3 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \\ \end{array} \right) = \left( \begin{array}{rrr} 1 & - 2 & 3 \\ - 2 & 5 & - 5 \\ 3 & - 5 & 11 \\ \end{array} \right) $$

6
On

Assuming I only want to revert it purely algebraic from the completed square form back to the original quadratic form:

$$(x_1 - 2x_2 + 3x_3)^2 -/+ (x_2 + x_3)^2 + 3x_3^2$$

then we get either:

$$x_1^2 + 3x_2^2 + 11x_3^2 - 4x_1x_2 + 6x_1x_3 - 14x_2x_3$$

Or

$$x_1^2 + 5x_2^2 + 13x_3^2 - 4x_1x_2 + 6x_1x_3 - 10x_2x_3$$

We see that I don't fully get the original quadratic form. So unless there is some little detail I've missed that gets you the coefficient matrix you got which is obviously correct then maybe it's something during the completing the squares method I'm not fully grasping?