Hello
The total momentum must conserve before and after the collision.
1) Calling [tex]m_1=2~Kg[/tex] and [tex]m_2=3~Kg[/tex] the masses of the two carts, and [tex]v_1=6~m/s[/tex] and [tex]v_2[/tex] the velocities of the two carts before the collision, the initial momentum is
[tex]p_1 = m_1 v_1 - m_2v_2[/tex]
where the negative sign means the two carts are moving into opposite directions.
2) The two carts after collision are at rest, this means the total momentum after collision is
[tex]p_2=0[/tex]
3) Since the momentum must be conserved, we can write
[tex]p_1=p_2[/tex]
and substituting
[tex]m_1 v_1 - m_2v_2=0[/tex]
from which we can get the velocity of the second cart:
[tex]v_2= \frac{m_1}{m_2}v_1= \frac{2Kg}{3Kg} 6~m/s = 4~m/s [/tex]