# Find an orthogonal matrix $Q$ and a diagonal matrix $D$ such that $A=QDQ^T$

Let $$A=\begin{bmatrix}1&1&1\\1&1&1\\1&1&1\end{bmatrix}$$ Find an orthogonal matrix $$Q$$ and a diagonal matrix $$D$$ such that $$A=QDQ^T$$.

I already got these Eigenvalues $$D=\begin{bmatrix}0&0&0\\0&0&0\\0&0&3\end{bmatrix}$$and Eigenvectors $$P=\begin{bmatrix}-1&-1&1\\1&0&1\\0&1&1\end{bmatrix}$$

\begin{align} \langle v_1,v_2\rangle &= \quad \!1+0+0=1 \\ \langle v_1,v_3\rangle &=-1+1+0=0 \\ \langle v_2,v_3\rangle &=-1+0+1=0 \end{align}

$$\because \langle v_1,v_3\rangle= \langle v_2,v_3\rangle=0 \space \therefore A=A^T$$

$$\because \langle v_1,v_2\rangle=1+0+0=1 \space \therefore v_1\perp v_2$$

But I have no idea what is the next step.

I try to give my input from a methodical approach. From your above computations, we can see that:

For $$\lambda = 0$$, these eigenvectors $$\{v_1,v_2\}$$ span the eigenspace $$E_{\lambda=0}$$: $$\begin{Bmatrix} \begin{bmatrix} -1\\ 1 \\ 0 \end{bmatrix}, \begin{bmatrix} -1\\ 0 \\ 1 \end{bmatrix} \end{Bmatrix}$$

and for $$\lambda = 3$$, this eigenvector $$\{v_3\}$$ span the eigenspace $$E_{\lambda=3}$$: $$\begin{Bmatrix} \begin{bmatrix} 1\\ 1 \\ 1 \end{bmatrix} \end{Bmatrix}$$

These eigenvectors are linearly independent. However, there are repeated eigenvalues for $$\lambda = 0$$. Next, we check $$\langle v_1, v_2 \rangle$$. We observe that these eigenvectors are not orthogonal, as what you have shown $$\langle v_1, v_2 \rangle =1\neq0$$.

Hence, we can use Gram-Schmidt orthogonalization to obtain our orthonormal set.

For $$E_{\lambda=0}$$, we find our orthonormal vectors $$\{e_1, e_2\}$$:

\begin{align} u_1 & = v_1 \\ e_1 & = \frac{u_1}{||u_1||} = \frac{1}{\sqrt2} \begin{bmatrix} -1\\ 1 \\ 0 \end{bmatrix} \\ \DeclareMathOperator{\proj}{proj} & \\ u_2 & = v_2 - \proj_{u_1} (v_2) \\ & = v_2 - \langle v_2, u_1\rangle u_1\\ & = \begin{bmatrix} -1\\ 0 \\ 1 \end{bmatrix} - \left\langle \begin{bmatrix} -1\\ 0 \\ 1 \end{bmatrix}, \frac{1}{\sqrt2} \begin{bmatrix} -1\\ 1 \\ 0 \end{bmatrix} \right\rangle \frac{1}{\sqrt2} \begin{bmatrix} -1\\ 1 \\ 0 \end{bmatrix} \\ & = \begin{bmatrix} -1/2\\ -1/2 \\ 1 \end{bmatrix} = \frac{1}{2} \begin{bmatrix} -1\\ -1 \\ 2 \end{bmatrix} \\ e_2 & = \frac{u_2}{||u_2||} = \frac{1}{\sqrt6} \begin{bmatrix} -1 \\ -1 \\ 2 \end{bmatrix} \\ \end{align}

For $$E_{\lambda=3}$$:

\begin{align} u_3 & = v_3 \\ e_3 & = \frac{u_3}{||u_3||} = \frac{1}{\sqrt 3} \begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix} \\ \end{align}

Hence, \begin{align} Q & = [e_1 \space e_2 \space e_3] = \begin{bmatrix} -1/ \sqrt2 & -1/ \sqrt6 & 1/ \sqrt3\\ 1/ \sqrt2 & -1/ \sqrt6 & 1/ \sqrt3\\ 0/ \sqrt2 & 2/ \sqrt6 & 1/ \sqrt3\\ \end{bmatrix}: \\ D & = \begin{bmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 3 \\ \end{bmatrix} \end{align}

Replace $$v_2$$ by $$v'_2:=v_2-\frac{\langle v_2,v_1\rangle}{\|v_1\|^2}v_1=\begin{pmatrix}-\frac12\\-\frac12\\1\end{pmatrix}$$ (which is again in $$\ker A=v_3^\perp$$ since $$v_1,v_2$$ are, but which is now orthogonal to $$v_1$$).

Dividing $$v_1,v'_2,v_3$$ by their respective norms $$\sqrt2,\sqrt\frac32,\sqrt3$$ will give you the 3 columns of your matrix $$Q.$$

Note that any linear combination of $$v_1$$ and $$v_2$$ is an eigenvector of $$A$$ corresponding to the eigenvalue $$0$$. Moreover, as you already noted, since $$A$$ is a symmetric matrix, the eigenspace associated with $$0$$ is orthogonal to the eigenspace associated with $$3$$.

Therefore consider a vector $$w=\alpha v_1+ \beta v_2$$ with $$\alpha,\beta\in \mathbb{R}$$, such that $$\langle v_1,w\rangle=2\alpha+\beta= 0$$ and replace $$v_2$$ with $$w$$. For instance, $$\alpha=1$$ and $$\beta=-2$$ give $$w=v_1 -2v_2=(1,1,-2)$$. Hence one possible orthonormal matrix $$Q$$ is $$\left[\frac{v_1}{\|v_1\|} \Bigg| \frac{w}{\|w\|} \Bigg| \frac{v_3}{\|v_3\|}\right] =\begin{bmatrix}-\frac{1}{\sqrt{2}}&\frac{1}{\sqrt{6}}&\frac{1}{\sqrt{3}}\\\frac{1}{\sqrt{2}}&\frac{1}{\sqrt{6}}&\frac{1}{\sqrt{3}}\\0&-\frac{2}{\sqrt{6}}&\frac{1}{\sqrt{3}}\end{bmatrix}$$

• Where $\alpha$ and $\beta$ come from. Oct 16, 2022 at 7:08
• $\alpha v_1+ \beta v_2$ is a linear combination of $v_1$ and $v_2$. See the link given above. Oct 16, 2022 at 7:09
• So that means I don't need to find the projection of $v_2$? As I saw the example in books are using Gram-Schmidt process. Oct 16, 2022 at 7:16
• Finding $w$ such that $<v_1,w>=0$ is the same that the projection of $w$ over $v_1$ is zero. See en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process Oct 16, 2022 at 7:23
• Yes, you could also apply the Gram-Schmidt process to your couple $v_1$, $v_2$. Notice that the matrix $Q$ is not unique. Oct 16, 2022 at 7:26