# positive (semi)definite, negative (semi)definite and indefinite?

When looking at a quadratic form in a matrix, I am not completely sure how to tell if is one of the answers from above.

-positive (semi)definite

-negative (semi)definite

-indefinite

how do i figure this out

There are two approaches. One is to write the (symmetric) matrix associated the quadratic form, the other is to "complete the square", as the a deleted answer notes.

For example: $$q(x_1,x_2) = x_1^2 - 4x_1x_2 + x_2^2 = x_1^2 - 2x_1x_2 - 2x_2x_1 + x_2^2$$ The matrix associated with this quadratic form is $$M = \pmatrix{1&-2\\-2&1}$$ and we wish to determine its definiteness. Applying Sylvester's criterion to both $M$ and $-M$ allows us to check if $M$ is positive/negative definite. Since the $2 \times 2$ determinant $\det(M)$ is negative, we can conclude that $M$ is neither positive nor negative definite.

Now, $\det(M) \neq 0$, so $M$ is invertible. Since $M$ is invertible without being positive/negative definite, it is invertible.

If $M$ were singular, we'd have to try something else. In practice (with pencil and paper), one would find the eigenvalues of $M$. If all non-zero eigenvalues have the same sign, then the singular $M$ is postive/negative semidefinite. Otherwise, $M$ would be indefinite.

Another approach to apply (especially for large matrices) is to attempt a Cholesky factorization. If $M$ has a Cholesky factorization, it is positive semidefinite. If $-M$ has a Cholesky factorization, it is negative semidefinite. Otherwise, $M$ is neither.

In this case, we find $M$ and $-M$ have no Cholesky factorization

Equivalent (in a sense) to Cholesky factorization is the approach of completing the square. We find $$q(x_1,x_2) = x_1^2 - 4x_1x_2 + x_2^2 = (x_1^2 - 4x_1x_2 + 4x_2^2) - 3x_2^2 = \\ (x_1 - 2x_2)^2 - 3x_2^2$$ Correspondingly, we see that $$M = \pmatrix{1&0\\-2&1}^T\pmatrix{1&0\\0&-3}\pmatrix{1&0\\-2&1}$$