This is a basic question about Euler-Lagrange equations that I could not find being addressed anywhere else (some similar questions: Q1 and Q2).
In deriving the Euler-Lagrange equations from the functional $$ S = \int_{x_a}^{x_b} f(y,y',x) \, dx $$ one takes the first variation of $S$ through varying the optimal path $y_c$ according to $y(x)=y_c(x) + \epsilon \eta(x)$ where $\eta$ is assumed to be an arbitrary function (with $\eta(x_a) = \eta(x_b) = 0$). One obtains $$\delta S = \epsilon \int_{x_a}^{x_b} \eta \left(\frac{\partial f}{\partial y}\bigg\rvert_{y_c} - \frac{d}{dx}\frac{\partial f}{\partial y'}\bigg\rvert_{y_c}\right) \, dx$$ which should vanish for arbitrary $\eta$ and from which Euler-Lagrange equation results.
First Question is about the arbitrariness of $\eta$; intuitively, I'd think $\eta$ should be 'perpendicular' to $y_c$ at each point, or otherwise $y_c + \epsilon \eta$ would not define a new path. Is this intuitive picture wrong?
I guess this is probably more relevant for the multidimensional case. For example, consider $f = f( \lbrace y_i \rbrace_{i=1}^n,x)$ where $f$ does not depend on $y'_i$; then following along the same steps, one arrives at $$ \delta S = \epsilon \int_{x_a}^{x_b} dx \, \sum_{i=1}^n \, \eta_i \, \frac{\partial f}{\partial y_i} \bigg\rvert_{y_c} = \epsilon \int_{x_a}^{x_b} dx \, \mathbf{\eta}\cdot\nabla f =0 .$$ This can either mean that $\nabla f(\mathbf{y}_c)=0$ at each point; alternatively if we are only considering $\eta$'s that are perpendicular to the optimising path, this means that the optimal path should be along the gradient of $f$ at each point. Are either of these two the correct conclusion here?
Second Question Regardless of the question about the nature of $\eta$, such a path that connects $x_a$ to $x_b$ and satisfies either of these conditions (ie $\nabla f=0$ or being along $\nabla f$) may not exist after all -- this seems to me to be the case especially when $f = f(y,x)$ is independent of $y'$; how can one find the optimizing $y$ then?