Path to obtain the shortest traveling time Asume we have a particle sitting at the point A(0,0) in a gravitational field. 
(g=9.81) It is going to move along some path to the point B(a,b) Where a>0 and b<0.
What is the curve the particle needs to be moving at to arrive at B in the
least time possible?
(Fastest curve between two points. )

 A: As a few people pointed out in the comments, this is the famous Brachistochrone problem.  It is a candidate for using a variational principle, and that's one way to solve it.  However, it was historically solved long before Euler or  Lagrange.
One way to do it is to make an analogy to light.  We know that light follows the fastest possible path from point to point.  So we imagine a situation where the index of refraction is very high right at the top of the ball's trajectory (since  its speed is slow there) and decreases as we move down.  Note that by conservation of energy, the speed of the ball is a function of height alone, so we can make an analogy to light by having an index of refraction that is a function of height alone.
Next, remember Snell's Law, $n_1\sin\theta_1 = n_2\sin\theta_2$.  This is for two discrete layers of material, but if we had three, four, or more layers the result would be the same, $n\sin\theta$ would be a constant.  A smoothly-varying index of refraction is just the continuous case of the above.  In our problem $n(h)\sin(\theta(h))$ is a constant.
Now we have a constant of motion.  All that remains is to use a little freshman physics to find $n(h)$, then a bit of algebra to derive a differential equation for the path.  That differential equation turns out to be that of a cycloid.
Check out  the Wikipedia article for details; there is no need for me to copy them over here in detail.
http://en.wikipedia.org/wiki/Brachistochrone_curve#Johann_Bernoulli.27s_solution
According to the same article, the problem was solved by a number of top minds at the end of the 17th century, including by Newton. I'm not sure what their methods were, although Newton's was undoubtedly ingenious.  Earlier, Galileo also took a crack at it, conjecturing the solution to be a circle, but he had to acknowledge that he didn't have the mathematical wherewithal yet to nail down the answer for sure.
A: This is called Brachistochrone problem and it is one of the most standard problem using calculus of variational. The solution can be found in standard textbook, but there are some subtle points that worth mention here (see the end). So I will only give the outline of solution.
The first step is to use conservation of energy as $0 = mv^2/2-mgy$, so
$$v=\sqrt{2gy}$$
Also, the displacement is given by $ds=\sqrt{dx^2+dy^2}$, so the total time is 
$$t=\int_A^B{dt}=\int_A^B{\frac{ds}{v}}=\int_A^B{\sqrt\frac{dx^2+dy^2}{2gy}}=\int_A^B{\sqrt\frac{1+(\frac{dy}{dx})^2}{2gy}}dx$$
We can then use the Euler-Lagrange equation directly.

Method 1: This is the approach usually taken (example). Let
$$f(y,y',x)=\sqrt\frac{1+(y')^2}{2gy}$$
where $y' = \frac{dy}{dx}$ and treat $x$ as independent variable and use the Euler-Lagrange equation in the form
$$\frac{d}{dx}\frac{\partial f}{\partial y'}-\frac{\partial f}{\partial y}=0$$
Note that $f$ is independent of $x$. The resulting differential equation is
$$2yy''+(y')^2+1=0$$
It is a non-linear differential equation and there is no easy way to solve, but it can be checked that the solution are indeed
$$
\begin{cases}
x=a(\theta-\sin\theta)\\
y=a(1-\cos\theta)
\end{cases}
$$

Method 2: The previous method is a bit tricky. We can solve it because we already know the answer. A better way to solve this problem is to take $y$ as the independent variable and write the function $f$ as
$$h(x,x',y)=\sqrt\frac{1+(x')^2}{2gy}$$
where $x'=\frac{dx}{dy}$ and so the total time is $t=\int_A^B h(x,x',y)dy$. The Euler-Lagrange equation is now:
$$\frac{d}{dy}\frac{\partial h}{\partial x'}-\frac{\partial h}{\partial x}=0$$
Note that $h$ is now independent of $x$, so $\frac{\partial h}{\partial x}=0$ and $\frac{\partial h}{\partial x'}=const$. If we let this constant to be $\frac{1}{\sqrt{2a}}$ and rearrange the equation, we will have the explicit form of $x'$ as
$$x'=\frac{dx}{dy}=\sqrt{\frac{y}{2a-y}}$$
It can be integrated explicitly and we can get a solution of the form $x(y)$ which is certainly the same as the parametric equation in Method 1.

So why the second method leads to direct explicit solution but not the first one? The reason is that we choose the functional form that are independent of the dependent parameter $x(y)$. Hence there is no need to take the extra total derivative $d/dy$ in the Euler-Lagrange equation which ultimately leads to the nonlinearity in the resulting differential equation.
It is rarely mentioned in textbook probably because the $dx/dy$ will create confusion for the beginner, as it is different from their derivation of the Euler-Lagrange equation. Anyway, the examples here does show that one choice of independent parameter is better than the other choice.
