Ant Connection Problem

This is a nice puzzle from the Maths Masters team, Burkard Polster (aka Mathologer) and Marty Ross as part of their “Summer Quizzes” offerings.

“Two ants are on a cylindrical glass that is 5 centimetres in diameter. The ants are on opposite sides of the glass, 5 centimetres down from the glass’s rim. If both ants are on the outside of the glass, what is the shortest distance required for one ant to crawl to the other? What if one ant is on the outside of the glass and the other is on the inside?”

See the Ant Connection Problem.