Difference between $ \left | \psi \right > \left < \psi \right| $ and $ \left < \psi \right | \left . \psi \right> $ On our physics class we were told that $ \left | \psi \right > \left < \psi \right| = \hat{I} $, where $\hat{I}$ is the identity operator. And I cant see the difference between $ \left | \psi \right > \left < \psi \right| $ and $ \left < \psi \right | \left . \psi \right> $, because
$$ \left | \psi \right > \left < \psi \right| = \int \psi(q)\psi^*(q)dq$$
While $$\left < \psi \right | \left . \psi \right> = \int \psi^*(q)\psi(q)dq$$
Show me please where is my mistake? Why the second one is $|\psi|^2$ and the first one is the identity operator.
 A: In general the equation $|\psi\rangle\langle\psi|=1$ is false: you need to sum over a complete set of states:
$$
\sum_i |\psi_i\rangle\langle\psi_i|=1
$$
For example, a convenient set of complete states is given by the usual position basis, $|\psi_i\rangle=|q\rangle$, where the sum is actually an integral:
$$
\int\mathrm dq\  |q\rangle\langle q|=1
$$
On the other hand, your second equation is fine, but the first one is not: it should read
$$
|\psi\rangle\langle\psi|=\left[\overbrace{\int\mathrm dq\ |q\rangle\langle q|}^1\right]|\psi\rangle\langle\psi|\left[\overbrace{\int\mathrm dq'\ |q'\rangle\langle q'|}^1\right]=\int\mathrm dq\,\mathrm dq'\ \psi(q)\psi^*(q')\ |q\rangle\langle q'|
$$
which cannot be further simplified. A simple way to understand why your second equation is in general wrong is to note that $|\psi\rangle$ is a vector, and therefore $|\psi\rangle\langle\psi|$ is an operator. On the other hand, the r.h.s. of your second equation is a scalar, and therefore the equation cannot hold.

There is a certain analogy (which I don't really like) that may help you understand what's going on. If we think of a finite dimensional vector space, then there is a certain correspondence between kets and column vectors, and bras and row vectors:
$$
|\psi\rangle\sim\begin{pmatrix}\psi_1\\ \psi_2\\ \psi_3\end{pmatrix}\qquad\qquad\langle\psi|\sim\begin{pmatrix}\psi_1^*&\psi_2^*&\psi_3^*\end{pmatrix}
$$
In this case,
$$
\langle\psi|\psi\rangle=\begin{pmatrix}\psi_1^*&\psi_2^*&\psi_3^*\end{pmatrix}\begin{pmatrix}\psi_1\\ \psi_2\\ \psi_3\end{pmatrix}=|\psi_1|^2+|\psi_2|^2+|\psi_3|^2\in\mathbb R
$$
On the other hand,
$$
|\psi\rangle\langle|\psi|\sim\begin{pmatrix}\psi_1\\ \psi_2\\ \psi_3\end{pmatrix}\begin{pmatrix}\psi_1^*&\psi_2^*&\psi_3^*\end{pmatrix}=
\begin{pmatrix}
|\psi_1|^2&\psi_1\psi_2^*&\psi_1\psi_3^*\\
\psi_2\psi_1^*&|\psi_2|^2&\psi_2\psi_3^*\\
\psi_3\psi_1^*&\psi_3\psi_2^*&|\psi_3|^2
\end{pmatrix}
$$
is a matrix, and therefore it simply make no sense to state $|\psi\rangle\langle\psi|=\langle\psi|\psi\rangle$: both sides are different objects, and they live in different spaces.
