E∣ψ⟩=H∣ψ⟩=2mP2∣ψ⟩=−2mℏ2∇2∣ψ⟩By definition of our Hamiltonian HBy definition of the Momentum Operator
Using the ansatz ψ(x)=∏iψi(xi),xi∈R, we can split the equation above into n independent 2nd order differential equations Eiψi=−2mℏ2∂xi2∂2ψi, which have the generic solution ψi(xi)=αisin(ℏ2mEixi)+βicos(ℏ2mEixi). Plugging in the boundary conditionψi(0)=0 gives us the constraint βi=0, simplifying our solution to ψi(xi)=αisin(ℏ2mEixi). Plugging in the boundary condition0=ψi(L) we get
00ℏ2mEiL2mEi===αi=0=ni∈Z=ψi(L)αisin(ℏ2mEiL)sin(ℏ2mEiL)2πniL2πniℏPlugging in our ansatz
Plugging the result above we get ψi(xi)=αisin(ℏ2mEixi)=αisin(ℏL2πniℏxi)=αisin(L2πnixi). Since ψ needs to be Normalizable, we have
Since the Global Phase of ψ does not impact the solution, we can assume that α∈R+, giving us that 1=∣α∣2(2L)n⇒α=(2L)−n. Hence the solution is given by ψ(x)=(2L)−2n∏isin(L2πnixi),ni∈Z0+. Since ψ is normalized, the Energy associated with this solution is given by ⟨ψ∣H∣ψ⟩.