# Euler lagrange equation for the following functional

I'm going through some video lectures that show how to apply variational methods in computer vision: here the Euler lagrange equations are derived.

I do wonder however how would this apply for a functional of the form

$$E_{\lambda}(u) = \left[\int_{\Omega} (u(x)-f(x))^2 +\lambda \lVert \nabla u(x)\rVert^2 \right] dx$$

Where $\Omega = [0,X]\times[0,Y]$, $f$ a given function and $u : \Omega \rightarrow \mathbb{R}^2$ a suitable function for differentiation (i.e. it does belong to an appropriate function space. $\lambda$ is a positive parameter.

I'm totally confused how to apply the euler lagrange formula to my case, where my function $\mathcal{L}$ is of the form $\mathcal{L}\left(x,u,\nabla u \right)$

I can easily find $\frac{\partial \mathcal{L}}{\partial u}$ but when it comes to something that should be $\frac{\partial L}{\partial \nabla u}$ I get totally confused.

$$E_\lambda(u)=\int_\Omega J_\lambda(u) dx=\int_\Omega [u(x)-f(x)]^2 + \lambda||\nabla u||^2\,dx$$ Take the first variation: \begin{align} \frac{\delta J_\lambda}{\delta u} &= \frac{\partial J_\lambda}{\partial u} - \sum_j \frac{\partial}{\partial x_j}\left(\frac{\partial J_\lambda}{\partial u_{j}}\right)\\ &= 2(u-f)-\sum_j \frac{\partial}{\partial x_j} [2\lambda u_j]\\ &= 2(u-f)-2\lambda\sum_j u_{jj} \\ &= 2(u-\lambda\,\Delta u-f) \end{align} where $u_j := \partial_j u = \partial u/\partial x_j,\, u_{jj} := \partial_{jj} u = \partial^2 u/\partial x_j^2$.
So the Euler-Lagrange equations are: $$\lambda\,\Delta u = u-f$$ unless I've made a mistake.