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.
Shortest distance between two points on the surface of a closed cylinder
3.2k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 2 best solutions below
On
WLOG, let the radius be unit.
The shortest length between two points on the lateral surface is given by
$$\sqrt{\Delta^2\theta+\Delta^2z}.$$
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
$$\sqrt{\theta^2+z^2}+\sqrt{(x-\cos\theta)^2+(y-\sin\theta)^2}.$$
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.

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.
EDIT1:
$$ 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$$
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.
EDIT2:
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.