Let m₁ = 3.0 kg and v₁ = + 8 m/s (so right is positive), and m₂ = 1.0 kg and v₂ = 0. The total momentum of the two balls before and after collision is conserved, so
m₁v₁ + m₂v₂ = m₁v₁' + m₂v₂'
where v₁' = + 5 m/s and v₂' are the velocities of the two balls after colliding, so
(3.0 kg) (8 m/s) = (3.0 kg) (5 m/s) + (1.0 kg) v₂'
Solve for v₂' :
24 kg•m/s = 15 kg•m/s + (1.0 kg) v₂'
(1.0 kg) v₂' = 9 kg•m/s
v₂' = (9 kg•m/s) / (1.0 kg)
v₂' = + 9 m/s
which is to say, the second ball is given a speed of 9 m/s to the right after colliding with the first ball.