What is the shortest distance between two points on the surface of a closed cylinder? I understand simple euclidean distance will work if both points are on curved surface, but I am looking for a generic solution where one point can be on the curved while other might be on the top/bottom surface. The parameters we have for point(say A) is its distance from the top of cylinder, and for point B is - its distance from top of the cylinder and angle subtended with the other point along the circumference of cylinder and the centre point of cyclinder.

  • 1
    $\begingroup$ @Anirban Niloy What are coordinates of $ (A,B) $ in cylindrical coordinates? Can we take, say some radius $a$ on top flat closure plate radius $a$ as $ A= (a,0, z_A)$ and $ B= ( r,\theta, z_B)? $ $\endgroup$
    – Narasimham
    Feb 28, 2019 at 5:24
  • $\begingroup$ @Narasimham No, no, no!!!!! Absolutely not. It was my fault for giving the tag. I didn't notice that. $\endgroup$ Feb 28, 2019 at 5:35
  • $\begingroup$ @Prince Post edit you still have not yet stated the radial distance of A on top surface of cap $\endgroup$
    – Narasimham
    Feb 28, 2019 at 6:18
  • $\begingroup$ You could add an intermediate point $C$ on the circle enclosing the top/bottom part and add the two distances. Then, minimize for the intermediate point $C$. $\endgroup$
    – maxmilgram
    Feb 28, 2019 at 6:44
  • $\begingroup$ @ Prince Plz add a sketch to show position of required points. $\endgroup$
    – Narasimham
    Feb 28, 2019 at 8:17

2 Answers 2


Let me try to help with expressing your problem. The following is related:

Find minimum distance between two points on a cylinder, one on the top flat surface $A$ (not its circle center) and another point $B$ on its curved surface.


$$ AO=a\,;\angle AOQ =\alpha; AOP =\theta; \, QB= z ; $$

The problem is best formulated using development of the cylinder curved surface.

Given $(r,\alpha, a,z) $ you want to minimize total length

$$ AP +PB = \sqrt{a^2+r^2-2 a r \cos \theta} +\sqrt{z^2+r^2( \alpha-\theta)^2 }\tag1$$

enter image description here

This should be differentiated w.r.t $\theta$ and set to zero leading to :

$$ \frac {a \sin \theta}{r (\alpha-\theta)} = \sqrt{\frac {a^2+r^2-2 a r \cos \theta}{z^2 +{r^2( \alpha-\theta)^2 }} }\tag2$$

which should be solved. A numerical solution can be attempted as it is a transcendental equation having no closed form solution.

A minimum is seen somewhere in the middle $\theta \approx 0.86$ angle in domain for values assumed $(a,r,\alpha,z)=(.5,1, \pi/2,1.25 ) $ where $ \theta $ is on x-axis and total length of two line segments $ APB$ on y-axis.

enter image description here


It is instructive here to mention geodesics in 3D. Label the vertex opposite to $Q$ as $C,$ to make $ PQBC $ a rectangle. Now the point $P$ should move such that line $APB$ should be straight for minimum length, or in other words

$$\boxed{ \angle APO= \angle BPC = \psi } \tag3 $$

$$ \sin \psi =\frac{a \sin \theta}{\sqrt{ z^2 +r^2( \alpha-\theta)^2 }} =\frac{r( \alpha-\theta) } {\sqrt {z^2 + r^2( \alpha-\theta)^2 } } \tag4 $$

Minimum distance from axis to line on flat top surface is the Clairaut constant for surfaces of revolution. $$ = a \sin \psi \tag5 $$

It is thus seen that the surface of revolution can have abrupt change in slope needing no smoothness and continuity.

  • $\begingroup$ Hi @narasimham could you please share your views? $\endgroup$
    – Prince
    Feb 28, 2019 at 16:13
  • $\begingroup$ added answer above. $\endgroup$
    – Narasimham
    Mar 1, 2019 at 0:28
  • $\begingroup$ wow.. @narasimham thanks for this detailed explanation. Just a few queries - 1. Are you calculating QP^2 as r^2(α−θ)^2? 2. you are breaking the distance from curved surface to the top point to distance from curved surface to the circumference of cylinder and from there to the point on top - For the first part (refer PB in the diagram) is it just along the height of cylinder (shortest distance)? or it might go at some angle?? Refer my attached image for reference - imgur.com/a/vBWWDrc is ABC min distance or APC is minimum. In my question above - AB and angle BOC are given $\endgroup$
    – Prince
    Mar 1, 2019 at 3:36
  • $\begingroup$ Answer to Question 1 is Yes. Answer to Question 2 it is neither. Please redraw your imgur picture so that $A$ is shifted a bit to the left so that line $ BA$ is not a generator of cylinder,Now $ CBA$ is the geodesic or shortest distance between $C$ and $A.$ I added a tag in differential geometry. At the desired point Clairaut's constant is obeyed. $\endgroup$
    – Narasimham
    Mar 1, 2019 at 9:12
  • $\begingroup$ After sometime please look up Fermat's principle and Snell's Law in refraction optics where time is minimized instead of length.. $\endgroup$
    – Narasimham
    Mar 1, 2019 at 9:29

WLOG, let the radius be unit.

The shortest length between two points on the lateral surface is given by


Now, for a trajectory starting from $(1,0,z)$ (on the side) and reaching a point $(x,y,0)$ (on the top) through $(\cos\theta,\sin\theta,0)$ where $\theta$ is unknown, the total path length is


When $(x,y)=(r,0)$, by symmetry the solution is with $\theta=0$ (the function is even), and is made of two line segments. But in the general case, the minimization yields a transcendental equation that has no closed-form solution.

For two points on the side, there might as well exist a short path through the top. This case can be handled by introducing two $\theta$ angles corresponding to the entry and exit points. The minimization will be even less tractable.

enter image description here


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .