How is the projection operator derived? I am having a difficult time understanding how do we go from
$$ C_{n}=\langle n | \psi\rangle $$
and
$$ \psi=\sum C_{n}|\psi\rangle$$
to
$$ \psi=\left(\sum |n\rangle\ \langle n| \right) |\psi \rangle.$$
I used wave QM as a guide and did not know how to do it. here is the comparison:

Can anybody explain how is the projection operator is derived through wave QM?
 A: The notation $\vert a\rangle\langle b\vert$ is something that you define.
In particular, the object $\vert a\rangle\langle b\vert$, for $\vert a\rangle$,$\vert b\rangle \in \mathcal{H}$, is defined to be the linear operator $\hat{O}\in\mathcal{L}(\mathcal{H})$ such that $$\langle \psi_1\vert \hat{O}\vert\psi_2\rangle=(\langle\psi_1\vert a\rangle)(\langle b\vert\psi_2\rangle),\forall\vert \psi_{1,2}\rangle\in\mathcal{H}$$
In order to show that $\vert a\rangle\langle b\vert\psi\rangle=\vert a\rangle(\langle b\vert\psi\rangle)$, we need to show that $\hat{O}\vert\psi\rangle=\vert a\rangle(\langle b\vert\psi\rangle)$. The definition above is sufficient to prove this.
Proof:
\begin{align}
\langle i\vert\hat{O}\vert\psi\rangle&=(\langle i\vert a\rangle)(\langle b\vert \psi\rangle)&,\forall\vert i\rangle\in\mathcal{H}
\\&=\langle i\vert (\langle b\vert\psi\rangle)\vert a\rangle&,\forall\vert i\rangle\in\mathcal{H}
\\\implies\hat{O}\vert\psi\rangle&=(\langle b\vert\psi\rangle)\vert a\rangle
\\\mathrm{(by\ convention\ defined\ to\ be)}&=\vert a\rangle(\langle b\vert \psi\rangle)
\end{align}
Or, in other words, $\vert a\rangle\langle b\vert\psi\rangle=\vert a\rangle(\langle b\vert\psi\rangle)$.
