Why is momentum quantized in a 1D box even though the operator doesn't give eigenstates? We don't get eigenstates of momentum when we operate momentum operator in the wave function of particle in a 1D box problem yet we say momentum is quantized in this situation. Why is it so?
 A: Taking the standard $[0,L]$ problem, eigenfunction and energy eigenvalues are:
$$
\varphi_n=\sqrt{\frac{2}{L}}\sin\frac{n\pi x}{L}, \qquad E_n=\frac{\hbar^2\pi^2n^2}{2mL^2}.
$$
This means that stationary 1D box systems (e.g. insulated ones) only admit states with a discrete set of possible energies, as above.
Now, that as far energy is concerned. What about linear momentum? We know that by observing momentum we force the system to collapse into a momentum eigenstate, which would be of the form:
$$
\phi_p = \frac{1}{\sqrt{2\pi\hbar}}e^{ipx/\hbar}, 
$$
where $p$ is continuous. Indeed, the probability for a measurement performed on an insulated 1D box system in the $n$-th energy level to produce the momentum value p is given by:
$$
|\langle\phi_p|\varphi_n\rangle|^2.
$$
However, we can think of the wave vector $k$ namely:
$$
k=\frac{n\pi}{L}
$$
which is of course quantized, and then invoking the analogy between this writing and the usual theory of harmonic waves write:
$$
p=\hbar k = \frac{n\pi\hbar}{L},
$$
such formula looks reasonable, since 
$$
E=\frac{p^2}{2m}=\frac{\hbar^2\pi^2n^2}{2mL^2}
$$
and we recover the correct formula for the energy levels.
However, that expression for $p$ is just based on analogy and does not actually mean that the momentum measurement on the $n$-th energy eigenstate will yield $n\pi\hbar/L$ as a result.
A: Recall the Heisenberg principle which tells us that a we cannot know both position and momentum at the same time
$$\Delta x \Delta p \geq \hbar/2$$
For a particle, we have actually at most $\Delta x = L$, so that we cannot in principle have a sharp momentum state. 
Fortunately, there are eigenstates which are eigenstates of $\hat{P}^2$, that is, states superposed of eigenvalues $p$ and $-p$. However, the gap in between them cannot be arbitrary small, so the momentum $p,-p$ gets quantized as $p_n = \pm \frac{n h}{2 L}$. 
That is, we find particles only with discrete (quantized) momenta $\pm p_n$ but once measuring the momentum, we actually did not collapse the wave function on a $p_n$ state but on the $\pm p_n$ superposition and in a second measurement we cannot be sure about the sign of the momentum. The classical picture of a particle bouncing of elastically of the walls can be of help to understand this.
A: I change totally my answer and acknowledges that indeed the momentum does not have stationary eigenvalues in this problem. That is because there is no invariance of the system by spatial translation and therefore translational momentum is not conserved. This implies for a start that it does not commute with the hamiltonian and that thus hamiltonian eigenstates are not momentum eigenstates.
The physical reason is pretty easy to grasp. A stationary state in a box involves  a quantum particle bouncing back and forth against the walls of the box. This means that if you start with an initial state which is a momentum eigenstate with momentum $p$, it will reach a wall of the box within a time of the order of $mL/p$ with $m$ the mass and $L$ the size of the box.
A: Solving the schrodinger equation gives us:
$$-\frac{\hbar^2}{2m}\frac{d^2\psi}{dx^2}=E\psi\:\:\:\xrightarrow{\kappa^2\:\equiv\:2mE/\hbar^2}\:\:\: \frac{d^2\psi}{dx^2}=-\kappa^2\psi\:\:\:\rightarrow\:\:\:\psi(x)=Ae^{i\kappa x}+Be^{-i\kappa x}$$
With the boundary condition and normalization, the solution takes the form
\begin{align}
\psi_{n}(x)&=A\sin(\kappa x)=\sqrt{\frac{2}{L}}\sin\left(\frac{n\pi}{L}x\right)\\
\\
E&=\kappa^2\hbar^2/2m=\frac{n^2\hbar^2\pi^2}{2mL^2}
\end{align}
This wavefunction is not the eigenfunction of momentum operator.
\begin{align}
\hat{P}\psi(x) &= -i\hbar\frac{\partial}{\partial x}\psi(x) = -\sum_{n=1}^{\infty}i\hbar c_{n}\frac{\partial}{\partial x}\psi_{n}(x)=-\sum_{n=1}^{\infty}i\hbar c_{n}\sqrt{\frac{2}{L}}\frac{n\pi}{L}\cos\left(\frac{n\pi}{L}x\right)\\
\hat{P}^2\psi(x) &= -\hbar^2\frac{\partial^2}{\partial x^2}\psi(x)=\sum_{n=1}^{\infty}\hbar^2c_{n}\sqrt{\frac{2}{L}}\left(\frac{n\pi}{L}\right)^2\sin\left(\frac{n\pi}{L}x\right)=\left(\frac{n\hbar\pi}{L}\right)^2\psi(x)\end{align}
Since energy eigenstates are not momentum eigenstates implies $[H, P]\ne0$ and thus we can not simultaneously find all eigenstates of both $\hat{H}$ and $\hat{P}$. However $\hat{P}^2$ does have an eigenstate with eigenvalue $(n\hbar\pi/L)^2$. Nevertheless, it would be naive to directly associate $p=\hbar\kappa$ to assert that momentum is quantized.
To quote wiki

In this sense, it is quite dangerous to call the number $k$ a wavenumber, since it is not related to momentum like "wavenumber" usually is. The rationale for calling k the wavenumber is that it enumerates the number of crests that the wavefunction has inside the box, and in this sense it is a wavenumber. This discrepancy can be seen more clearly below, when we find out that the energy spectrum of the particle is discrete (only discrete values of energy are allowed) but the momentum spectrum is continuous (momentum can vary continuously) and in particular, the relation $E=\frac{p^{2}}{2m}$ for the energy and momentum of the particle does not hold. As said above, the reason this relation between energy and momentum does not hold is that the particle is not free, but there is a potential V in the system, and the energy of the particle is $E = T + V$ , where T is the kinetic and V the potential energy.

But there are solutions like this :
$$\psi_{n}(x)= -A\theta(x)\theta(L-x)e^{\frac{n\pi}{L}x}$$
with normalization $A=\frac{1}{L}$
But this is momentum eigenstate with complex eigenvalue
$$\hat{P}\psi_{n}(x)=  -i\hbar\frac{n\pi}{L}\psi_{n}(x)$$
Just like this post implies about momentum operator. There are other solutions as well with different eigenvalues of the momentum operator. But from this, it is clear that even though $\hat{H}$ and $\hat{P}$ share some common eigenstate. They don't share them all and thus it may not be possible to always diagonalize them. However, $\hat{H}$ and $\hat{P}^2$ can be diagonalized simultaneously. Thus the interpretation of $p=\hbar\kappa$ is wrong. The parameter $\kappa$ is not wavenumber and so does not imply quantization of momentum.
