Ball sliding along a lemniscate curve takes the same time to arrive at a given point as a ball that takes the direct path I was charmed by the following animation. How can this problem be formulated mathematically (equation describing the motion)? How can the variational calculus be applied to find the lemniscate curve as (unique?) solution?
 A: Lemniscate 
the Lemniscate  curve can described by this equations:
$$\vec{R}=\begin{bmatrix}
  x \\
y \\
\end{bmatrix}=\left[ \begin {array}{c} {\frac {a\cos \left( \lambda \right) }{1+
 \left( \sin \left( \lambda \right)  \right) ^{2}}}
\\{\frac {a\cos \left( \lambda \right) \sin \left( 
\lambda \right) }{1+ \left( \sin \left( \lambda \right)  \right) ^{2}}
}\end {array} \right] 
$$
where $\lambda$ is the curve parameter $0\le \lambda\le 2\pi$

to blue path is the path that we want to simulate.
Start point $x=0\,,y=0$ thus: $\lambda_s=\frac{\pi}{2}$ and end point is where the tangent on Lemniscate  curve equal zero,thus $\lambda_e=-\arctan \left( 1/6\,\sqrt {3}\sqrt {6} \right) +\pi$ 
The equation of motion:
Kinetic Energy
$$T=\frac{m}{2}\,\vec{v}^T\,\vec{v}$$
where :
$$\vec{v}=\frac{\partial\vec{R}}{\partial\lambda}\dot{\lambda}=\left[ \begin {array}{c} -{\frac { \left( 2+ \left( \cos \left(
\lambda \right)  \right) ^{2} \right) a\sin \left( \lambda \right)
\dot{\lambda}}{4-4\, \left( \cos \left( \lambda \right)  \right) ^{2}+
 \left( \cos \left( \lambda \right)  \right) ^{4}}}
\\ {\frac { \left( 3\, \left( \cos \left( \lambda
 \right)  \right) ^{2}-2 \right) a\,\dot{\lambda}}{4-4\, \left( \cos \left(
\lambda \right)  \right) ^{2}+ \left( \cos \left( \lambda \right)
 \right) ^{4}}}\end {array} \right]$$
Potential Energy
$$U=m\,g\,y$$
thus you get the EOM:
$$\frac{d^2\,\lambda(\tau)}{d\tau^2}-3\,{\frac {g \left( \cos \left( \lambda \left( \tau \right)  \right) 
 \right) ^{2}}{a \left(  \left( \cos \left( \lambda \left( \tau
 \right)  \right)  \right) ^{2}-2 \right) }}+{\frac { \left( {\frac {d
}{d\tau}}\lambda \left( \tau \right)  \right) ^{2}\sin \left( \lambda
 \left( \tau \right)  \right) \cos \left( \lambda \left( \tau \right) 
 \right) }{ \left( \cos \left( \lambda \left( \tau \right)  \right) 
 \right) ^{2}-2}}+2\,{\frac {g}{a \left(  \left( \cos \left( \lambda
 \left( \tau \right)  \right)  \right) ^{2}-2 \right) }}
=0$$
Numerical simulation:
with $a=1$ and the initial conditions 
$\lambda(0)=\lambda_s\,,D(\lambda)(0)=0$.
the numerical simulation give you $\lambda(\tau)$
-you stop the simulation at the event $\lambda(\tau)=\lambda_e$ and get the time $\tau_e$ that take a ball to slide  on the Lemniscate path.
Results 



*

*"Ball silde time" on Lemniscate path  $0.46 [s]$ 

*"Ball silde time" on $y=0.5\,x$ path  $0.59 [s]$

*"Ball silde time" on $y=\,x$    path  $0.37 [s]$
