# What are the ways to determine whether quadratic form is positive definite?

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

whose corresponding matrix is

$$\begin{bmatrix} 1 & -2 & -3 & 0 \\ -2 & 3 & -\frac{1}{2} & 0 \\ -3 & -\frac{1}{2} & 0 & 0 \\ 0 & 0 & 0 & 4\end{bmatrix}$$

I have to either determine in two ways if the form is positive definite or determine in two ways for which values of $$\lambda$$ the form is positive definite.

The way to determine if the form is positive definite is to compute determinants for each matrices that are formed from the upper right corner. So the first would simply be $$\det|1|=1$$, the second would be

$$\det\begin{vmatrix}1 & -2 \\ -2 & 3\end{vmatrix}=-1$$

Then

$$\det\begin{vmatrix} 1 & -2 & -3 \\ -2 & 3 & -\frac{1}{2} \\ -3 & -\frac{1}{2} & 0 \end{vmatrix}=-3\begin{vmatrix} -2 & -3 \\ 3 & -\frac{1}{2} \end{vmatrix} + \frac{1}{2}\begin{vmatrix} 1 & -3 \\ -2 & -\frac{1}{2}\end{vmatrix}=-30-\frac{13}{4}= -\frac{133}{4}$$

So from there I already see that not all determinats that are formed from upper right corner is positive, should I still compute all the rest?

Second way is to make it in row echelon form:

$$A = \begin{pmatrix}1 & -2 & -3 & 0 \\ 0 & -1 & -\frac{13}{2} & 0 \\ 0 & 0 & -\frac{133}{4} & 0 \\ 0 & 0 & 0 & 4 \end{pmatrix}$$ So, again it's visible that not all pivots are positive therefore the matrix is not positive definite, am I right?

I just want to make sure, that I did everything correctly, and also to ask about the second option how to determine the definiteness of the matrix, it's said that it depends on $$\lambda$$, but where that $$\lambda$$ should be, is it the same to ask to compute the eigenvalues and then determine whether they are positive? I only know one way to do that, and that is to compute $$\det(A-\lambda I)=0$$, how to do it in a different way?

• The row-echelon form thing you did isn't really valid. For example could just multiply the rows with negative pivots by $-1$ and get another valid row-echelon form with all positive pivots, which would probably change your conclusion. – Minus One-Twelfth Jun 1 at 12:53
• In the first case, you need not compute all the determinant. From there where you find one determinant is not positive, you can conclude that the matrix is not positive definite. – nmasanta Jun 1 at 12:56
• The diagonal of the matrix is wrong. – Rodrigo de Azevedo Jun 1 at 12:57
• I honestly can't speak about a general quick and easy method that scales up, but computing eigenvalues directly may not be so bad in this particular problem. – Mnifldz Jun 1 at 12:57
• The coefficient of $x_3^2$ in $g$ is a tip-off. The correct calculation of $\det\pmatrix{1&-2\\-2&3}=3-4=-1$ is another. – kimchi lover Jun 1 at 13:01

You’ll have better luck getting the correct answer if you construct the matrix correctly. For some reason, you’ve divided all of the coefficients, including the entries along the diagonal, by $$2$$ when collecting the matrix elements from the quadratic form. The correct matrix is $$Q=\begin{bmatrix}1&-2&-3&0\\-2&6&-\frac12&0\\-3&-\frac12&0&0\\0&0&0&8\end{bmatrix}.$$ Applying Sylvester’s criterion, we have $$q_{11}=2 \\ \begin{vmatrix}1&-2\\-2&6\end{vmatrix} = 2 \\ \begin{vmatrix}1&-2&-3\\-2&6&-\frac12\\-3&-\frac12&0\end{vmatrix} = -\frac{241}4$$ at which point there’s no need to compute $$\det Q$$ (although in this case it’s a trivial computation given the previous determinant). Similarly, you could’ve stopped after computing the $$2\times2$$ determinant in your original calculations since you already had a negative value at that point, albeit for the wrong matrix.
You can use elementary matrix operations to determine the signature of the quadratic form, but you have to apply the same column operations as you do row operations. Elementary row operations by themselves obviously don’t preserve eigenvalues or even their signs: every invertible matrix is row-equivalent to the identity matrix. Applying this process to $$Q$$ above yields $$\begin{bmatrix}1&0&0&0\\0&2&0&0\\0&0&-\frac{241}8&0\\0&0&0&8\end{bmatrix},$$ so $$Q$$ is not positive-definite. (If you first augment $$Q$$ with an appropriately-sized identity matrix, this process will also give you the diagonalizing basis; see this question for details.)
You could, of course, attempt an orthogonal diagonalization by computing eigenvalues and eigenvectors for the matrix, but after finding the eigenvector $$(0,0,0,1)^T$$ with eigenvalue $$8$$ by inspection, it all turns rather ugly. However, you only need to know the signs of the eigenvalues, which can be determined without computing them explicitly. The characteristic polynomial of $$Q$$ is $$(\lambda-8)\left(\lambda^3-7\lambda^2-\frac{29}4\lambda+\frac{241}4\right)$$, and Descartes’ rule of signs tells us that the cubic factor has two positive roots and one negative root.
Finally, there’s the tried-and-true method of successively completing squares: \begin{align} x_1^2 +6x_2^2+8x_4^2-4x_1x_2-6x_1x_3-x_2x_3 &= (x_1-2x_2-3x_3)^2\color{red}{-4x_2^2-9x_3^2-12x_2x_3}+6x_2^2-x_2x_3+8x_4^2 \\ &= (x_1-2x_2-3x_3)^2+2x_2^2-13x_2x_3-9x_3^2+8x_4^2 \\ &= (x_1-2x_2-3x_3)^2+2\left(x_2-\frac{13}4x_3\right)^2\color{red}{-\frac{169}8x_3^2}-9x_3^2+8x_4^2\end{align}. You can stop at this point since it’s obvious that the coefficient of $$x_3^2$$ is negative.