Completing the square to find if quadratic form is positive definite.

1.5k Views Asked by At

I have the quadratic form

$$g=x_1^2+6x_2^2+8x_3^2-4x_1x_2-6x_1x_3-x_2x_3$$

I have problems completing the square. I tried to rewrite the expression as follows

$$g=x_1^2-4x_1x_2+6x_2^2-x_2x_3+8x_3^2$$

Hence,

$$((x_1-2{x_2})^2 -(2x_2)^2) + 6 \left( x_2-\frac{x_3}{12} \right)^2 - \left( \frac{x_3}{2} \right)^2 + 8x_3^2$$

Can I do it like this? On complete square calculator, it's said that you cannot complete the square for expression like this. Anyway, the reason I need to complete the square for this expression is because I need to determine whether the given quadratic form is positive definite. But I don't know how to proceed.

4

There are 4 best solutions below

0
On

Construct the coefficient matrix

$$A = \begin{bmatrix} 1& -2& -3\\ -2& 6& -1/2 \\-3 &-1/2 & 8\end{bmatrix}$$

Find the determinants

$D_1 = |a_{11}| = 1 > 0$

$D_2 = \begin{vmatrix}1&-2 \\ -2&6\end{vmatrix} = 6 -4 =2 > 0$

$D_3 = \det(A) = -177/4 < 0$

So, the given form is indefinite in nature.

For an nxn matrix if

$\bullet D_1 , D_2, \cdots D_n>0 \implies$ Positive definite

$\bullet D_1,D_3,D_5\cdots<0 $ and $D_2,D_4,D_6\cdots>0$ or $(-1)^kD_k >0 , \ k =0,1,\cdots n \implies$ Negative definite

$\bullet D_1 , D_2, \cdots D_n \ge0$ or $D_k>0 $ with at least one value zero $\implies$ Positive semi-definite

$\bullet(-1)^kD_k \ge0 , \ k =0,1,\cdots n$ with at least one zero $\implies$ Negative semi-definite

$\bullet$All other cases are indefinite

3
On

Note that if $x_2=0$ then the quadratic form $g$ is $$x_1^2+8x_3^2-6x_1x_3=(x_1-2x_3)(x_1-4x_3)$$ whose sign is indefinite. So $g$ is NOT positive definite.

6
On

