How to do spectral decomposition? I missed the last couple classes due to a family emergency and am trying to catch up with review questions. However, I can't seem to find an online source that teaches how to compute a spectral decomposition. I would really appreciate it if someone here can explain to me how the following problem would be done (at the level of someone just learning linear algebra). Thank you!


  
*Compute the spectral decomposition of
  $
  \begin{bmatrix}
    -2 & 6 \\
     6 & 7
  \end{bmatrix}
$
  and
  $
  \begin{bmatrix}
    1 &  0 &  2 \\
    0 & -1 & -2 \\
    2 & -2 &  0
  \end{bmatrix}.
$
  
  
  (Original image here.)

 A: Given a symmetric matrix $A \in M_n(\mathbb{R})$, what is usually meant by finding the spectral decomposition of $A$ is to find an orthogonal matrix $O \in M_n(\mathbb{R})$ and a diagonal matrix $D \in M_n(\mathbb{R})$ such that $O^T A O = D$. In order to find $D$ and $O$, you can apply the following steps:


*

*Find the eigenvalues of $A$ - they will be the roots of the characteristic polynomial $p_A(\lambda) = \det(\lambda I - A)$. Call them $\lambda_1, \ldots, \lambda_k$.

*For each eigenvalue $\lambda_i$ of $A$, find a basis of the corresponding eigenspace $V_{\lambda_i} = \{ v \in \mathbb{R}^n \, | \, Av = \lambda_i v \} = \mathrm{span} \{ v_1^i, \ldots, v_{m_i}^i \}$. This is done by solving a system of linear equations.

*By applying the Gram-Schmidt procedure if necessarily, replace each basis $\{v^i_1, \ldots, v^i_{m_i} \}$ with an orthonormal basis $\{ w^i_1, \ldots, w_{m_i}^i \}$ for $V_{\lambda_i}$.

*Construct a matrix $O$ by taking its columns to be the orthonormal bases for the eigenspaces. That is, let 
$$ O = (v_1^1 | \ldots | v_{m_1}^1 | v_1^2 | \ldots | v_{m_2}^2 | \ldots | v_1^k | \ldots | v_{m_k}^k ). $$
The matrix $O$ will be orthogonal and 
$$ O^T A O = \mathrm{diag}(\lambda_1, \ldots, \lambda_1, \lambda_2, \ldots, \lambda_2, \ldots, \lambda_k, \ldots, \lambda_k) = D$$
where each eigenvalue $\lambda_i$ appears $m_i$ times in $D$.

