Quadratic forms and sylvester's law of inertia

1. Dec 18, 2011

Ted123

$x^2 - y^2 - 2z^2 + 2xz - 4yz$.

I complete the square to get:

$(x+z)^2 - (y+2z)^2 + z^2$.

(So the rank=3, signature=1)

The symmetric matrix representing the quadratic form wrt the standard basis for $\mathbb{R}^3$ is

$A =\begin{bmatrix} 1 & 0 & 1 \\ 0 & -1 & -2 \\ 1 & -2 & -2 \end{bmatrix}$

I want to find a change of basis matrix $P$ such that

$P^T A P = \begin{bmatrix} 1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 1 \end{bmatrix}$

(the 'Sylvester' form - 1s, -1s, 0s on diagonal, 0s elsewhere).

From the complete the square form we can write the quadratic form in the coordinate basis (x+z), (y+2z), z:

$\begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 2 \\ 0 & 0 & 1 \end{bmatrix}$

Inverting this gives:

$P = \begin{bmatrix} 1 & 0 & -1 \\ 0 & 1 & -2 \\ 0 & 0 & 1 \end{bmatrix}$

(Note that we don't need to scale the columns here)

and we see that we get what we want.

However: what happens if you get a quadratic form that is not of full rank and you want to end up with 0s in the Sylvester form?

e.g. $x^2 + 2xy + 2xz$

Completing the square gives:

$(x+y+z)^2 - (y+z)^2$

so the rank=2, signature=0.

The symmetric matrix representing the quadratic form wrt the standard basis for $\mathbb{R}^3$ is

$A =\begin{bmatrix} 1 & 1 & 1 \\ 1 & 0 & 0 \\ 1 & 0 & 0 \end{bmatrix}$

We seek a change-of-basis matrix $P$ such that we get

$P^T AP = \begin{bmatrix} 1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 0 \end{bmatrix}$

(the 'Sylvester' form).

Writing the complete the square form in a coordinate basis (x+y+z), (y+z), ... - where does the other basis vector come from?

2. Dec 19, 2011

lanedance

I haven't followed everything through, but in a sylvester form, the number of 1,-1 and 0's are an invariant of the quadratic form and the same as the number of positive, negative and zero eigenvectors in the original matrix.

So in the final case, the only difference is you have an eigenvalue of zero, corresponding to the kernel of the original matrix.

Last edited: Dec 19, 2011
3. Dec 19, 2011

lanedance

as to finding the final basis vector, I haven't tried it yet, but why not try something perpindicular to the other 2...

Last edited: Dec 19, 2011
4. Dec 19, 2011

lanedance

As for another way to get the matrix P, you could find the eigenvalues, then eigenvectors thus giving you the required P matrix

so for the last case you get something like
lambda =-1, (1,-1,-1)
lambda = 0, (0,1,-1)
lambda = 2, (2,1,1)

These vectors define the eigenbasis and can be used to get P and probably work back to the "basis" as you describe it above.

That said the connection between the complete the square basis and the eigenvectors is not totally clear to me, and i would need to work it through

5. Dec 19, 2011

Ted123

But if you put the eigenvectors as columns in P, you get a diagonal matrix with eigenvalues on the diagonal which is not in general in Sylvester form (if you have eigenvalues that are not 0, 1 or -1)

6. Dec 19, 2011

lanedance

well say you had an orthonormal matrix of eigenvectors S, that diagonalises A:
$$D = S^TDS$$

now say the diagonal entries are the eigenvectors Dii, then define the matrix E, by
$$E_{ii} = \frac{1}{\sqrt{|D_{ii}|}} \ \ , \ \ when \ \ D_{ii}\neq0$$
$$E_{ij} = 0 , \ \ otherwise$$

and consider
$$M = E^T DE = E^T S^TASE = (SE)^TA(SE)$$

Hence
P = SE

Last edited: Dec 19, 2011
7. Dec 19, 2011

lanedance

So I'm still trying to get my head around the first method.

$$Q_x x^2 - y^2 - 2z^2 + 2xz - 4yz = \textbf{x}^T A \textbf{x} = \textbf{x}^T\begin{bmatrix} 1 & 0 & 1 \\ 0 & -1 & -2 \\ 1 & -2 & -2 \end{bmatrix}\textbf{x}$$

note that quadratic form can be diagonalised, by the transformation that satifisies the completed square, so let $\textbf{u}^T = (u,v,w)$, then
$$x^2 - y^2 - 2z^2 + 2xz - 4yz = (x+z)^2 - (y+2z)^2 + z^2 = u^2+v^2+w^2$$

the transformation as you have defined it is given by, each of the row vector is a basis vector
$$\textbf{u} = B \textbf{x} = \begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 2 \\ 0 & 0 & 1 \end{bmatrix} \textbf{x}$$

multiplying by the inverse gives
$$\textbf{x} = B^{-1}\textbf{u} = P\textbf{u} = \begin{bmatrix} 1 & 0 & -1 \\ 0 & 1 & -2 \\ 0 & 0 & 1 \end{bmatrix} \textbf{u}$$

now subtituting into the original quadratic form, to get in terms of the basis u, we get
$$Q_x = \textbf{x}^T A \textbf{x}$$
$$Q_u = \textbf{u}^T P^TA P\textbf{u}$$