Q:

How to fit 5 balls into a can.

You have 5 balls of radii 5 cm. You have a cylindrical can with radius 8 cm. What is the optimal placement of the balls within the can to minimise the height of the can (Distance from top of top ball to bottom of bottom ball) and what is this height.
So far, I believe that alternating balls in a 2d plan would be the most efficient but I cannot show this and I cannot figure out what the heigh would be.
[Edit]
The other option that I have considered is a spiral-like placement, where each ball is rotated 360/5° around the centre of the can from the last leading to their centres forming a pentagon when looked at from above. How would you calculate the height or show which one would be optimal without just measuring it?

A:

It is obvious that only two successive balls can touch. Their centers then have a distance $10$. The vertical displacement $h$ of the centers is minimal when  both balls touch the wall of the can at opposite boundary verticals. The horizontal displacement of the centers then  is $6$, so that $h=\sqrt{100-36}=8$. Since there are $5$ balls the total necessary height of the can is $2\cdot 5+4\cdot 8=42$ [cm].

