Calculating the minimum cost trajectory between two points 
An airplane must travel from point $A$ to point $B$, both at zero altitude and separated
  from each other by a distance $d$. In this problem we assume that the surface of the
  Earth is actually a plane. An airplane costs more money to fly at a lower altitude than
  at a higher one. We wish to minimize the cost of a trajectory between the points $A$ and
  $B$. The trajectory will be a curve through the vertical plane passing through the points
  $A$ and $B$. The cost of traveling a distance $ds$ at an altitude $h$ is constant and given by
  $e^{-h/H}ds$.
  
  
*
  
*Choose a coordinate system that is well suited to this problem.
  
*Give an expression for the cost of the voyage between the points $A$ and $B$, and
  express the problem of minimizing this cost as a variational problem.
  
*Derive the associated Euler-Lagrange or Beltrami equation, as appropriate.
  

I am really stuck in this question. Is there anyone could solve this calculus of variation problem in terms of polar coordinate?
My attempts so far.


*

*We should choose a polar system, to describe this situation, say, $(r_1, \theta_1)$, $(r_2, \theta_2)$ for the points $A$, $B$.

*As derive an expression for cost, I guess maybe we should use integration,
diff and then make it equal to constant, then based on that, then we try to find a formula of $f$, to make 
$$\frac{df}{dy} - \frac{d}{dx} (\frac{df}{dy'}) = 0?$$


*For the Euler-Lagrange or Beltrami equation,  I really don't know.

 A: HINTS:
I use Cartesian coords.Slope to x-axis = $ \tan \phi =y^{'},$ primed w.r.t. $x$
Constraint
$x$ difference is constant
$$ \int  \, dx = x_2 - x_1 = const$$
Cost or object function to minimize
$$ 1 + \int  { e^{-y/H}}{ \sqrt{1+y^{'2} }} dx = const$$
So the "Lagrangian"  is
$$   \,{ e^{-y/H}}{ \sqrt{1+y^{'2} } } $$
Now use EL equn and simplify with $ 1+H = G $
It results in an ODE with $ \phi = f( s(arc)) $ in a more simplified form for numerical solution ..
EDIT1
The ODE obtained primed on  arc basis is (if no errors)curvature of second order 
$$ \phi^{'}=\frac{e^ {(y/H)}}{G \sec^2 \phi + H} $$ 
A: The aircraft path is an optimum between the advantages of reduced air resistance at high altitude and the length of travel to reach high altitude. So the answer will be somewhere between flying at ground level and going vertically up along and vertically down. 
The path length is $ds=\sqrt{dx^2+dy^2}=\sqrt{1+y'^2}dx$. So the Lagrangian is $L(y,y')=\int_{-d/2}^{d/2} e^{-y/H}\sqrt{1+y'^2}dx$ with the end points fixed $y(-d/2)=y(d/2)=0$.
Euler Lagrange $\frac{\partial L}{\partial y}=\frac{d}{dx}\frac{\partial L}{\partial y'}$ gives $\frac{y''}{(1+y'^2)}=-1/H$.
This integrates to $y'=tan(c_1-x/H)$. Integrating again gives $y=H log(cos(c_1-x/H))+c_2$. Fixing up the constants to match the bc gives $y(x)=H log(\frac{cos(x/H)}{cos(d/2H)})$.
