Particle in a box wavefunction derivation I tried solving the particle in a box problem and I came to a result that's different than what I find online.  I solved the Schrödinger equation and I found the analytical form of $\psi$: 
$$ \psi(x) = Ae^{ikx} + Be^{-ikx}
$$ 
Then I set the boundary conditions 
$$\psi(0)=0\,\qquad \psi(L)=0$$ and find the relations 
$$
A+B=0 \qquad Ae^{ikL}+Be^{-ikL}=0
$$ 
Then, substituting $B$ for $-A$, I get $$A(e^{ikL} - e^{-ikL}) =0$$ or \begin{align}e^{ikL}-e^{-ikL}&=2i\sin(kL)=0\ ,\\
\psi(x) &=2iA\sin(kx)
\end{align} I then try to normalize the wave function so that $$\int_0^L|\psi(x)|^2dx=4|A|^2\int_0^L \sin^2(kx)dx=1$$ $$4|A|^2\frac{L} 2=1$$ $$A=±\frac{1}{\sqrt{2L} }$$ Which gives the final wave function: $$\psi(x) =\frac{2i}{\sqrt{2L}}\sin\left(\frac{n\pi}{L}x\right)$$ which is different from what I've found online: $$\psi(x) =\sqrt{\frac{2}{L}}\sin\left(\frac{n\pi}{L}x\right)$$ Am I doing something wrong in solving the problem? Is there more than one correct answer, and if so, why?
 A: The wavefunction only has physical meaning in terms of probability when you take its magnitude squared. 
A factor of $i$, which is the difference between your solution and the one you expect, does not matter. In general, the wavefunction is equivalent up to any phase $e^{i\phi}$.
A: The only difference in your solution and the "online" is a phase factor of $i$. Every SWE solution has an arbitrarily chosen phase factor because of the normalization. You chose to make $A$ real, but it doesn't have to be.
$$A=\pm\frac{e^{i\delta}}{\sqrt{2L}}$$
is a more general expression, where $\delta$ is any real number. You happened to choose $\delta = 0$ and $\pi$. You could have chosen $3\pi/2$ to get 
$$A=\frac{-i}{\sqrt{2L}}.$$
That would yield the "online" result.
A: Normally, when doing this problems you put every constant you encounter inside one "common" constant only, namely $A$.
The thing is that you didn't put $2i$ inside of it, and that wouldn't be a problem, normalization takes that into account.
So in the end you have $\psi(x)=\frac{2i}{\sqrt{2L}}\sin\left(\frac{n\pi}{L}x\right)$. But notice that $\frac{2}{\sqrt{2}}=\sqrt{2}$, thus
$$\psi(x)=i\sqrt{\frac{2}{L}}\sin\left(\frac{n\pi}{L}x\right)$$
Which is the same answer, but with an $i$ multiplying.
It's just a convention that we use pure real wavefunctions, the answer you got is perfectly correct, but not "standard", because it is pure imaginary. Wavefunctions don't have any meaning in real life (at least in the Copenhagen interpretation), they are just tools that we can use to get, for example, the probability density $\rho(x)=|\psi(x)|^2$, which is a measurable quantity.
Notice that you can get the same probability density from your result as from the standard result.
