Energy conservation (2 carts and a spring)

1. The problem statement, all variables and given/known data
A massless spring of spring constant 20 N/m is placed between two carts. Cart 1 has a mass M1 = 5 kg and Cart 2 has a mass M2 = 2 kg. The carts are pushed toward one another until the spring is compressed a distance 1.5 m. The carts are then released and the spring pushes them apart. After the carts are free of the spring, what are their speeds?

Conservaiton of energy always works... so does Conservation of momentum...
Since you already have one equation with two unknown, i.e.
[tex] 22.5 = 1/2m_1v_1^2 + 1/2m_2v_2^2 [/tex]
why don't you apply the conservation of momentum to add one more equation to the problem and make it become 2eqn 2 unkn...

Bad algebra indeed.
You have two equations and two unknowns, this can be solved.
You can easily use the second equation (momentum) to eliminate one of the variables in the first equation (energy) and to solve this equation then.

It is a common problem in physics: you have the total energy in a frame of reference where the total momentum is zero.
Another example of this problem is the recoil of a gun. If you think of it, you see it is the same problem.
In particle physics, when a particle (U238 e.g.) decays in two fragments, the total energy of the reaction (spontaneous fission) is split in the fragments, but the total momentum is not changed (zero if in the proper frame).

Write down the general solution to this problem (not only your specific numbers) and analyse it, it is interresting.