In this notebook I will attempt to find the shortest path between two points  and   by using Euler’s method of finite differences.

Finding the shortest path between these two points is equivalent to minimizing the functional   subject to the constraints  and

DiscretizedFunctional[F_,a_,b_,n_]:=
Module[{Δx,x},
Δx=(b-a)/n;
x[i_]:=a+i Δx;

(∑_(i=1)^(n+1))F[x[i],y[i],((y[i]-y[i-1])/(Δx))]]

F[x_,y_,z_]:=Sqrt[1-(z^2)]

J=DiscretizedFunctional[F,a,b,n]

D[J,y[j]]==0//Expand

Because of the presence of the Kronecker-  we can break this down into two cases. The first case is when  and when . So we get the following:

eqn=((n^2)/(((b-a))^2))(((y[j+1]-y[j])/(Sqrt[1-(((n^2)(((y[j+1]-y[j]))^2))/(((b-a))^2))]))-((y[j]-y[j-1])/(Sqrt[1-(((n^2)(((y[j]-y[j-1]))^2))/(((b-a))^2))])))==0

Which is a recurrence equation that can be solved with the boundary conditions  and .

RSolve[{eqn,y[0]==A,y[n+1]==B},y[j],j]

We can see that this is equivalent to  which describes a straight line. This is what we wanted to show.