Calculating the uncertainty of momentum in quantum mechanics The expectation value of the momentum of a one-dimensional wave function $\Psi$ is
$$\langle p \rangle = \int_{-\infty}^{\infty} \Psi^* \hat{p}\Psi \, dx = \int_{-\infty}^{\infty} \Psi^* \left(-i \hbar \frac{\partial}{\partial x}\right)\Psi \, dx.$$
The square of the uncertainty of the momentum is
$$\sigma_p^2 = \langle p^2 \rangle - \langle p \rangle ^2.$$
From the reading I have done, it seems that $\langle p^2 \rangle$ is calculated as
$$\langle p^2 \rangle = \int_{-\infty}^{\infty} \Psi^* \hat{p}^2 \Psi \, dx = \int_{-\infty}^{\infty} \Psi^* \left(-\hbar^2 \frac{\partial^2}{\partial x^2}\right) \Psi \, dx.$$
This is what confuses me. Why do we square just the operator? To me, that doesn't seem like we are  squaring the momentum. I don't understand how squaring the momentum operator is equivalent to squaring the momentum. I believe my confusion stems from a misunderstanding of what momentum is in quantum mechanics and the difference between momentum and the momentum operator.
 A: When you do:
$$
\langle p \rangle = \int_{-\infty}^{\infty} \Psi^* \hat{p}\Psi \, dx = \int_{-\infty}^{\infty} \Psi^* \left(-i \hbar \frac{\partial}{\partial x}\right)\Psi \, dx \; ,
$$
you are actually doing:
$$
\langle p \rangle = \langle \Psi | \ \hat{p} \ | \Psi \rangle 
\; ,
$$
which is the expectation value of the momentum, as you know it.
For the actual measurement of the momentum of a system in a given state, the operation is:
$$
\hat{p} \ |\Psi\rangle
\; ,
$$
here, $\hat{p}$ is the momentum operator and $| \Psi \rangle$ is a vector (in the Hilbert space of the problem) representing the state of the system. For recovering the wave function related to the state one must perform a projection of $| \Psi \rangle $ in the real space (coordinate representation), that goes like this:
$$
\langle x | \Psi \rangle \equiv \Psi(x)
\; ,
$$
this is Quantum Mechanics in Dirac Notation.
In this perspective is more clear to see why we square just the operator. It is because the measurement of a physical quantity (an observable) is given by the application of an operator to a state of the system. So, the first $\langle p \rangle$ is not the true measurement of momentum, but the average of the possible values of momentum.
That said, when you want to calculate the expectation value $\langle p^2 \rangle$, you do:
$$
\langle p^2 \rangle = \langle pp \rangle = \langle \Psi | \ \hat{p} \hat{p} \ | \Psi \rangle = \langle \Psi | \ \hat{p}^2 | \Psi \rangle =
\int_{-\infty}^{\infty} \Psi^* \hat{p}^2 \Psi \, dx \; .
$$
A: By definition
\begin{align}
\langle \hat A\rangle := \int_{-\infty}^{\infty} dx \Psi^* \hat A \Psi
\end{align}
for any operator so apply this to $\hat A=\hat p$ and $\hat A=\hat p^2$.  In practice, the square of an operator means the operator acts twice:
\begin{align}
\hat A^2\Psi=\hat A\hat A\Psi=\hat A\left(\hat A\Psi\right)\, .
\end{align}
Of course from the definition \begin{align}
\langle \hat A\rangle^2=\left( 
 \int_{-\infty}^{\infty} dx \Psi^* \hat A \Psi\right)
\left( \int_{-\infty}^{\infty} dx \Psi^* \hat A \Psi\right) 
\ne  \int_{-\infty}^{\infty} dx \Psi^* \hat A^2 \Psi =\langle \hat A^2\rangle
\end{align}
