## Spectral decomposition

Show that every Hermitian matrix $$\boldsymbol A$$ of order $$n$$ can be written as $$\boldsymbol A=\lambda_1\boldsymbol v_1\boldsymbol v_1^{\mathsf H}+\lambda_2\boldsymbol v_2\boldsymbol v_2^{\mathsf H}+\cdots+\lambda_n\boldsymbol v_n\boldsymbol v_n^{\mathsf H}$$, where $$\boldsymbol v_1,\dots,\boldsymbol v_n$$ are suitably chosen eigenvectors corresponding to (not necessarily different) eigenvalues $$\lambda_1,\dots,\lambda_n$$.
Any Hermitian matrix can be written as $$\boldsymbol A=\boldsymbol {RDR}^{\mathsf H}$$, where $$\boldsymbol D$$ is diagonal with eigenvalues on the diagonal and $$\boldsymbol R$$ is unitary, i.e. $$\boldsymbol R^{\mathsf H}=\boldsymbol R^{-1}$$.
The columns of $$\boldsymbol R$$ are the eigenvectors of the matrix $$\boldsymbol A$$, and we choose these for $$\boldsymbol v_1,\dots,\boldsymbol v_n$$. The columns of the product $$\boldsymbol {RD}$$ are then $$\lambda_1\boldsymbol v_1,\dots,\lambda_n\boldsymbol v_n$$.
Vectors $$\boldsymbol v_1^{\mathsf H},\dots,\boldsymbol v_n^{\mathsf H}$$ are rows of $$\boldsymbol R^{\mathsf H}$$. Now it suffices to interpret the outer product in the expression $$(\boldsymbol {RD})\boldsymbol R^{\mathsf H}$$ as the sum of $$n$$ matrices $$\sum\limits_{i=1}^n (\lambda_i\boldsymbol v_i)\boldsymbol v_i^{\mathsf H}$$, which holds indeed in general for any product of two matrices (see task Column products).