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?