Calculate time using velocity as a function of distance I'm trying to look at the Brachistochrone problem as an example of calculus of variations. In this problem we have two points in 2D space, where the second is below and to the right of the first, and we have to draw a curve between the two points such that the time it takes a ball to roll down the curve is minimized.
From a calculus of variations viewpoint, we want to find a function $f:[x_1, x_2] \rightarrow \mathbb{R}$ with given boundary conditions $f(x_1) = y_1, f(x_2) = y_2$ that minimizes a functional $T[f]$ that represents the time it takes for the ball to roll down the curve. I'm stuck trying to figure out what exactly this functional should be.
It's pretty easy to calculate the speed of the ball rolling down the curve at any given position, using potential and kinetic energy. We can also calculate the acceleration using the slope of curve. My question is, given this information, how exactly do we get the time it takes the ball to get from one point to another?
I've found a few sources that calculate this functional explicitly, and they end up with the following expression:
$$ T[f] = \int_{x_1}^{x_2} \sqrt{\frac{1+(f'(x))^2}{2gf(x)}} dx $$
where $g$ is the gravitational constant. This is usually derived by first expressing the time as:
$$ T[f] = \int \frac{ds}{v} $$
However, I don't really understand how this expression is obtained, and using the arc length formula $ ds = \sqrt{dx^2 + dy^2} $ doesn't feel very rigorous at all. I'd prefer have a rigorous way of getting the functional.
In a more general sense, I'm asking: if we know the acceleration of the ball at any single point, how can we tell how long it takes to go from one point to another?
 A: The problem formulation requires that it starts from  rest, the curve tangent is parallel to y-axis. All of potential energy is converted into kinetic energy. Since we consider energy and conversion involves velocity as kinetic energy and potential energy as the vertical displacement, acceleration does not enter into a definitive formulation at all.
$$ mgy = \frac12 m v^2\rightarrow v=\sqrt{2 g y} $$
For minimum time taken
$$t_2-t_1 = \int dt = \int  \frac{ds}{v}=\int \frac{\sqrt{1+ y^{'2}}dx}{\sqrt{2 g y}}$$
$$F(y(x))= \int \frac{\sqrt{1+ y^{'2}}dx}{\sqrt{ y}}$$
Euler Lagrange $ F_y-y'\dfrac{\partial F }{\partial y^{'} }=const. $ results in ODE of the cycloid as :
$$ \dfrac{ yy^{''}}{1+y^{'2}}= \frac12$$
which is independent of acceleration due to gravity $g$ as long as it is constant. The constant of cycloid size is an arbitrary constant $2a$, which is the radius of imaginary rolling circle.
From vertical energy conservation again we have from rest to minimal position (zero vertical velocity component)
$$ 2a = \frac12 g T^2 \rightarrow T=\sqrt{ \dfrac{4a}{g}} $$
and only $ \sqrt{ \dfrac{2y}{g}} $ at intermediate points. It depends on how big a cycloid you wish to build.
Since size is arbitrary and when we  fix its size, its time to descent to lowest point also gets fixed as above.. making the time to slide to its lowest point from any starting point at rest also fixed... marking the tautochrone property of a cycloid.
