Expected Values of Operators in Quantum Mechanics I've recently started an introductory course in Quantum Mechanics and I'm having some trouble understanding what the expectation of an operator is. I understand how we get the formula for the expectation of position, if we assume that the complex function $\psi$ describes a particle, and $f=|\psi|^2$ is a probability density of finding the particle at varying x at time t.
$\langle x\rangle=\int^{\infty}_{-\infty} xf(x)dx=\int^{\infty}_{-\infty}x\psi^*(x) \psi(x)dx=\int^{\infty}_{-\infty}\psi^*(x)x \psi(x)dx$
But in my course the expectation of an operator (for example momentum $\hat{p}=-i\bar{h}\frac{\partial}{\partial x}$) is defined as
$\langle\hat{p}\rangle=\int^{\infty}_{-\infty}\psi^*(x)\hat{p} \psi(x)dx=\int^{\infty}_{-\infty}\psi^*(x)-i\bar{h}\frac{\partial}{\partial x} \psi(x)dx=-i\bar{h}\int^{\infty}_{-\infty}\psi^*(x)\frac{\partial}{\partial x} \psi(x)$
I don't understand what the expectation of an operator would mean. I can understand the phrase "we expect the momentum to be $p_0$" to mean "after doing this experiment a large number of times, the mean momentum recorded will be $p_0$." But I can't understand what the expectation of a derivative is, before it's even applied to anything!
What does this expected value of the momentum operation mean in QM? Does it relate to something in the real world? Did we just notice that the formula above just happens to look like the average result after a lot of experiments?
Anyway, any clarification would be well appreciated!
 A: The answer to your question begins by looking back at one of the oldest ideas in quantum mechanics, the deBroglie relation between the momentum of a particle and the wavelength of the associated wave.  (This, along with Planck's relation between energy of particles and frequency of waves, was the basic connection between the particle and wave pictures, which underlies quantum theory.)  The deBroglie relation reads $p=h/\lambda$, where $p$ is the particle's momentum and $\lambda$ is the wavelength of the associated wave.  (This is a one-dimensional equation; for particles in three dimensions one also needs to take the direction of the momentum into account, but for simplicity I'll confine this answer to one dimension; the formulas in the question are also one-dimensional.)  In particular, if the particle has a definite momentum $p$, then the corresponding wave is (a constant times) $\psi(x)=\exp(ipx/\hbar)$.  Usually, a particle won't have a definite momentum (uncertainty principle), because its wave function $\psi$ will be a superposition of many waves of the form $\exp(ipx/\hbar)$ for different values of $p$, rather than a single such wave.  But before getting into superpositions, let me point out that
$$
-i\hbar\frac d{dx}\exp(ipx/\hbar)=p\exp(ipx/\hbar).
$$
(In a suitable function space, this makes $\exp(ipx/\hbar)$ and eigenfunction of the operator $-i\hbar\frac d{dx}$, but that suitable space won't be the Hilbert space $L^2$, because $\exp(ipx/\hbar)$ isn't in that space; its norm is infinite; this leads to technicalities that are, fortunately, irrelevant here.) This equation is the fundamental reason why quantum mechanics regards the operator $-i\hbar\frac d{dx}$ as representing momentum.
Now let me look at superpositions.  Suppose the wave function $\psi(x)$ is a superposition of functions $\exp(ipx/\hbar)$ for various valuse of $p$:
$$
\psi(x)=\int_{-\infty}^{\infty}\hat\psi(p)\exp(ipx/\hbar)\,dp.
$$
Mathematically, $\hat\psi$ here is the Fourier transform (or inverse Fourier transform, or, depending on your conventions, one of these times $2\pi$, or times $\sqrt{2\pi}$) of $\psi$.  Physically (because mathematicians aren't supposed to say such things in public), $|\hat\psi(p)|^2\,dp$ is the probability of finding the particle to have momentum in an infinitesimal interval of length $dp$ at $p$.  (This is exactly analogous to $|\psi(x)|^2\,dx$ being the probability of finding the particle in an infinitesimal interval of length $dx$ at position $x$.)  With this physical interpretation of $\hat\psi$, we get that the expectation of the momentum is
$$
\int_{-\infty}^\infty p|\hat\psi(p)|^2\,dp.
$$
The integrand here is the product of $\hat\psi(p)^*$ and $p\hat\psi(p)$.  So the integral is the inner product, in $L^2$, of $\hat\psi(p)$ and $p\hat\psi(p)$. The first of these is the Fourier transform of $\psi(x)$, and the second is, by the "eigenvalue" observation above, the Fourier transform of$-i\hbar\frac d{dx}\psi(x)$.  Using the fact that the Fourier transform preserves inner products (if one has factors of $2\pi$ in the right places, which I won't worry about here), we get that the integral for the expectation of the momentum equals
$$
\int_{-\infty}^\infty\psi(x)^*(-i\hbar\frac d{dx})\psi(x)\,dx.
$$
A: The following doesn't exactly answer your question, and it misses a lot of details, but it might help you understand a little better what is going on with observables in quantum mechanics.
In quantum mechanics, observables are self-adjoint operators $T:\mathcal H\to \mathcal H$ on a Hilbert space $\mathcal H$ of states. The eigenvalues of the observable are the possible outcomes of a measurement.  The spectral theorem tells us, that the eigenvectors of an observable $T$ are pairwise orthogonal and span $\mathcal H$, thus every state is a linear combination of the eigenstates of $T$. Let $\psi_k$ be the eigenstate with eigenvalue $k$, i.e. $T\psi_k = k \psi_k$, then any state $\psi\in\mathcal H$ can be expressed as a linear combination
$$ \psi = \sum_i c_i \psi_i + \int\mathrm c(k)\,\psi_k\,\mathrm dk$$
where the sum goes over the discrete part of the spectrum of $T$ and the integral over the continuous part of the spectrum. The discrete values $|c_i|^2$ are the actual probabilities to measure $\psi$ in the state $\psi_i$, while the function $|c(k)|^2$ is a probability density. Thus, the expected value when measuring the observable $T$ on a system in state $\psi$ is
\begin{align}
\langle T\rangle &= \sum_i |c_i|^2 i + \int |c(k)|^2\, k\,\mathrm dk.
\end{align}
Now let's return to the examples of position and momentum and 1-dimensional space. Here $\mathcal H$ is the space of square-integrable wave functions $\psi:\mathbb R\to\mathbb C$, i.e. $\mathcal H = L^2(\mathbb R)$. The position operator $Q:\mathcal H\to\mathcal H$ is given by $(Q\psi)(x)= x\psi(x)$, it is just multiplication by $x$. In order to apply our probabilistic theory, we have to find all eigenvalues and eigenvectors of $Q$:
$$Q \,\psi_q = q \,\psi_q,$$
which translates to
$$x \,\psi_q(x) = q \,\psi_q(x).$$
This looks weird, when you haven't seen anything like it before. If $\psi_q$ would be nonzero for two values of $x$, say $x_0, x_1$, it can't be a solution, since $\psi_q(x_0)\neq 0$ gives $q=x_0$ and $\psi_q(x_1)\neq 0$ gives $q=x_1$. Thus it will be nonzero only for a single $x\in\mathbb R$. Since it also has two be square-integrable with nonzero $L^2$-norm, there is no such function satisfying our constraints. The only way out is to allow distributions. Indeed, $\psi_q(x) = \delta(x-q)$ does the job:
$$ x\,\delta(x-q) = q\,\delta(x-q).$$
Now given any wave function $\psi\in\mathcal H$, we can decompose it as
$$ \psi(x) = \int \psi(q) \delta(x-q)\,\mathrm dq,$$
which says that $|\psi(q)|^2$ is the probability density of the position $q$ — the general theory gives exactly what we expected! The expected value
$$ \langle Q\rangle = \int |\psi(x)|^2 x \,\mathrm dx = \int \psi^*(x) x\psi(x) \,\mathrm dx$$
also matches what we already knew.
For the momentum operator $P=-i\hbar \frac{\mathrm d}{\mathrm dx}$, the eigenfunctions turn out to be $\psi_p(x)=e^{i\frac{p}{\hbar} x}$ and the decomposition of a state $\psi$ into those is obtained by the Fourier transform. Calculating $\langle P\rangle$ from the general equation I gave above, you will find what you already knew as well. In fact, we find
$$\langle T \rangle = \int \psi^*(x) (T\psi)(x)\,\mathrm dx.$$
A: All of the previous answers are giving the expectation of the operator measuring a state/wave function/vector. That is a random variable and thus has an expectation. The operator itself is not a random variable. 
