How to show that a symmetric positive semidefinite matrix can be written using its eigenvalues and eigenvectors Let $B$ be a real symmetric positive semidefinite square matrix (finite) and ${\lambda _k}$, ${{\mathbf{q}}_k}$ corresponding eigenvalues and eigenvectors. Show that $B = \sum\limits_k {{\lambda _k}{{\mathbf{q}}_k}{\mathbf{q}}_k^T}$.
My attempt: First, since $B$ is real and symmetric, we can choose it's eigenvectors ${{\mathbf{q}}_k}$ to be normed and mutually orthogonal. We have 
$B{{\mathbf{q}}_i} = {\lambda _i}{{\mathbf{q}}_i} = \sum\limits_k {{\lambda _k}{{\mathbf{q}}_k}\underbrace {{\mathbf{q}}_k^T{{\mathbf{q}}_i}}_{{\delta _{ki}}}} $
so they are equal on each of the eigensubspaces of $B$.
How can I see that they are equal everywhere?
EDIT: Ok, so it seems that all answers rely on the fact that ${{{\mathbf{q}}_k}}$ can form a basis (it's enough for me to see that they span the whole space, I know that they're orthogonal, and hence linearly independent). How to prove that?
 A: As many have stated, $B$ does not need to be positive semidefinite. 
What you're looking for is probably the spectral theorem. The proof is on Wikipedia too. It relies on the following facts:


*

*You can always find one eigenvalue-eigenvector pair. You may want to work with $\mathbb C$ instead of $\mathbb R$ here.

*The eigenvalue is real. This justifies the extension to $\mathbb C$ made in 1. You also get that the eigenvector has real components.

*The orthogonal complement of the subspace spanned by the eigenvector is invariant.


Item 1 follows almost immediately from the fundamental theorem of algebra. You'll need to use the fact that $B$ is hermitian (real symmetric) to prove 2 and 3. Then induction finishes your proof.
A: It's not important that $B$ is positive semi-definite. If it's real and symmetric then it has an eigenvalue/eigenvector decomposition $B = X \Lambda X^{-1}$ where the columns of $X$ are eigenvectors of $B$ and $\Lambda$ is diagonal with the eigenvalues of $B$ on its diagonal. Since $B$ is real and symmetric, it is always possible to choose the basis of eigenvectors to be orthonormal (as you mentioned). In this case the matrix $X$ is orthogonal and therefore $X^{-1} = X^T$. Let's rename it $Q$. Thus you obtain $B = Q \Lambda Q^T$. Expanding this expression is exactly what you're looking for.
A: Suppose $B$ is a $n\times n$ symmetric (hence diagonalizable) matrix. 
On the one hand $Bq_1=\lambda_ 1q_1$.
On the other hand $$(\lambda_ 1 q_1q_1^T + \cdots + \lambda _n q_nq_n^T)q_1=\lambda_ 1 q_1(q_1^Tq_1) + \cdots + \lambda _n q_n(q_n^Tq_1) $$
Now since $q_1$ is orthogonal to $\displaystyle q_2,\dots ,q_n$, only $\lambda_ 1 q_1$ will prevail, because $q_1q_1^T=1$ and $q_i^Tq_1=0$, for all $i\in \{1,\dots , n\} \backslash \{1 \}$.
Now recall that $Bq_1=\lambda_ 1q_1$. So you have $Bq_1=(\lambda_ 1 q_1q_1^T + \cdots + \lambda _n q_nq_n^T)q_1$.
Similarly you can get $\displaystyle Bq_i=(\lambda_ 1 q_1q_1^T + \cdots + \lambda _n q_nq_n^T)q_i$, for all $i\in \{1,\dots , n\}$.
Let us write $C=(\lambda_ 1 q_1q_1^T + \cdots + \lambda _n q_nq_n^T)$.
Since $B$ is symmetric, it follows that $\{q_1,\dots ,q_n\}$ is a basis $\mathbb{R}^n$.
So you have $Bv=Cv$, for all vectors $v$ of a basis. This implies that $B=C$ (need help proving this?), which is what you want.
Sorry for changing the notation slightly, It's easier for me this way.
You don't need $B$ to be positive semidefinite.
