Q: Let $$A = \begin{pmatrix} 3 & -1 & 0 \\ -1 & 2 & -1 \\ 0 & -1 & 3 \end{pmatrix}$$
Find the quadratic form of $q: \mathbb{R}^3 \to \mathbb{R}^3$ represented by A.
and find an orthonormal basis of $\mathbb{R}^3$ which q has a diagonal form.
- So far I managed to find the quadratic form and used lagrange to get the following equation.
Quadratic form: $3x_1^2-2x_1x_2+2x_2^2-2x_2x_3+3x_3^2 = 0$
using lagrange I got:
$3(x_1-\frac{1}{3}x_2)^2 +1\frac{8}{9}x_2^2+(3x_3^2-2x_2x_3)^2 =0$
$$y_1 = x1-\frac{1}{3}$$ $$y_2 = x_2$$ $$y_3 = x_3 - \frac{1}{3}x_2$$
meaning the base should be:
$$x_1 = y_1 + \frac{1}{3}$$ $$x_2 = y_2$$ $$x_3 = y_3 + \frac{1}{3}y_2$$
$$B = \left\{\left(1, \frac{1}{3},0\right), (0,1,0), \left(0, \frac{1}{3}, 1\right)\right\}$$
But that didn't fit when I tried to multiply A with the basis to find the diagonal form.
what did I do wrong?
Completing squares I get, with $\;x,y,z\;$ instead of $\;x_i\;$ :
$$3x^2-2xy+2y^2-2yz+3z^2=3\left(x-\frac13y\right)^2+\frac43y^2+3\left(z-\frac13y\right)^2\implies$$
$$\implies \begin{cases}I\;\;\;\;\,a=x-\frac13y\\II\;\;\;b=y\\III\;c=z-\frac13y\end{cases}\;\;\; \implies\;\;\begin{cases}x=a+\frac13b\\y=b\\z=c+\frac13b\end{cases}$$
So the base part is $\;\left(1,\,\frac13,\,0\right)\;,\;(0,1,0)\;,\;\left(0,\,\frac13,\,1\right)\;$ , and the quadratic can be expressed as
$$\color{red}{q(a,b,c)=3a^2+\frac43b^2+3c^2}$$
Observe that the eigenvalues of $\;A\;$ are
$$\det(xI-A)=\begin{vmatrix}x-3&1&0\\1&x-2&1\\0&1&x-3\end{vmatrix}=$$ $$=(x-2)(x-3)^2-2(x-3)=(x-3)(x-4)(x-1)$$
with eigenvectors:
$$\begin{align*} &\bullet\;\lambda=1:\;\;\begin{cases}-2x+y\;\;\;\;\;\;\;=0\\\;\;\;\;\;\;\;\;\;\;y-2z=0\end{cases}\implies2x=2z=y\implies&\begin{pmatrix}1\\2\\1\end{pmatrix}\\{} &\bullet\;\lambda=3:\;\;\begin{cases}\;\;\;\;\;\;y\;\;\;\,\;\;=0\\x+y+z=0\end{cases}\implies x=-z\,,\,y=0\implies&\begin{pmatrix}1\\0\\\!-1\end{pmatrix}\\{} &\bullet\;\lambda=4:\;\;\begin{cases}x+y\;\;\;\;\;\;=0\\\;\;\;\;\;\,y+z=0\end{cases}\implies x= z=-y\implies&\begin{pmatrix}\;1\\\!-1\\\;1\end{pmatrix}\end{align*}$$
Now orthonormalize the above three vectors, form the matrix $\;P\;$ whose columns are the new vectors and check that
$$P^{-1}AP=\begin{pmatrix}1&0&0\\0&3&0\\0&0&4\end{pmatrix}$$