Euler -Lagrange equation: variational Problem min $K[u]$ for $K[u]=\int_D(|\nabla u|^2+\frac{1}{2}gu^4)dxdy$ Consider the variational Problem min $K[u]$ for $$K[u]=\int_D\left(|\nabla u|^2+\frac{1}{2}gu^4\right)\,{\rm d}x\,{\rm d}y$$ where $D \subset \mathbb{R}^2$ and $g(x,y)$ is a given positive function. Find the Euler-Lagrange equation and the natural boundary conditions for this problem. 
I am really stuck on this problem. I have been looking at an example on pg. 284 here, where they look at $$\int_D |\nabla u|^2\,{\rm d}x\,{\rm d}y$$ but I am stumped as to what the process is and how to apply it to this problem.
 A: It may be easier to see what is happening if we write $$K[u] = \int_D \underbrace{\left(u_x(x,y)^2 + u_y(x,y)^2 + \frac{1}{2}g(x,y)u(x,y)^4\right)}_{= L(x,y,u,u_x,u_y)}\,{\rm d}x\,{\rm d}y.$$For two variables, we have the Euler-Lagrange equation: $$\frac{\partial L}{\partial u} - \frac{\partial}{\partial x}\left(\frac{\partial L}{\partial u_x}\right) - \frac{\partial}{\partial y}\left(\frac{\partial L}{\partial u_y}\right) = 0,$$which reads as $$2g(x,y)u(x,y)^3 - 2u_{xx}(x,y) - 2u_{yy}(x,y) = 0,$$that is: $\triangle u = gu^3$.
I'll omit points of application $(x,y)$ from now on. To find the natural boundary conditions, we compute the first variation $$\delta K[u](\psi) = \frac{{\rm d}}{{\rm d}\epsilon}\bigg|_{\epsilon = 0} K[u+\epsilon \psi] = \int_D (2u_x\psi_x+2u_y\psi_y+2gu^3 \psi)\,{\rm d}x\,{\rm d}y.$$I will follow the example given in page 288 from your book. By Green's first identity we have $$\begin{align}\frac{1}{2}\delta K[u](\psi) &= \int_D \nabla u \cdot \nabla \psi + gu^3 \psi\,{\rm d}x\,{\rm d}y \\ &= \int_D -
 \triangle u \cdot \psi\,{\rm d}x\,{\rm d}y + \oint_{\partial D} \psi \nabla u \cdot n\,{\rm d}s + \int_D gu^3\psi\,{\rm d}x\,{\rm d}y \\ &= \int_D(-\triangle u + gu^3)\psi\,{\rm d}x\,{\rm d}y + \oint_{\partial D}(\nabla u \cdot n)\psi\,{\rm d}s,\end{align}$$where $n$ is the outward unit normal vector to $\partial D$. This tells us again that the Euler-Lagrange equation is $\triangle u = gu^3$, and we get a Neumann natural boundary condition  $$\frac{\partial u}{\partial n}(x,y) = 0 \qquad \text{for all }(x,y) \in \partial D.$$
A: The Lagrangian of this system is 
$$
L(u) = |\nabla u|^2 + \frac{1}{2}gu^4 = (\partial_x u)^2 + (\partial_y u)^2  + \frac{1}{2}gu^4
$$
In this case the Eulear-Lagrange equations can be written as 
$$
\sum_a\partial_a \left(\frac{\partial L}{\partial (\partial_a u)} \right) - \frac{\partial L}{\partial u} = 0
$$
So you need to calculate
\begin{eqnarray}
\partial_x \left(\frac{\partial L}{\partial (\partial_x u)} \right) &=& \partial_x \left(2 \partial_x u\right) = 2\partial^2_x u \\
\partial_y \left(\frac{\partial L}{\partial (\partial_y u)} \right) &=& \partial_y \left(2 \partial_y u\right) = 2\partial^2_y u \\
\frac{\partial L}{\partial u}  &=& 2gu^3 \\
\end{eqnarray}
Putting everything together
$$
\nabla^2 u - 2gu^3 = 0
$$
