Solution (source code)

= Solution

The original PDF places both endpoints at height $5/4$; the vertically stacked fraction can be misread in extracted text. The coefficient in the index is $4$, multiplying $\sqrt y$.

For the optical-length integrand $F=4\sqrt y\sqrt{1+y'^2}$, the <Beltrami identity> applies because there is no explicit $x$ dependence. It gives
$$
F-y'F_{y'}=\frac{4\sqrt y}{\sqrt{1+y'^2}}=4\sqrt h,
$$
where $h>0$ is constant. Therefore $y'^2=y/h-1$. The full <Euler-Lagrange equation> is $2yy''=1+y'^2$, and combining these gives $y''=1/(2h)$. This also excludes a constant curve, which would satisfy the squared first integral but not the full variational equation. Integration yields
$$
y(x)=h+\frac{(x-x_0)^2}{4h}.
$$
Equal endpoint heights at $x=-1,1$ require $x_0=0$. The height condition then becomes $h+1/(4h)=5/4$, or $4h^2-5h+1=0$. Its two positive roots are $h=1$ and $h=1/4$. Hence the two possible stationary rays are
$$
\boxed{y(x)=1+\frac{x^2}{4}\qquad\text{or}\qquad y(x)=\frac14+x^2,\qquad-1\leq x\leq1.}
$$
Both stay in $y>0$, have the required endpoints and satisfy the variational equation. These are the <two optical rays in a square-root refractive-index profile>. Fermat stationarity supplies two rays; it does not assert that both globally minimize travel time.

\Image[/past-exam-of-the-mathematics-course-of-the-year-2-of-the-natural-sciences-course-of-the-university-of-cambridge/2019/paper-1-square-root-index-rays.png]
{title=The two stationary optical rays from <Fermat principle> in a medium with refractive index $4\sqrt y$}