Boundary conditions in QM and statistical physics I don't understand something about boundary conditions in problem that I discuss it below.
in QM we solve the particle in Potential well and we obtain that we should have $k=\frac{n*pi}L$  that $n\in{N}$ (because negative $n$ don't give new wave function) in statistical physics if we count number of microstates we put 1/8 to count only positive $n$. but we have another problem say free particle in box of volume $V$. then the wave function is $\frac{e^{i\vec k.\vec x}}{\sqrt V}$ and in many books and lectures says Boundary conditions require that the wavevector $\vec k$ should be quantized as $\vec k=\frac{2pi*\vec n}{L}$ and $n\in Z$! and after it calculate the for example Density of States and every things we want in statistical physics.and don't put 1/8 behind their equation! so my problem is what is different between this 2 case that in first $n\in N$ and second $n\in Z$ (but with 2 added to its equation) and then 2 cases give the same physics. is there 2 independent problem or one problem with 2 different of viewpoint?
 A: When dealing with the problem of the ideal gas in statisical mechanics, one wants to get the energy levels, this quantization only comes from boundary conditions. They are two common conditions:


*

*'Born-von Karman' : $\psi(x)=\psi(x+L)$ that leads to $k_n = n\frac{2\pi}{L}$ with $n \in \mathbb{Z}$ (it actually consists to consider that the volume is duplicated in every directions and that the wave-function take the same value in each cell, it is especially usefull in condensed matter, to get rid of boundary problem)

*'hard wall' : $\psi(0)=\psi(L)=0$ that leads to $k_n = n\frac{\pi}{L}$ with $n \in \mathbb{N}$
It is to note that none of these is a fine description of the actual conditions inside an arbitrary box (which is really complicated) but they are "fair" model which still leads to energy quantization with same order of magnitude. 

I quickly demonstrate, the Born-von Karman quantization
\begin{gather}
\psi(x)=A\mathrm{e}^{ikx}+B\mathrm{e}^{-ikx}\\
\psi(x)=\psi(x+L) \Rightarrow A\mathrm{e}^{ikx}+B\mathrm{e}^{-ikx} = A\mathrm{e}^{ik(x+L)}+B\mathrm{e}^{-ik(x+L)}
\end{gather}
Since this relation have to be true for any of the $x$ value, you can use the fact that $\mathrm{e}^{ikx}$ and $\mathrm{e}^{-ikx}$ are orthogonal to deduce that
\begin{gather}
A\mathrm{e}^{ikx} = A\mathrm{e}^{ik(x+L)} \Rightarrow  k_n = n\frac{2\pi}{L} ~~\text{with} ~~ n \in \mathbb{Z}
\end{gather}
A: I think, i know the answer. When you take the k space as a sphere,(and you chose your origin in the corner of the container) then you have to include the 1/8 factor. Cause only positive values of n has any meaning. And thus you are counting the 1/8th of a sphere.
But when you take the origin in the center of the container, then you have positive and negative values of n which are valid too. So you have to consider the whole sphere now, not just the 1/8th part. But this time, due to your change in origin, you have a different mathematical form of boundary condition. So the distance between the states changes also. So ultimately the density of state function turns out to be same.
If you still struggling with this, then See Blundell, 21 chapter.  There's figure and equation to clarify.
Hope it helps
