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.