Completing the square (Lagrange's Method):

$$x^2+6y^2+8z^2-4xy-6xz-yz=\left(x-(2y+3z)\right)^2-4y^2-12yz-9z^2+6y^2+8z^2-yz$$

$$=\left(x-(2y+3z)\right)^2+2y^2-13yz-z^2=\left(x-(2y+3z)\right)^2+2\left(y-\frac{13}4z\right)^2-\frac{177}8z^2$$

Thus, for example, $\;g(38,\,13,\,4)=-177\cdot2=-354<0\;$ and thus the form isn't positive definite.

BTW, $\;g(1,0,0)=1\;$ , so the form is actually indefinite.

2
On

Note that $H$ is the Hessian matrix of second partial derivatives of $g=x^2+6y^2+8z^2-4xy-6xz-yz$

This direction is what "completing the square" produces first:

$$ Q^T D Q = H $$ $$\left( \begin{array}{rrr} 1 & 0 & 0 \\ - 2 & 1 & 0 \\ - 3 & - \frac{ 13 }{ 4 } & 1 \\ \end{array} \right) \left( \begin{array}{rrr} 2 & 0 & 0 \\ 0 & 4 & 0 \\ 0 & 0 & - \frac{ 177 }{ 4 } \\ \end{array} \right) \left( \begin{array}{rrr} 1 & - 2 & - 3 \\ 0 & 1 & - \frac{ 13 }{ 4 } \\ 0 & 0 & 1 \\ \end{array} \right) = \left( \begin{array}{rrr} 2 & - 4 & - 6 \\ - 4 & 12 & - 1 \\ - 6 & - 1 & 16 \\ \end{array} \right) $$

Dividing the coefficients of $D$ by two gives $$ (x-2y-3z)^2 + 2 \left( y - \frac{13}{4} z\right)^2 - \frac{177}{8} z^2 = x^2+6y^2+8z^2-4xy-6xz-yz$$ and is exactly what DonAntonio got

The method actually produces the reverse first:

$$ P^T H P = D $$ $$\left( \begin{array}{rrr} 1 & 0 & 0 \\ 2 & 1 & 0 \\ \frac{ 19 }{ 2 } & \frac{ 13 }{ 4 } & 1 \\ \end{array} \right) \left( \begin{array}{rrr} 2 & - 4 & - 6 \\ - 4 & 12 & - 1 \\ - 6 & - 1 & 16 \\ \end{array} \right) \left( \begin{array}{rrr} 1 & 2 & \frac{ 19 }{ 2 } \\ 0 & 1 & \frac{ 13 }{ 4 } \\ 0 & 0 & 1 \\ \end{array} \right) = \left( \begin{array}{rrr} 2 & 0 & 0 \\ 0 & 4 & 0 \\ 0 & 0 & - \frac{ 177 }{ 4 } \\ \end{array} \right) $$

Algorithm discussed at http://math.stackexchange.com/questions/1388421/reference-for-linear-algebra-books-that-teach-reverse-hermite-method-for-symmetr
https://en.wikipedia.org/wiki/Sylvester%27s_law_of_inertia
$$ H = \left( \begin{array}{rrr} 2 & - 4 & - 6 \\ - 4 & 12 & - 1 \\ - 6 & - 1 & 16 \\ \end{array} \right) $$ $$ D_0 = H $$ $$ E_j^T D_{j-1} E_j = D_j $$ $$ P_{j-1} E_j = P_j $$ $$ E_j^{-1} Q_{j-1} = Q_j $$ $$ P_j Q_j = Q_j P_j = I $$ $$ P_j^T H P_j = D_j $$ $$ Q_j^T D_j Q_j = H $$

$$ H = \left( \begin{array}{rrr} 2 & - 4 & - 6 \\ - 4 & 12 & - 1 \\ - 6 & - 1 & 16 \\ \end{array} \right) $$

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

$$ E_{1} = \left( \begin{array}{rrr} 1 & 2 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) $$ $$ P_{1} = \left( \begin{array}{rrr} 1 & 2 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q_{1} = \left( \begin{array}{rrr} 1 & - 2 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D_{1} = \left( \begin{array}{rrr} 2 & 0 & - 6 \\ 0 & 4 & - 13 \\ - 6 & - 13 & 16 \\ \end{array} \right) $$

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

$$ E_{2} = \left( \begin{array}{rrr} 1 & 0 & 3 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) $$ $$ P_{2} = \left( \begin{array}{rrr} 1 & 2 & 3 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q_{2} = \left( \begin{array}{rrr} 1 & - 2 & - 3 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D_{2} = \left( \begin{array}{rrr} 2 & 0 & 0 \\ 0 & 4 & - 13 \\ 0 & - 13 & - 2 \\ \end{array} \right) $$

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

$$ E_{3} = \left( \begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & \frac{ 13 }{ 4 } \\ 0 & 0 & 1 \\ \end{array} \right) $$ $$ P_{3} = \left( \begin{array}{rrr} 1 & 2 & \frac{ 19 }{ 2 } \\ 0 & 1 & \frac{ 13 }{ 4 } \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q_{3} = \left( \begin{array}{rrr} 1 & - 2 & - 3 \\ 0 & 1 & - \frac{ 13 }{ 4 } \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D_{3} = \left( \begin{array}{rrr} 2 & 0 & 0 \\ 0 & 4 & 0 \\ 0 & 0 & - \frac{ 177 }{ 4 } \\ \end{array} \right) $$

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

$$ P^T H P = D $$ $$\left( \begin{array}{rrr} 1 & 0 & 0 \\ 2 & 1 & 0 \\ \frac{ 19 }{ 2 } & \frac{ 13 }{ 4 } & 1 \\ \end{array} \right) \left( \begin{array}{rrr} 2 & - 4 & - 6 \\ - 4 & 12 & - 1 \\ - 6 & - 1 & 16 \\ \end{array} \right) \left( \begin{array}{rrr} 1 & 2 & \frac{ 19 }{ 2 } \\ 0 & 1 & \frac{ 13 }{ 4 } \\ 0 & 0 & 1 \\ \end{array} \right) = \left( \begin{array}{rrr} 2 & 0 & 0 \\ 0 & 4 & 0 \\ 0 & 0 & - \frac{ 177 }{ 4 } \\ \end{array} \right) $$ $$ Q^T D Q = H $$ $$\left( \begin{array}{rrr} 1 & 0 & 0 \\ - 2 & 1 & 0 \\ - 3 & - \frac{ 13 }{ 4 } & 1 \\ \end{array} \right) \left( \begin{array}{rrr} 2 & 0 & 0 \\ 0 & 4 & 0 \\ 0 & 0 & - \frac{ 177 }{ 4 } \\ \end{array} \right) \left( \begin{array}{rrr} 1 & - 2 & - 3 \\ 0 & 1 & - \frac{ 13 }{ 4 } \\ 0 & 0 & 1 \\ \end{array} \right) = \left( \begin{array}{rrr} 2 & - 4 & - 6 \\ - 4 & 12 & - 1 \\ - 6 & - 1 & 16 \\ \end{array} \right) $$