Questions regarding solving the Brachistochrone problem using Lagrangian brachistochrone problem: Suppose that there is a rollercoaster. There is point 1 ($0,0$) and point 2 ($x_2, y_2)$. Point 1 is at the higher place when compared to the point 2, so the rollercoaster rolls down from point 1 to point 2. Assuming no friction, we want to build a rollercoaster path from point 1 to point 2, so that the rollercoaster will reach point 2 from point 1 in shortest time. 
So, time taken would be defined as $$\text{time (1} \rightarrow 2) = \int_1^2 \frac{ds}{v}$$
Then, the textbook says that v=$\sqrt{2gy}$.
Then, $ds = \sqrt{dx^2+dy^2} = \sqrt{x'(y)^2 +1} \, \, dy$
Then, $$\text{time (1} \rightarrow 2) = \frac{1}{\sqrt{2g}} \int_0^{y_2} \frac{\sqrt{x'(y)^2 + 1}}{\sqrt{y}} \, dy$$
Then, $f(x,x',y)$ is defined as $$f(x,x',y)=\frac{\sqrt{x'(y)^2 + 1}}{\sqrt{y}}$$
As per Euler-Lagrange equation,
$$\frac{\partial f}{\partial x} = \frac{d}{dy}\frac{\partial f}{\partial x'}$$
The left-hand would be zero, so
$$\frac{\partial f}{\partial x'} = \text{constant} = \frac{1}{2a}$$
Then $$x' = \sqrt{\frac{y}{2a-y}}$$ and $$x = \int \sqrt{\frac{y}{2a-y}} \, dy$$
The textbook then says that substituting $y=a(1-\cos\theta)$ would aid solving the integral.
How does this make sense?
 A: Analytically solving an integral is sometimes a strange art, and "guessing" the correct change of variables can help a lot.
Here, the idea is to introduce $\theta$ such that $y=a(1-\cos\theta)$ or, equivalently, defining $\theta=\arccos(1-y/a)$. How $\theta$ was guessed ? It's difficult to tell, but it happens to simplify the last integral. Under this change of variable, we have
$$dy=d(a(1-\cos\theta))=a\sin\theta d\theta=a\sqrt{1-\cos^2\theta}d\theta,$$
so the integral becomes
$$x = \int \sqrt{\frac{y}{2a-y}} \, dy =\int a\sqrt{\frac{(1-\cos\theta)(1-\cos^2\theta)}{1+\cos\theta}}d\theta$$ 
which is simpler to integrate.
A: I’m not sure that Euler-Lagrange equation $\left(\dfrac{\partial f}{\partial y}-\dfrac{d}{dx}\dfrac{\partial f}{\partial y'}=0\right)$ really solves itself   the problem.
In this way, e.g., TAYLOR, ascertain as proved that  $\displaystyle\frac{d}{x}\frac{\partial f}{\partial y'}$ is a constant, does this derivative and squaring it "for convenience". From then
$\displaystyle\frac{x'^2}{x(1+x'^2)}= const= \frac{1}{2a}$,
adding: "where I have named the constant $\displaystyle\frac{1}{2a}$ for future convenience".
Taylor solves $\displaystyle x=\sqrt\frac{y}{2a-y}$ and  puts the consequent integral:
$\displaystyle x=\int\sqrt{\frac{y}{2a-y}} dy$.
And inmediately the author says:
"This integral can be evaluated by the unlikely looking substitution
$\displaystyle y=a(1-\cos\theta)$
which gives
$\displaystyle x=\int(1-\cos\theta) d\theta=a(\theta-\sin\theta) + const$ "
Giving a value of $0$ to the constant, the author has yet the parametric equations of the cycloid and closed the problem.
Other authors(p.ejem, Marion/Thornton) do the same and another ones even solve the first part of the problema so that the student solves the rest, guessing that solution is the brachistochrone curve(e.g., Goldstein).
In brief, I think the  Euler-Lagrange equation using in this way doesn`t solve the problema. The equation is valid, of course. But authors, simply, choose the ‘convenient’ parameters what lead directly to the parametric equations of the cycloid. Choosing another parameters the solution could be anything.
So, in my view, this way is a mathematical trick. The solution is well known(the brachistochrone) and only the introduction of the ‘convenient’ parameters in EL equation gives the solution.
