Eikonal equation from Fermat´s principle I'm trying to deduce eikonal equation from Fermat's principle through variational calculus (namely, applying Euler-Lagrange equations)
$$\delta L=\delta\int_{t_{1}}^{t_{2}}n(x(s), y(s), z(s)) ds =0 \iff \dfrac{d}{ds}\left(\dfrac{\partial n}{\partial \dot{x} } \right)-\dfrac{\partial n}{\partial x}=0, \dot{x}=\dfrac{dx}{ds}.$$
And the same for $y(s)$ and $z(s)$. The point is that I don´t know how to prove, in order to be equivalent to the eikonal equation, that:
$$\dfrac{d}{ds}\left(n\dfrac{dx}{ds}\right)=\dfrac{d}{ds}\left(\dfrac{\partial n}{\partial \dot{x} } \right)$$
How can be proven? I'm not interested in other proofs of the eikonal equation with or without Fermat's principle, I'm just concerned with this path.
Eikonal equation:
$$\nabla n=\dfrac{d}{ds}\left(n\dfrac{d\vec{r}}{ds}\right)$$
 A: I'm thinking that you have to get a lot clearer on what you mean.
Let me define an abstract coordinate $p \in (0, 1)$ that traces in some sense "how far" an object has gone from the starting point to the ending point, then the paths we're considering have the form $\vec r(p).$ We know that the medium has an index $n(\vec r) = c/v(\vec r)$ defining the speed that things actually go, and over an interval $dp$ we know that the path travels a distance $|\vec r'(p)|~dp$  for a total time,$$\int dt = c^{-1} \int_0^1 dp~|\vec r'(p)|~c/v(\vec r(p)) = c^{-1} \int_0^1 dp ~|\vec r'(p)| ~ n(\vec r(p)).$$I therefore gather you're using $ds = dp~|\vec r'(p)|$? That sounds like it could be useful but it probably is not because it makes you write things like $\partial n/\partial\dot x$ which we know must be $0$.
Instead it looks like your effective Lagrangian is (dots are derivatives with respect to $p$),$$ L = \sqrt{\dot x^2 + \dot y^2 + \dot z^2}~~n(x,~y,~z)$$ creating the Euler-Lagrange equation$$\frac{d}{dp}\left(\frac{\partial L}{\partial\dot x}\right) = \frac{\partial L}{\partial x},$$which expands to$$\frac{d}{dp}\left(\frac{\dot x}{\sqrt{\dot x^2 + \dot y^2 + \dot z^2}} ~ n\right ) = \sqrt{\dot x^2 + \dot y^2 + \dot z^2} ~~ n_x.$$  
Following what you seem to be doing, $\dot s = \sqrt{\dot x^2 + \dot y^2 + \dot z^2}$ and for any symbol Q we define $dQ/ds = \dot Q / \dot s,$ we get straightforwardly $n_x = \frac{d}{ds} \left(n~\frac{dx}{ds}\right),$ which is just the $x$-component of what you're trying to prove and can be promoted directly into a vector notation.
The bottom line seems to be that you need to be very suspicious about $ds$ in that integral sign if $s$ must be recalculated based on your path; the Euler-Lagrange equations are derived by assuming that the path perturbation does not perturb this variable of integration $dt$.
A: Define $$L(\mathbf r, \dot{\mathbf r}) = n(\mathbf r(s))\sqrt{\dot{\mathbf r}(s)\cdot\dot{\mathbf r}(s)}$$ satisfying $\mathrm ds^2 = \mathrm d\mathbf r\cdot \mathrm d\mathbf r$
Now, define $$I = \int_{s_1}^{s_2}L ~\mathrm ds = \int_{s_1}^{s_2} n(\mathbf r(s))\sqrt{\dot{\mathbf r}(s)\cdot\dot{\mathbf r}(s)}~\mathrm ds$$
So,
$$
\begin{align}
\delta I 
&=\delta\int_{s_1}^{s_2}L ~\mathrm ds \\
&=\delta \int_{s_1}^{s_2} n(\mathbf r(s))\sqrt{\dot{\mathbf r}(s)\cdot\dot{\mathbf r}(s)}~\mathrm ds\\ 
&= \int _{s_1}^{s_2} \epsilon\left(\frac{\partial n}{\partial\mathbf r}|\dot{\mathbf r}| - \frac{\mathrm d}{\mathrm ds}\left(n\left(\frac{\dot{\mathbf r}}{|\dot{\mathbf r}|}\right)\right)\right)~\varphi^\prime~\mathbf ds\tag{*}
\end{align} 
$$
Now, using proper boundary conditions, deduce  the E-L equation for $\delta I/\epsilon = 0$ to be true.

$(*)$ The variation of $\mathbf r$ is defined as $$\delta \mathbf r = \bar{\mathbf r} - \mathbf r = \epsilon \varphi(s)$$ for any non-negative constant $\epsilon \to 0\,.$
$\delta \dot {\mathbf r} = \dot{(\delta \mathbf r)}\,.$

References:
$\bullet$ Principles of Optics by M.Born, E.Wolf.
