I am struggling to derive the Euler-Lagrange equations for the problem below. I have only recently been introduced to Euler-Lagrange equations and am struggling to understand them. I will also give the solution below to the problem, so if anyone has a derivation, that would be great. \begin{equation*} J(u) = \int\int(E(x,y) - R(p,q))^{2} + \lambda \left(\frac{\partial p}{\partial y} - \frac{\partial q}{\partial x}\right)^{2} \end{equation*} where $p = \frac{\partial z}{\partial x}$ and $ q = \frac{\partial z}{\partial y}$
The Euler Lagrange equations for the problem yield \begin{equation*} (E - R)R_{p} + \lambda ( p_{yy} - q_{xy}) = 0 \end{equation*} \begin{equation*} (E - R)R_{q} + \lambda ( q_{xx} - p_{xy}) = 0 \end{equation*}