Newton's Cradle is one of the most famous physics demonstrations in history, illustrating the fundamental laws of motion discovered by Sir Isaac Newton and Christiaan Huygens.
Linear Momentum
Every moving object possesses linear momentum $\vec{p}$, which is the product of its mass $m$ and velocity $\vec{v}$:
$$\vec{p} = m \cdot \vec{v}$$
According to Newton's Third Law (every action has an equal and opposite reaction), in any isolated system with no net external forces, total momentum is strictly conserved:
$$\sum \vec{p}_{\text{before}} = \sum \vec{p}_{\text{after}} \implies m_1 v_{1i} + m_2 v_{2i} = m_1 v_{1f} + m_2 v_{2f}$$
Elastic Collisions
When steel or hard rubber balls collide, the collision is nearly perfectly elastic ($e = 1.0$), meaning total kinetic energy $K = \frac{1}{2}m v^2$ is also conserved:
$$\frac{1}{2}m_1 v_{1i}^2 + \frac{1}{2}m_2 v_{2i}^2 = \frac{1}{2}m_1 v_{1f}^2 + \frac{1}{2}m_2 v_{2f}^2$$
Because both momentum and kinetic energy must be conserved simultaneously:
If 1 ball strikes the line, exactly 1 ball must swing out from the opposite end at the same speed!
If 2 balls strike the line, exactly 2 balls must swing out!
If two balls left at half the speed, momentum would be conserved ($m v = 2m \cdot \frac{v}{2}$), but kinetic energy would be halved:
$$\frac{1}{2}(2m)\left(\frac{v}{2}\right)^2 = \frac{1}{4}mv^2 \neq \frac{1}{2}mv^2$$
Physics requires both equations to balance, which uniquely forces the same number of balls to pop out!
To simulate Newton's Cradle in code:
add_floor() sets up the floor foundation.
add_pendulum(pivot_x, pivot_y, length, radius, angle, restitution, color) creates a suspended pendulum ball pulled back to an initial angle.
add_floor() for i = 1, 5 do angle = (i == 1) and -50 or 0 add_pendulum(248 + (i - 1) * 36, 60, 190, 18, angle, 1.0, "#38bdf8") end
Move the mouse over a dotted box for more information.
Equal Mass Collision: When two identical masses ($m_1 = m_2$) collide elastically, they cleanly exchange velocities:
$$v_{1f} = v_{2i} = 0, \quad v_{2f} = v_{1i} = v$$
Ball 1 stops dead in its tracks, passing its momentum to Ball 2, which transfers it through the chain to launch the final ball!
Restitution $e$: When $e = 1.0$, collisions are completely elastic. Real steel cradles have $e \approx 0.98$, slowly damping after many cycles.
Interactive Mouse Control: You can grab any ball with your mouse cursor and drag it back to any angle!
Now you try. Run the code, then use your mouse to lift and drop the balls to create your own collision patterns!
Type your code here:
See your results here:
The code has ???? for num_balls. Replace ???? with 5 and click Run to watch momentum transfer through the cradle!
1. When Ball 1 swings down and strikes the row, it comes to an abrupt halt and Ball 5 swings outward with the same velocity.
2. Try pulling back two balls (see Example 1) — exactly two balls will pop out on the far side!
Share your code
Show a friend, family member, or teacher what you've done!