Defaults are m₁=2.0 kg, u₁=3.0 m/s, m₂=1.0 kg, u₂=0.0 m/s, e=0. Common final velocity V=2.0 m/s, KE_before=9 J, KE_after=6 J, loss=33.3%. Momentum is conserved at 6 kg·m/s before and after, and the centre-of-mass velocity stays 2.0 m/s throughout.
Two bodies approach and collide in real time. Green dashed line = centre of mass (constant velocity, no external force) / arrows = each body's velocity / e=0 sticks (purple), e=1 rebounds elastically, 0<e<1 is in between. At impact the overlay shows "momentum conserved" and "KE lost = …%".
Blue bar = KE before / green bar = KE after / red bar = lost energy ΔKE = KE_before − KE_after / grey bar = total momentum (unchanged before/after) / numeric labels above each bar. For e=1 the red bar vanishes and KE is conserved.
In a perfectly inelastic collision two bodies (masses $m_1, m_2$, velocities $v_1, v_2$) merge after impact and move together with a single common velocity $v_f$. Momentum is conserved exactly and kinetic energy is reduced by the largest possible amount.
Common velocity from momentum conservation:
$$v_f = \frac{m_1 v_1 + m_2 v_2}{m_1 + m_2}$$Initial and final kinetic energy:
$$KE_i = \tfrac{1}{2} m_1 v_1^{2} + \tfrac{1}{2} m_2 v_2^{2},\qquad KE_f = \tfrac{1}{2}(m_1+m_2)\,v_f^{2}$$Energy loss expressed via the reduced mass $\mu = m_1 m_2/(m_1+m_2)$ and the relative motion:
$$\Delta KE = KE_i - KE_f = \tfrac{1}{2}\,\mu\,(v_1 - v_2)^{2}$$$m_1, m_2$ are masses [kg], $v_1, v_2$ are signed velocities [m/s], and $v_f$ is the common post-collision velocity [m/s]. The limit $e = 0$ of the coefficient of restitution turns the missing kinetic energy into heat, sound, plastic deformation and adhesion.