[example: Brachistochrone Setup]
Choose coordinates with $x$ horizontal and $y$ measuring downward vertical distance from the release point, so the bead starts at $y=0$ and admissible curves satisfy $y(x)>0$ for $x>0$. Conservation of mechanical energy gives the speed at height $y$ as $v=\sqrt{2gy}$, and the length element along the graph is $\sqrt{1+(y'(x))^2}\,dx$, so the travel-time functional is
\begin{align*}
T[y]=\int_0^b \frac{\sqrt{1+(y'(x))^2}}{\sqrt{2g\,y(x)}}\,dx.
\end{align*}
Thus
\begin{align*}
L(y,p)=\frac{\sqrt{1+p^2}}{\sqrt{2gy}}.
\end{align*}
Since $L$ has no explicit $x$-dependence, the Euler--Lagrange equation implies that $L-p\partial_pL$ is constant along any smooth extremal. Indeed,
\begin{align*}
\frac{d}{dx}\bigl(L-y'\partial_pL\bigr)=\partial_yL\,y'+\partial_pL\,y''-y''\partial_pL-y'\frac{d}{dx}\partial_pL.
\end{align*}
The middle terms cancel, and the Euler--Lagrange equation gives $\frac{d}{dx}\partial_pL=\partial_yL$, so
\begin{align*}
\frac{d}{dx}\bigl(L-y'\partial_pL\bigr)=\partial_yL\,y'-y'\partial_yL=0.
\end{align*}
For the brachistochrone Lagrangian,
\begin{align*}
\partial_pL(y,p)=\frac{p}{\sqrt{2gy}\sqrt{1+p^2}}.
\end{align*}
Therefore
\begin{align*}
L-p\partial_pL=\frac{\sqrt{1+p^2}}{\sqrt{2gy}}-\frac{p^2}{\sqrt{2gy}\sqrt{1+p^2}}.
\end{align*}
Putting the terms over the common denominator $\sqrt{2gy}\sqrt{1+p^2}$ gives
\begin{align*}
L-p\partial_pL=\frac{1+p^2-p^2}{\sqrt{2gy}\sqrt{1+p^2}}.
\end{align*}
Hence
\begin{align*}
L-p\partial_pL=\frac{1}{\sqrt{2gy}\sqrt{1+p^2}}.
\end{align*}
Along an extremal this equals a positive constant $C$, so with $p=y'$ we get
\begin{align*}
2g\,y(x)\bigl(1+(y'(x))^2\bigr)=\frac{1}{C^2}.
\end{align*}
Writing $a=1/(2gC^2)>0$, this becomes
\begin{align*}
y(x)\bigl(1+(y'(x))^2\bigr)=a.
\end{align*}
Solving for $y'$ on a descending branch gives
\begin{align*}
y'(x)=\sqrt{\frac{a-y(x)}{y(x)}}.
\end{align*}
Equivalently,
\begin{align*}
\frac{dx}{dy}=\sqrt{\frac{y}{a-y}}.
\end{align*}
Set
\begin{align*}
y=\frac{a}{2}(1-\cos\theta).
\end{align*}
Then
\begin{align*}
a-y=\frac{a}{2}(1+\cos\theta).
\end{align*}
Also
\begin{align*}
\frac{dy}{d\theta}=\frac{a}{2}\sin\theta.
\end{align*}
Using $1-\cos\theta=2\sin^2(\theta/2)$ and $1+\cos\theta=2\cos^2(\theta/2)$,
\begin{align*}
\sqrt{\frac{y}{a-y}}=\tan(\theta/2).
\end{align*}
Thus
\begin{align*}
\frac{dx}{d\theta}=\frac{dx}{dy}\frac{dy}{d\theta}=\tan(\theta/2)\cdot \frac{a}{2}\sin\theta.
\end{align*}
Since $\tan(\theta/2)=\sin\theta/(1+\cos\theta)$, this is
\begin{align*}
\frac{dx}{d\theta}=\frac{a}{2}\frac{\sin^2\theta}{1+\cos\theta}.
\end{align*}
Using $\sin^2\theta=(1-\cos\theta)(1+\cos\theta)$,
\begin{align*}
\frac{dx}{d\theta}=\frac{a}{2}(1-\cos\theta).
\end{align*}
Integrating from the initial point gives
\begin{align*}
x=\frac{a}{2}(\theta-\sin\theta).
\end{align*}
Together with
\begin{align*}
y=\frac{a}{2}(1-\cos\theta),
\end{align*}
this is a cycloid. Thus the Euler--Lagrange equation does not produce a straight chord for the fastest descent problem; it selects cycloidal arcs, with the parameter $a$ and endpoint value of $\theta$ determined by the prescribed final point.
[/example]