General solution to the time-dependent 1d Particle in a box In Griffith's text, he shows that
$$\psi_n(x) = \sqrt{\frac{2}{a} } \sin \left(\frac{n \pi }{a}x \right)$$
is the solution to the time-independent Shrodinger equation for the 1d "infinite well" of size $a$.
He goes on to conclude that
$$\Psi(x,t) = \sum_{n=1}^{\infty} c_n \sqrt{\frac{2}{a} } \sin \left(\frac{n \pi }{a}x \right) e^{-i(n^2 \pi^2 \bar{h} / 2 ma^2)t}$$
is the general solution to the time-dependent equation.
He says that for initial wave $\Psi(x,0)$, the $c_n$ coefficients are given by
$$c_n = \sqrt{\frac{2}{a} }\int_0^a \sin \left(\frac{n \pi }{a}x \right)\Psi(x,0)dx.$$
My question is about this $\Psi(x,0)$ wave function. Can it be any wave function that is well-behaved? Or does it have to be one of those $\psi_n(x)$'s that were found above? If not, then am I wrong to think that linear combinations of those $\psi(x)$ functions are the only allowable ones for this system? What is the right way to think about the relationship between the $\psi(x)$, $\Psi(x,0)$, and general $\Psi(x,t)$ wave functions?
 A: The solution for $\psi_n (x)$ has to be such that it obeys the Schrödinger equation and  the boundary conditions of the 1D potential well. That means that it is impossible to find the particle beyond the well. Theoretically, this could be any other function that satisifes the above two conditions. A possible solution is the sine derived by Griffiths.
A: The idea here is that $\{\psi_n(x)\}$ forms a complete basis of the solution space. This means that any sufficiently well behaved (i.e. $L^2$) $\Psi(x,0)$ can be expressed as a linear combination of $\psi_n$s.
A: Energy eigenstates (eigenstates of the Hamiltonian) are also eigenstates of the time evolution operator. That means that if we want to understand a quantum system, we need only find the energy eigenstates, express the solution at $t=0$ in terms of these eigenstates, and then each of these evolves independently in time.
It turns out that we can always express a general solution to the time-independent Schroedinger equation as a sum of eigenstates. We say they form a basis – just like basis vectors in a vector space.
The $\psi_n$ are energy eigenstates, because $H\psi_n = E_n\psi_n$ where $E_n$ is the energy of that state. We're going to use them as a basis to express the solution to our equation: think of them as like basis vectors $\pmb{i}, \pmb{j}, \pmb{k}$ in 3D Euclidean space.
The step you're probably missing is this: that means we can write
$$\Psi(x, 0) = \sum_n c_n \psi_n(x)$$
in just the same way that we can write a general 3D vector as $a\pmb{i}+b\pmb{j}+c\pmb{k}$.
We find the coefficients $c_n$ by using an inner product, again just like with "normal" vectors. That inner product leads you to the formula for $c_n$ that you have in your question.
Finally, because we chose to work with energy eigenstates, time evolution is now a trivial further step. That gives you the factor of $e^{-iEt/\hbar}$ in $\Psi(x, t)$. Getting to $\Psi(x,0)$ was the hard part – that's why most of the fuss in QM tends to be about finding the energy eigenstates.
