Solution
= Solution
For $E>0$, write $\psi=A\sin kx+B\cos kx$ with $k^2=2mE/\hbar^2$. The condition at zero gives $B=0$; the condition at $L$ gives $kL=n\pi$, where $n=1,2,\ldots$. The $n=0$ solution is identically zero and is not a state. Normalization gives $A^2\int_0^L\sin^2(n\pi x/L)\,dx=A^2L/2=1$. Hence
$$
\boxed{A=\sqrt{\frac2L},\qquad E_n=cn^2,\qquad c=\frac{\pi^2\hbar^2}{2mL^2}.}
$$
Choosing positive $A$ fixes an irrelevant overall phase.