# Different energies for particle in a box from $0$ to $L$ and $-L/2$ to $L/2$ [duplicate]

Solving the particle in a box problem considering boundaries 0 and L leads to the energy equation $$\frac{n^2\pi^2\hbar^2}{2mL^2}$$ but doing the same with center at the origin (from -L/2 to L/2) I get $$\frac{2n^2\pi^2\hbar^2}{mL^2}$$ shouldn't I get the same answer?

I used the solution $$A\sin (\frac{\sqrt{2mE}}{\hbar}x)+B\cos (\frac{\sqrt{2mE}}{\hbar}x)$$ by substituting $$f(-L/2)=f(L/2)=0$$ and considering symmetry for cos and sin, $$-A\sin(\frac{\sqrt{2mE}}{\hbar}\frac{L}{2})+B\cos (\frac{\sqrt{2mE}}{\hbar}\frac{L}{2})$$ $$A\sin (\frac{\sqrt{2mE}}{\hbar}\frac{L}{2})+B\cos (\frac{\sqrt{2mE}}{\hbar}\frac{L}{2})$$ subtracting both equations $$2A\sin (\frac{\sqrt{2mE}}{\hbar}\frac{L}{2})=0$$ where $$\frac{\sqrt{2mE}}{\hbar}\frac{L}{2}=n\pi$$

I saw a couple of solutions where they added both equations and used $$\frac{\sqrt{2mE}}{\hbar}\frac{L}{2}=\frac{n\pi}{2}$$

for $$\cos u=0$$, but for even $$n$$, $$\cos u=\pm1$$ so I think it should be $$\frac{\sqrt{2mE}}{\hbar}\frac{L}{2}=\frac{(2n-1)\pi}{2}$$

The answer you obtain by forcing the sine to vanish when you subtract both equations is correct, and you indeed get the second expression for the energy that you obtained at the beginning. However, as you correctly say, the answer should be exaclty the same as the answer you obtained for the well within $$(0,L)$$, so this means that you are missing some solutions. Your "sine" solution only captures half of the solutions in the infinite square well potential, those with even $$n$$. For even $$n$$, you can write $$n=2q$$ for $$q=1,2,\ldots$$, and then replacing this in your first expression for the energy one obtains, as you did: $$\frac{(2q)^2\pi^2\hbar^2}{2mL^2}=\frac{4q^2\pi^2\hbar^2}{2qL^2}=\frac{2q^2\pi^2\hbar^2}{mL^2},$$ where my integer $$q$$ if your integer $$n$$.

How do you obtain the missing solutions? As you also say, these are obtained by adding the two equations that you have after applying boundary conditions. This new set of solutions is only valid for odd $$n$$, because the expression that you obtain by setting the cosine to zero: $$\frac{\sqrt{2mE}}{\hbar}\frac{L}{2}=\frac{n\pi}{2},$$ is only valid for odd $$n$$, as you also correctly realized.

This whole argument becomes much easier if you solve the equation in terms of complex exponentials rather than sines and cosines. I recently did this here.

Another more general point is that, although most books solve the case in which the well is between $$(0,L)$$, I prefer the solution when the well is between $$(-L/2,L/2)$$, because in this case the potential has inversion symmetry about the center of the well, so you can make general statements about, for example, the parity of the solutions.

Both the energies must be the same. Note that the odd condition that you have written can be combined with the even condition as the following: $$\frac{\sqrt{2mE}}{\hbar}=\frac{n\pi}{2}$$ For odd $$n$$ this gives you the cosine solution and for even $$n$$ it reduces to the sine solution.

This means that for odd $$n$$ the wavefunction is pure cosine and for even $$n$$ it is pure sine. To see this, consider the ground and the first excited state of a particle in the $$(0,L)$$ box. They look as follows. Now the $$(-L/2,L/2)$$ box is just a shifted version of the same (by $$L/2$$) and thus the form of the energy eigenfunctions must remain the same, albeit shifted. You can see that odd states have an antinode in the middle $$(x=0)$$, thus must be pure cosine. Similarly the even states have a node in the middle, thus must be pure sine.

This factor of two cancels with the factor of two of $$L$$ in the energy equation to give you back the same equation as before. $$E=\frac{n^2\pi^2\hbar^2}{2mL^2}$$