Daniel B. answered 01/06/21
A retired computer professional to teach math, physics
I am assuming that
- the problem came from chegg.com and the situation is as in Figure 5 there,
- the spring has no mass,
- the collision happens instantaneously.
If my assumptions are wrong then please ignore my answer.
Let
v0 be the velocity of the leftmost block before the collision,
v1 be the velocity of the leftmost block right after the collision,
v be the velocity of the middle block right after the collision,
d (to be found) be the maximum compression of the spring.
Since the collision is instantaneous, we can ignore any force of the spring
on the middle block during the collision, and we can analyze the collision
as one between a block of mass 2m and a block of mass m.
We can analyze the collision to calculate v.
From conservation of momentum:
2mv0 = 2mv1 + mv
v1 = v0 - v/2 (1)
From conservation of energy:
2mv0²/2 = 2mv1²/2 + mv²/2 (2)
After substituting (1) into (2) and simplifying we get
3v² = 4v0v (3)
Equation (3) has two solutions:
v = 0, which corresponds to the situation of the leftmost block passing through
the other blocks without any collision. We ignore this possibility.
We use only the other solution
v = 4v0/3
Now we consider the situation after the collision.
The system of the two blocks and a spring continue moving while oscillating.
There is constant transfer of momentum and energy among them, but both
momentum and energy are conserved.
When the spring is at maximum compression the two blocks must be moving at the same speed.
(This can be seen easily by considering the alternatives:
When the distance between them is reducing then maximum compression has not been achieved yet.
When the distance between them is increasing then maximum compression has already passed.)
Let that common velocity be vd.
We can calculate vd from conservation of momentum:
mvd + mvd = mv
vd = 2v0/3
At the time of maximum compression the initial kinetic energy of the middle block, mv²/2,
has been converted to the kinetic energy of the middle and right-most block, plus
the spring energy, kd²/2.
By this conservation of energy:
mvd²/2 + mvd²/2 + kd²/2 = mv²/2
kd² = mv² - 2mvd² = m(16v0²/9 - 8v0²/9) = 8mv0²/9
d = 2v0/3 sqrt(2m/k)