You are welcomed to check out

Collision between two pendulums or

1D collision : Conservation of MomentumThe velocity of two objects after collision ($V'_1,V'_2$)can be calculated from velocity before collisions ($V_1,V_2$) and mass of two objects ($m_1,m_2$).

From conservation of momentum

$m_1 V_1+m_2 V_2=$ $m_1 V'_1+m_2 V'_2 $,

and conservation of energy $\tfrac{1}{2}m_1V_1^2+\tfrac{1}{2}m_2V_2^2=\tfrac{1}{2}m_1V_1'^2+\tfrac{1}{2}m_2V_2'^2$

So $m_1 (V_1-V_1')=m_2(V_2'-V_2)$

and $\tfrac{1}{2}m_1 (V_1^2-V_1'^2)=\tfrac{1}{2}m_2 (V_2'^2-V_2^2)$, which means $\tfrac{1}{2}m_1 (V_1-V_1')(V_1+V_1')=\tfrac{1}{2}m_2 (V_2'-V_2)(V_2'+V_2)$

So $V_1+V_1'=V_2'+V_2$

i.e. The equation need to be solved are

$m_1 V_1'+m_2 V_2'=$ $m_1 V_1+m_2V_2$ and $V_2'-V_1'=V_2-V_1$

The result is

$V'_1= \frac{m_1-m_2}{m_1+m_2} V_1 +\frac{2m_2}{m_1+m_2}V_2=V_{cm}+\frac{m_2}{m_1+m_2}(V_2-V_1)=2V_{cm}-V_1$

and $V'_2=\frac{2m_1}{m_1+m_2}V_1+\frac{m_2-m_1}{m_2+m_1}V_2=V_{cm}+\frac{m_1}{m_1+m_2}(V_1-V_2)=2V_{cm}-V_2$

where $V_{cm}=\frac{m_1V_1+m_2V_2}{m_1+m_2}$

It means that $V'_1-V_{cm} = - (V_1-V_{cm})$ and $V'_2-V_{cm}= - (V_2-V_{cm})$

or $V'_{1cm}= -V_{1cm}$ and $V'_{1cm}= -V_{1cm}$ where $V'_{1cm}=V'_1-V_{cm}$ ...etc.

From the point of center of mass coordinate system: both particles bounce back with the same speed (relative to center of mass).