When deriving the energy equation for a particle in a box, the wavefunction for a particle was given as:

$$\Psi = Asin(kx)+Bcos(kx)$$
Does anyone know how this function is arrived at? Was it experimental?