Solving the time-independent Schrodinger equation for particle in a potential well I'm solving a quantum mechanics problem for the particle in a potential well, and the equation I have to solve is $$\frac{d^2\psi}{dx^2}+k\psi=0$$where $$k=\frac{2mE}{\hbar^2}$$
This seems easy enough to solve. It is a second order linear differential equation with constant coefficient of the form $$a\psi''(x)+b\psi'(x)+c\psi(x)=0$$, so I thought we were to use the characteristic equation $$ar^2+br+c=0$$and solve for roots $r_1$ and $r_2$. Doing that, I get $$r^2+k=0$$and therefore $$r=\pm \sqrt{k}$$ The general solution is given by $$\psi(x)=\exp\left(\sqrt{\frac{2mE}{\hbar^2}}x\right)+\exp\left(-\sqrt{\frac{2mE}{\hbar^2}}x\right)$$
However, when I refer to Griffiths' Introduction to Quantum Mechanics, he finds the general solution to be $$\psi(x)=A\sin kx+B\cos kx$$ Where have I gone wrong? Thanks. 
 A: A simple mistake. You need: $$r=\pm \sqrt{-k}$$ So the general solution is given by: $$\psi(x)=a\exp\left(\sqrt{k}ix\right)+b\exp\left(-\sqrt{k}ix\right)$$ So by Euler's formula and a change in the constants: $$\psi(x)=A\sin \sqrt{k}x+B\cos \sqrt{k}x$$
A: Solving $r^2+k=0$ yields $r=\pm \sqrt{- k}$, two imaginary values.  Let $\sqrt{k} = \omega$.  
The solutions take the form $$ \psi(x) = ae^{i\omega} + be^{-i\omega}$$
and using Euler's formulas for sine and cosine, we can rewrite them as $$ \psi(x) = a(\cos\omega + i\sin\omega) + b(\cos\omega - i \sin\omega)$$
$$ = (a+b)\cos\omega + (a-b)i\sin\omega .$$
Because $a$ and $b$ were arbitrary constants, we can use new constants to write the solution set as $$ \psi(x) = A\sin(\omega) + B\cos(\omega) $$ for complex $A$ and $B$.  However, it will be practical to just consider the real solutions of $\psi$.
(Note that the final result you provided is inconsistent with your original notation for the Schroedinger equation.  The $k$ in the general solution griffiths gives is the square root of the $k$ as you used it in the Schroedinger equation.  I would have set $k^2 = \frac{2mE}{\hbar ^2}$.)
