Let $J[u]=\int_{x_1}^{x_2}g(x,u(x))\sqrt{1+(\frac{du}{dx})^2}dx$ where $g(x,u(x))$ is a smooth function.
The following minimization problem is given: Find $u(x) $ subject to $u(x_1)=f_1$ and $u(x_2)=f_2$ $(x_1<x_2)$ such that $J[u]\leq J[v]$ for all $v$ subject to $v(x_1)=f_1$ and $v(x_2)=f_2$. The goal is to derive the Euler-Lagrange equation. However, I got stuck because the function $g$ depends on $u$.
I derived the following Euler-Lagrange equation:
$\frac{d}{dx}\left(\frac{g\frac{du}{dx}}{\sqrt{1+(\frac{du}{dx})^2}}\right)=\frac{\partial g(x,u(x))}{\partial (u(x))}\sqrt{1+(\frac{du}{dx})^2}$ with boundary conditions $u(x_1)=f_1$ and $u(x_2)=f_2$.
I think that the left-hand side is correct, but I'm not sure if I can write the right-hand side like this. Is there a way to write $\frac{\partial g(x,u(x))}{\partial (u(x))}$ in a different way?