How does a Newton cradle work??

The picture above is a Newton cradle. Some of you may have it in your room, some may have seen it around, and some of you may have never seen it before, in which case I strongly recommend you go look at a youtube video of it being used as it is extremely calming and satisfying to look at. In this article I’ll explain how this cool toy actually works.
In its rest position, these 5 balls of steel act as a unit, therefore when you give the system (5 balls being close together) work done against gravity and let go, it will oscillate in a pendulum like manner.
Now the more intriguing phenomenon that can be explored with a Newton cradle is the case of taking a single steel ball, doing work against gravity thereby gaining gravitational potential energy, and releasing it.
What is demonstrated when this experiment occurs is the concept of momentum conservation. When the steel ball collides with the other balls, the steel ball at the opposite end will undergo work done against gravity and rise to a similar altitude as the first ball.
So when there is a collision, there is a compression amongst the resting 4 balls and so when the steel ball collides with the rest, energy is transferred from ball to ball until the final ball. The energy being transferred is kinetic energy which is then converted to potential energy when the ball rises.
Seeing as this isn’t a perfectly elastic system there is of course energy loss in the system due to factors such as heat and friction, therefore eventually the entire system comes to a stop. This follows the second law of thermodynamics.
Thanks for reading!