Lets say we have a system in a 1D infinite potential well, prepared somehow with the wavefunction: (phi)=C(a-x)x. I understand that if I try to measure the system's energy, I will collapse the system to an eigen state ((psi)=Asin(n pi x/length)+Bcos(n pi x/length)), returning an eigen energy. I want to know what the probability is that I will measure the energy to be the energy for n=5. I think I would take the following integral: integral over length of the box of (phi)(psi)dx where n=5 in the wavefunction (psi). Am I on the right track here? Or way off base?