Here is my previous post that I deleted to double check a few things. I've added a few comments to it. There's a certain part of this approach that's subtly tricky.
--------------------------------
I agree with
@Gaussian97 that Newton's second law
is the [might be a] better approach. (Although I
did use integral calculus.)
Newton's second law states that the sum of all forces on a given mass equals that mass times its acceleration.
\sum_i \vec F_i = m \vec a
Set this up separately, one equation for m_1 and another for m_2
A couple things to keep in mind:
- The magnitude of the spring force on a given mass isn't the total displacement of the mass times the spring constant (e.g. kx_1), rather it is the total spring extension times the spring constant, kx. There's no need to split x into x_1 and x_2 here. Just leave it as x. [Edit: You will need separate accelerations though, a_1 and a_2.]
- When you set up the equations, pay careful attention to the direction of each force. Pick a direction to represent the positive direction and stick with it. Consistency is important here.
From there, integrate to find the velocities v_1 and v_2.
[Edit: and here is the tricky bit. The spring's extension x is not constant. It's a function of time. So if you integrate, say, \int (F_1 - kx)dt, the answer isn't simply (F_1 - kx)t. But the beauty here is that you don't have to actually evaluate the integrals. After setting the velocities equal to each other, differentiate both sides of the equation, thus getting rid of the integrals and the need to perform some nasty integration.]
And with your insight in your original post about the velocities being equal, simple algebra is all that's left.