# Determinant of a 2x2 Quadratic Form

Suppose we have a 2\(-d\) quadratic form \(Q : \mathbb{R}^2 \to \mathbb{R}\). How can we compute its determinant?

This problem is a little under-specified. In fact, we can always pick a basis for \(\RR^2\) so that our quadratic form is diagonal with diagonal entries \(0\) or \(\pm 1\). So there is always some basis where our quadratic form has determinant \(0\) or \(\pm 1\).

But usually, we have a choice of inner product on \(\mathbb{R}^2\), and if we restrict to orthonormal bases with respect to this inner product then \(Q\) does indeed have well-defined eigenvectors, and a well-defined trace and determinant. And once we have the eigenvectors, the trace and determinant are easy to evaluate. If \(e_1, e_2\) are the eigenvectors with eigenvalues \(\lambda_1, \lambda_2\), then the trace of \(Q\) is given by \[ \tr Q = \lambda_1 + \lambda_2 = Q(e_1) + Q(e_2),\] and the determinant of \(Q\) is given by \[ \det Q = \lambda_1 \lambda_2 = Q(e_1)Q(e_2).\]

All this eigenvector business is actually not needed for computing the trace: we can pick any orthonormal vectors \(X, Y \in \mathbb{R}^2\), and the trace is given by \(Q(X) + Q(Y)\).

However, the determinant is trickier. In general, \(\det Q\) is *not* equal to \(Q(X)Q(Y)\) for a general pair of orthonormal vectors \(X\) and \(Y\). To see what goes wrong, we can write out \(Q\) as a matrix in the \(X, Y\) basis. The diagonal entries of this matrix are simply \(Q(X)\) and \(Q(Y)\). To obtain the off-diagonal entries, we can apply the polariziation identity (essentially a fancy name for the fact that \(xy = \tfrac{1}{2}(x+y)^2 - \tfrac{1}{2}x^2 - \tfrac{1}{2}y^2\)). Now that we have the matrix entries for \(Q\), we can apply the usual formula that \(\det \begin{pmatrix} a & b \\ c & d \end{pmatrix} = a d - b c\) and we find that
\[\det Q = Q(X) Q(Y) - \tfrac{1}{4}\left(Q(X+Y) - Q(X) - Q(Y)\right)^2.\]

This formula simplifies a little if we define a new unit vector \(Z := \tfrac{1}{\sqrt{2}}\left(X + Y\right)\) which lies half way in between \(X\) and \(Y\). Then we can do a little bit of algebra to find that \[\begin{aligned} \det Q &= Q(X) Q(Y) - \left(Q(Z) - \tfrac{1}{2}\left(Q(X) + Q(Y)\right)\right)^2\\ &= Q(X)Q(Y) - Q(Z)^2 - \tfrac{1}{4}\left(Q(X)+Q(Y)\right)^2 + Q(Z)\left(Q(X) + Q(Y)\right)\\ &= \tfrac{1}{4}\left(Q(X) - Q(Y)\right)^2 + Q(Z) \left(Q(X) + Q(Y) - Q(Z)\right). \end{aligned}\]

We can simplify this formula even more by introducing the complementary unit vector \(W := \tfrac{1}{\sqrt{2}}\left(X - Y\right)\). Note that \(Z, W\) also form an orthonormal basis for \(\RR^2\). Since we can use the any orthonormal basis of \(\RR^2\) to compute the trace of \(Q\), we know that \(Q(X) + Q(Y) = \tr Q = Q(Z) + Q(W)\), and therefore the expression \(Q(X) + Q(Y) - Q(Z)\) in our formula is simply equal to \(Q(W)\). So in the end, the determinant of \(Q\) is given by \[\det Q = \tfrac{1}{4}\left(Q(X) - Q(Y)\right)^2 + Q(Z) Q(W),\] where \(X\) and \(Y\) form one orthonormal basis, and \(Z\) and \(W\) form another orthonormal basis rotated by \(45^\circ\).

As one last sanity check, note that if we take \(Z\) and \(W\) to be the eigenvectors \(e_1\) and \(e_2\), then \(Q(X) = Q(Y)\), and we so find again that the determinant is given by \(\det Q = Q(e_1) Q(e_2)\). But now we see that this is really a special case, and in general we need to add a correction term involving a pair of vectors rotated by \(45^\circ\) from our starting vectors.

## No comments: