Linear Algebra quadratic forms diagonalization I have a question that reads:

Diagonalize the quadratic form $A(x,x) = 2x^2 - 1/2 y^2 -2xy - 4xz$ by completing the squares, and find the change of basis matrix and the new basis in which A will be diagonalized.
HINT: The change of basis matrix is the inverse of the change of coordinates matrix.

Can someone give me the definition of "diagonalize" in this context and walk me through this problem?  I would really prefer to understand it.
 A: Note: My answer below is more than a bit disorganized; if any one cares to clean it up a bit, I welcome the effort.

It seems that diagonalize in this context would mean something like writing
$$
2x_1^2 - (1/2) x_1^2 -2x_1x_2 - 4x_1x_3 =
A(x,x) = x^TU^T DUx = (Ux)^TD(Ux)
$$
for some diagonal matrix $D$ and invertible matrix $U$, where $x = (x_1,x_2,x_3)^T$.
In particular, defining $y = Ux$, we should have
$$
A(x,x) = y^TDy = d_1 y_1^2 + d_2 y_2^2 + d_3 y_3 ^2
$$

More specifically, we have
$$
2x^2 - (1/2)y^2 -2xy - 4xz = \\
(1/2)(y^2 - 4xy + 4x^2) - 4xz =\\
(1/2)(y - 2x)^2 - 4xz =\\
(1/2)(y - 2x)^2 + [(x - z)^2 - (x+z)^2] =\\
(1/2)(y - 2x)^2 + (x - z)^2 - (x+z)^2
$$
Now, let $y = (y_1,y_2,y_3)^T$ be a coordinate vector such that
$$
\pmatrix{y_1\\y_2\\y_3} = 
\pmatrix{x_2 - 2x_1\\x_1 - x_3\\x_1 + x_3}
$$
This can be written as $y = Mx$, where
$$
M = \pmatrix{-2&1&0\\1&0&-1\\1&0&1}
$$
From before, we have
$$
A(x,x) = 2x_1^2 - (1/2)x_2^2 -2x_1x_2 - 4x_1x_3 = 
(1/2)(y_1)^2 + (y_2)^2 - (y_3)^2
$$
We now have $A(x,x) = D(Mx,Mx)$ where
$$
D(y,y) = (1/2)(y_1)^2 + (y_2)^2 - (y_3)^2
$$
