Geodesic on a Plane in Polar Coordinates
This is a simple problem in the
calculus of variations
where we prove that the shortest distance between two points is a straight line. But, instead
of the normal Cartesian coordinate system, we will use polar coordinates \( \left( r, \phi \right) \).
Some people use \( \theta \) for the angle but to be consistent with the cylindrical and spherical
coordinate nomenclature, I choose to use \( \phi \). I was somewhat stumped at the end because there
is a difficult integral to evaluate but we'll cross that bridge when we get to it.
In typical fashion, we wish to minimize the functional
$$ I = \int_a^b ds $$
And the first thing we need to do is figure out what \( ds \) is. Looking at the figure below,
we can see that the differential length of the curve is the hypotenuse of the right triangle
(well, not quite a triangle but it approaches one as \(d\phi \rightarrow 0\)) and is given by
$$ ds = \sqrt{dr^2 + (rd\phi)^2} $$
In order to get something we can integrate, we have a decision to make: we need to decide which differential
to factor out of the radical and integrate by either \(dr\) or \(d\phi\). Do we go with
$$ ds = \sqrt{\left(\frac{dr}{d\phi}\right)^2 + r^2} d\phi $$
or
$$ ds = \sqrt{1 + (r\frac{d\phi}{dr})^2} dr $$
In order to decide, we need to look at the
Euler-Lagrange equation knowing that the \(F\) in the
equation is the integrand in our functional.
$$ F = F(x,y,y') : \frac{d}{dx}\left(\frac{\partial F}{\partial y'}\right) - \frac{\partial F}{\partial y} = 0 $$
The equation becomes significantly simpler to solve if we can choose an integrand that is not a function
of the middle argument, i.e. a function only of the independent variable and the derivative. If this is the case,
then \(\frac{\partial F}{\partial y} = 0 \) leaving the first term to be 0 as well. If the first term is 0, then
inner partial derivative must be a constant because the derivative of a constant is 0.
$$ \frac{\partial F}{\partial y'} = K $$
In our case,that leads us to use the second equation
$$ ds = \sqrt{1 + (r\frac{d\phi}{dr})^2} dr = \sqrt{1 + (r\phi')^2} dr $$
because the first form contains a dependency on \(r\) as well as \(r'\).
So we now have to solve
$$ F = F(r,\phi,\phi') : \frac{\partial F}{\partial \phi'} = \frac{\partial}{\partial \phi'}\left(\sqrt{1 + (r\phi')^2}\right) = K $$
Taking the partial derivative with respect to \(\phi'\), we have
$$ {{r^2\phi'} \over \sqrt{1 + r^2\phi'^2}} = K $$
Squaring both sides gives
$$ {{r^4\phi'^2} \over {1 + r^2\phi'^2}} = K^2 $$
Then
$$ {r^4\phi'^2} = K^2 \left( 1 + r^2\phi'^2 \right) $$
and solving for \(\phi'2\) gives us
$$ \phi'^2 = \frac{K^2}{r^2\left( r^2 - K^2 \right)} $$
Taking the square root and moving \( dr \) to the right side, gives
$$ d\phi = \frac{K}{r\sqrt{ r^2 - K^2 }}dr $$
So, here is where it got tricky for me. If you type the above integral into
Wolfram-Alpha you'll get something
ridiculously complicated. If you're smarter than me, you might be able to simplify it but I had to look at this
integral for a while before I came up with an answer. The trick with this stuff is knowing what spell to cast.
Whenever you see square-roots with squares and quotients, think right-triangles.

You can see that the \( \frac{K}{\sqrt{r^2 - K^2}} \) term is \(\tan \alpha\). So, we make that substitution giving us
$$ d\phi = \frac{\tan \alpha}{r} dr $$
Now, what do we do about the \( r \)? Well, looking at the triangle,
$$ \sin \alpha = \frac{K}{r} $$
This also means that
$$ r = K\csc \alpha $$
so
$$ dr = -K\cot(\alpha) \csc(\alpha) d\alpha $$
Making those substitutions leaves us with
$$ d\phi = \frac{1}{K}\frac{K}{r}\tan(\alpha)dr = -\frac{1}{K}\sin(\alpha)\tan(\alpha)K\cot(\alpha)\csc(\alpha)d\alpha $$
And lo and behold, the entire thing becomes
$$ d\phi = -d\alpha $$
which is something even I can solve.
$$ \phi = -\alpha + C $$
Solving for \(\alpha\) in terms of \(r\),
$$ \sin(\alpha) = \frac{K}{r} \Rightarrow \alpha = \sin^{-1}(\frac{K}{r}) $$
Plugging this back into our result gives us
$$ \phi = -\sin^{-1}\left(\frac{K}{r}\right) + C $$
$$ \sin(C-\phi) = \frac{K}{r} $$
$$ r\sin(C-\phi) = K $$
If you don't recognize the above as a line in polar coordinates, we can go
one step further using the sin-of-the-sum-of-angles identity
$$ r\left(\sin(C)\cos(\phi)-\cos(C)\sin(\phi)\right) = K $$
and gathering up constants, we are left with
$$ Ar\cos(\phi) + Br\sin(\phi) = K $$
and since \(x = r\cos(\phi), y = r\sin(\phi)\) are the transformations for polar to Cartesian
coordinates
$$ Ax + By = K $$
which is the general form of a line in Cartesian coordinates.
It's always satisfying to see something work out.