Answer
See the detailed answer below.
Work Step by Step
The speeds of the two balls are too small relative to the speed of light so we can use the Galaian transformation formulas for speeds.
Now we need to identify the frames. Let $\rm S$ be the frame of the ground, and $\rm S'$ is the frame of the 100 g ball (ball 2). And ball 1 here is the 50 g ball.
We know that ball 1 speed is 4 m/s to the right relative to $\rm S$ while the speed of ball 2 is 2 m/s relative to the same frame.
So, we can say that the speed of ball 1 relative to frame $\rm S'$ is 2 m/s while the speed of ball 2 is 0 m/s since the frame itself is stationary.
Now the collision occurs on frame $\rm S'$ where $v'_{i2}=0$ m/s, and $v'_{i1}=2$ m/s.
The collision is perfectly elastic, so the momentum and the energy are conserved.
$$p_i=p_f$$
$$v'_{i1}m_1+v'_{i2}m_2=v'_{f1}m_1+v'_{f2}m_2$$
Plug the known
$$2(50)+0 =50v'_{f1} +100v'_{f2} $$
$$2= v'_{f1} +2v'_{f2} \tag 1$$
$$E_i=E_f$$
$$\frac{1}{2}m_1(v'_{i1})^2+\frac{1}{2}m_2(v'_{i2})^2=\frac{1}{2}m_1(v'_{f1})^2+\frac{1}{2}m_2(v'_{f2})^2$$
Plug the known; $\frac{1}{2}$ cancels,
$$(50) (2)^2+0= 50 (v'_{f1})^2+100(v'_{f2})^2$$
$$200= 50 (v'_{f1})^2+100(v'_{f2})^2$$
$$4= (v'_{f1})^2+2(v'_{f2})^2\tag 2$$
Solving (1) for $v'_{f1}$, and plug into (2)
$$4= (2-2v'_{f2})^2+2(v'_{f2})^2 $$
$$4= 4-8v'_{f2}+4(v'_{f2})^2+2(v'_{f2})^2 $$
Rearranging;
$$ 6(v'_{f2})^2 -8v'_{f2}=0 $$
$$ v'_{f2}[ 6 v'_{f2} -8]=0 $$
whether $ v'_{f2}=0$, which is not realistic here, or
$$ v'_{f2} =\bf \frac{4}{3}\;\rm m/s$$
and hence, plug into (1),
$$ v'_{f1} =\bf \frac{-2}{3}\;\rm m/s$$
Now let's go back to frame $\rm S$, by using the Galilean transformations of velocity again.
$$v_{f1}=v_{f1}'+2=\frac{-2}{3}+2 $$
$$v_{f1}=\color{red}{\bf +1.33}\;\rm m/s $$
and
$$v_{f2}=v_{f2}'+2=\frac{4}{3}+2 $$
$$v_{f2}=\color{red}{\bf +3.33}\;\rm m/s $$
Therefore, both balls will continue moving to the right.