# Find a base in which both of these forms are diagonal. Provide this form for both forms.

I need to find a base in which both of these forms are diagonal. Provide this form for both forms.

$$f(x,y,z)=z^2+2xz+3x^2+y^2-2xy$$

$$g(x,y,z)=5x^2-2xy+y^2+4xz+2z^2$$

I know how to bind a basis, where $$f$$ or $$g$$ is diagonalized, but not where both of them are. Don't know if it's useful, but that's what I got:

$$f$$ is $$Diag(1,1,1)$$ in $$\mathcal{A}=(\frac{1}{\sqrt{3}}(1,0,0), \frac{1}{\sqrt{2}}(0,1,1),\frac{1}{\sqrt{6}}(2,3,-3))$$

$$g$$ is $$Diag(1,1,1)$$ in $$\mathcal{B}=(\frac{1}{\sqrt{5}}(1,0,0), \frac{1}{\sqrt{6}}(0,2,1),\frac{1}{\sqrt{30}}(-3,-5,5))$$

• I don't think the question asks to diagonalize both $f$ and $g$ simultaneously. Commented Jun 17 at 19:34
• "Find a base in which both of these forms are diagonal. Provide this form for both forms." thats what I have to do Commented Jun 17 at 19:36
• Edit the question to include that exact text. Commented Jun 17 at 19:39
• done :) hope it helps Commented Jun 17 at 19:42
• are you sure you wrote down the forms correctly? $f=(x,y,z)A(x,y,z)^T$ and $g=(x,y,z)B(x,y,z)^T$ where $A=\begin{pmatrix} 3 & -1 & 1 \\ -1 & 1 & 0 \\ 1 & 0 & 1 \end{pmatrix}$ and $B=\begin{pmatrix} 5 & -1 & 4 \\ -1 & 1 & 0 \\ 4 & 0 & 2 \end{pmatrix}$, but $AB\neq BA$, so these two matrices cannot be simultaneously diagonalized. Commented Jun 17 at 19:59

To simultaneously diagonalize two quadratic form there are several (essentially equivalent) methods. I will proceed as follows. You define the matrices $$A = \begin{pmatrix} 3 & -1 & 1 \\ -1 & 1 & 0 \\ 1 & 0 & 1 \end{pmatrix},\qquad B = \begin{pmatrix} 5 & -1 & 2 \\ -1 & 1 & 0 \\ 2 & 0 & 2 \end{pmatrix}\,$$ with $$f(x,y,z) = (x,y,z)^T A(x,y,z)$$ and $$g(x,y,z) = (x,y,z)^T B(x,y,z)\,.$$
We solve the generalized eigenvalue problem $$A v = \lambda B v\,.$$ And obtain the eigenvalues and eigenvectors \begin{align} \lambda_1 &= 1, & v_1&= \begin{pmatrix} 0&1&0\end{pmatrix}^T,\\ \lambda_2 &= \frac12, & v_2 &= \frac{1}{2}\begin{pmatrix} 1&1&0\end{pmatrix}^T,\\ \lambda_3 &= \frac12, & v_3 &= \frac{1}{2}\begin{pmatrix} -1&-1&2\end{pmatrix}^T\,; \end{align} here, the normalization was chosen such that $$v_j^T B v_l = \delta_{jl}.$$ Moreover, we have (from the eigenvalue condition) that $$v_j^T A v_l = \lambda_j \delta_{jl}\,.$$ Thus, the quadratic forms are diagonalized simultaneously in the basis $$v_j$$.
In terms of quadratic forms, we can introduce the new variables $$x',y',z'$$ with $$x= \frac12(y'-z'), \quad y= x'+\frac12 (y'-z'), \quad z =z'\,.$$ In terms of these variables, the quadratic forms are given by $$f = x'^2 + \frac12 y'^2 + \frac12 z'^2, \qquad g= x'^2 + y'^2 +z'^2\,.$$
• wait so this works even if $A$ and $B$ do not commute? Commented Jun 17 at 20:40
• @AnCar: yes, you can diagonalize two quadratic forms $A,B$ simultaneously (there are some degenerate cases which you can avoid by assuming that one is positive definite); e.g., there is an invertible matrix $T$ such that $T^T A T$ and $T^T B T$ are diagonal. Commented Jun 17 at 20:44
• I guess you mixing it up with similarity transforms: if you want $T^{-1} A T$ and $T^{-1} B T$ simultaneously diagonal, you need that $A$ and $B$ commute. Commented Jun 17 at 20:45