Finding Euler-Lagrange equations Maybe you can help here.  There is kind of a lengthy setup to understand what the question is asking.  There is a paper I'm reading, and in one section of it I can't make heads or tails of the result.  The reference is "Global Carleman Estimates for Waves and Applications" by Baudouin, Buhan, Ervedoza.  

The setup (taken from the paper) : Suppose $p \in L^{\infty}(\Omega \times (-T,T))$.   Given initial data $(y_0^{-T},y_1^{-T}) \in L^2(\Omega)\times H^{-1}(\Omega)$, find a function $u \in L^2(\Gamma_0 \times (-T,T))$ such that the solution $y$ of
\begin{eqnarray}
\partial_t^2y -\Delta y + py = 0 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \text{ in  }  \Omega \times(-T,T)  \\
y = u|_{\Gamma_0} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  \text{ on } \partial \Omega \times (-T,T)\\
y(-T) = y_0^{-T}, \partial_ty(-T) = y_1^{-T} \ \ \ \ \ \ \ \ \ \ \ \ \ \text{ in } \Omega
\end{eqnarray}
 solves $y(T) = \partial_ty(T) = 0$.  

There is a claim that we can get an explicit form for $u$ and $y$.  Let $\phi = e^{\lambda \psi}$, where $\psi(x,t) = |x-x_0|^2 - \beta t^2 +C$.  For $s$ a parameter, define the functional 
$$K_{s,p}(z) = \frac{1}{2s}\int_{-T}^{T}\int_{\Omega}e^{2s\phi}|\partial_t^2z - \Delta z + pz|^2 dx \ dt + \frac{1}{2}\int_{-T}^{T}\int_{\Gamma_0}e^{2s\phi}|\partial_{\nu}z|^2 d \sigma dt $$ $$+<(y_0^{-T},y_1^{-T}),(z(-T), \partial_t z(-T))>_{(L^2 \times H^{-1}) \times (H_0^1 \times L^2)}$$
Here, $<(y_0^{-T},y_1^{-T}),(z(-T), \partial_t z(-T))>_{(L^2 \times H^{-1}) \times (H_0^1 \times L^2)} = \int_{\Omega}{y_0^{-T}z_1^{-T} dx} - <y_1^{-T},z_0^{-T}>_{H^{-1} \times H_0^1}$, 
and 
$<y_1^{-T},z_0^{-T}>_{H^{-1} \times H_0^1} = \int_{\Omega} \nabla(-\Delta_d)^{-1}y_1^{-T}\cdot \nabla z_0^{-T} dx$
where $\Delta_d$ is the Laplace operator with Dirichlet boundary conditions.
Part of the paper shows that $K_{s,p}$ has a unique minimizer $Z[s,p]$, for each $s,p$.

The setup is above.  Now comes the two parts I don't get.
(1).  The paper claims that the Euler-Lagrange equation given by the minimization of $K_{s,p}$ is 
$$\frac{1}{s}\int_{-T}^{T}\int_{\Omega}e^{2s\phi}(\partial_t^2z - \Delta z + pz)(\partial_t^2Z -\Delta Z +pZ) dx \ dt + \int_{-T}^{T}\int_{\Gamma_0}e^{2s\phi}\partial_{\nu}z \partial_{\nu}Z d\sigma dt$$  $$+ <(y_0^{-T},y_1^{-T}),(z(-T), \partial_t z(-T))>_{(L^2 \times H^{-1}) \times (H_0^1 \times L^2)}$$
I don't understand how this result is obtained. From what I know, the Euler Lagrange equations are as follows (from Evans book).  If $I[w] = \int L(Dw(x),w(x),x)$, and we call these variables $p, z, x$ respectively, then the Euler Lagrange equations satisfy $-\sum{({L_{p_i}(Du,u,x)})_{x_i}} + L_z(Du,u,x) = 0$.  When I try to do this to $K_{s,p}$, I get a huge mess, because it seems like we need to use the product rule.  I don't get how it simplifies to this form, and why the third term $<\cdot,\cdot>$ stays the same.
(2)  Let $Y = \frac{1}{s}e^{2s\phi}(\partial_t^2 - \Delta + p)Z[s,p]$, and let $U[s,p] = e^{2s\phi}\partial_{\nu}Z[s,p]|_{\Gamma_0}$.  
Then, we get
$$\int_{-T}^{T}\int_{\Omega}e^{2s\phi}(\partial_t^2z - \Delta z + pz)Y dx \ dt + \int_{-T}^{T}\int_{\Gamma_0}e^{2s\phi}\partial_{\nu}z U d\sigma dt$$  $$+ <(y_0^{-T},y_1^{-T}),(z(-T), \partial_t z(-T))>_{(L^2 \times H^{-1}) \times (H_0^1 \times L^2)} = 0$$
The paper claims that this is the dual formulation of the problem.  What does this mean exactly, and how does this help us show that Y,U works as a solution?
Any help is greatly appreciated.  Thanks in advance
 A: Derivation of Euler-Lagrange equation: If $z$ minimizes $K_{s,p}(z)$, then any small perturbation on $z$ will make this functional bigger.  Hence we want: $\newcommand{\e}{\epsilon}$
$$
\lim_{\e\to 0}\frac{d}{d\e} K_{s,p}(z+\e v) = 0.\tag{$\dagger$}
$$
This means the perturbation $\e v$ in the test function space will drive the functional away from its local minimum (just like calculus).
$K_{s,p}(z+\e v)$ in (1) reads:
$\newcommand{\lsub}[2]{{\vphantom{#2}}_{#1}{#2}}$
$$
\begin{aligned}K_{s,p}(z+\e v) &= \frac{1}{2s}\int_{-T}^{T}\int_{\Omega}e^{2s\phi}|\partial_t^2 (z+\e v) - \Delta (z+\e v) + p(z+\e v)|^2 dx \,dt 
\\
&\quad + \frac{1}{2}\int_{-T}^{T}\int_{\Gamma_0}e^{2s\phi}|\partial_{\nu}(z+\e v)|^2 d \sigma\, dt
\\
&\quad + \lsub{L^2 \times H^{-1}}{\Big\langle (y_0^{-T},y_1^{-T}),((z+\e v)(-T), \partial_t (z+\e v)(-T))\Big\rangle}_{H_0^1 \times L^2}.
\end{aligned}\tag{1}$$


*

*Let the first term in (1) be $I_1$, first for the integrand:
$$
\begin{aligned}
& |\partial_t^2 (z+\e v) - \Delta (z+\e v) + p(z+\e v)|^2 
\\
=& \left|(\partial_t^2 z - \Delta z + pz) 
+ \e (\partial_t^2 v - \Delta v + pv)\right|^2  
\\
=& |\partial_t^2 z - \Delta z + pz|^2 + \e^2 |\partial_t^2 v - \Delta v + pv|^2
\\ 
&\quad +2\e (\partial_t^2 z - \Delta z + pz)(\partial_t^2 v - \Delta v + pv).
\end{aligned}$$Taking derivative of $\e$, first term gone, let $\e \to 0$, second term gone, what is left is the cross term with a factor of 2, hence:
$$
\lim_{\e\to 0}\frac{d}{d\e} I_1 = \frac{1}{s}\int_{-T}^{T}\int_{\Omega}e^{2s\phi}(\partial_t^2 z - \Delta z + pz)(\partial_t^2 v - \Delta v + pv)dx \, dt. \tag{2}
$$

*Second term in (1), say $I_2$, expand the integrand:
$$
|\partial_{\nu}(z+\e v)|^2 = |\partial_{\nu}z|^2 + \e^2|\partial_{\nu}v|^2 + 2\e \,\partial_{\nu}z \,\partial_{\nu}v,
$$
Similar argument as above:
$$
\lim_{\e\to 0}\frac{d}{d\e} I_2 = \int_{-T}^{T}\int_{\Gamma_0}e^{2s\phi}\partial_{\nu}z \,\partial_{\nu}v \,d\sigma\, dt. \tag{3}
$$

*Third term $I_3$ in (1):
$$
\begin{aligned}
& \lsub{L^2 \times H^{-1}}{\Big\langle (y_0^{-T},y_1^{-T}),((z+\e v)(-T), \partial_t (z+\e v)(-T))\Big\rangle}_{H_0^1 \times L^2}
\\
=& \int_{\Omega}{y_0^{-T}(z+\e v)(-T) dx} - \lsub{H^{-1}}{\big\langle y_1^{-T},\partial_t(z+\e v)(-T)\big\rangle}_{H_0^1}
\\
=& \int_{\Omega}{y_0^{-T}z(-T) dx} - \lsub{H^{-1}}{\big\langle y_1^{-T},\partial_t z(-T)\big\rangle}_{H_0^1}
\\
&\quad + \e \left(\int_{\Omega}{y_0^{-T}v(-T) dx} - \lsub{H^{-1}}{\big\langle y_1^{-T},\partial_tv(-T)\big\rangle}_{H_0^1}\right).
\end{aligned}
$$
Taking derivative makes first term gone:
$$
\begin{aligned}
\lim_{\e\to 0}\frac{d}{d\e} I_3 &= \int_{\Omega}{y_0^{-T}v(-T) dx} - \lsub{H^{-1}}{\big\langle y_1^{-T},\partial_t v(-T)\big\rangle}_{H_0^1} 
\\
&=\lsub{L^2 \times H^{-1}}{\Big\langle (y_0^{-T},y_1^{-T}),(v(-T), \partial_t v(-T))\Big\rangle}_{H_0^1 \times L^2}.
\end{aligned}\tag{4} $$
Now (2)+(3)+(4) yields the expression of $(\dagger)$:
$$
\begin{aligned}
 &\frac{1}{s}\int_{-T}^{T}\int_{\Omega}e^{2s\phi}(\partial_t^2 z - \Delta z + pz)(\partial_t^2 v - \Delta v + pv)dx \, dt
\\
&+ \int_{-T}^{T}\int_{\Gamma_0}e^{2s\phi}\partial_{\nu}z \,\partial_{\nu}v \,d\sigma\, dt
\\
&+ \lsub{L^2 \times H^{-1}}{\Big\langle (y_0^{-T},y_1^{-T}),(v(-T), \partial_t v(-T))\Big\rangle}_{H_0^1 \times L^2} = 0.\end{aligned}\tag{$\ddagger$} $$
I am using $v$ instead of $z$ as the test function, and the minimizer $Z[s,p]$ is my $z$ (replacing $z$ with $Z$, $v$ with $z$ leads to your equation). And $(\ddagger)$ is the Euler-Lagrange equation. 
What this paper claims is that there exists a unique $Z$ depending on the choice of $s$ and $p$, such that $(\ddagger)$ for any $v$ (in the paper author uses $z$), then $Z$ minimizes the functional $K_{s,p}$, he should show the existence and uniqueness of  $(\ddagger)$ subject to certain boundary conditions somewhere in the paper.

Now onto the second question: $Y$,$U$ does not work as the solution, what the author essentially does is just a change of notation. It is using $Y$ to represent some expression of the minimizer $Z$ (solution) in the interior, and $U$ to represent some other expression of the minimizer $Z$ (solution) on the boundary. The author stating "dual formulation" is with respect to the original PDE: the minimizer $z= Z$ of the functional  $K_{s,p}$ satisfying $(\ddagger)$ for any $v$, and at the same time, serves as the weak solution to the original PDE: 
$$\left\{\begin{aligned}
&\partial_t^2 z -\Delta z + p z= 0 \quad\text{ in  }  \Omega \times(-T,T),  \\
&z = u|_{\Gamma} \quad  \text{ on } \partial \Omega \times (-T,T),\\
&z(-T) = y_0^{-T},\; \partial_t z(-T) = y_1^{-T} \quad \text{ in } \Omega,
\end{aligned}\right.$$
with appropriately chosen boundary data $u$.
A: Consider $g(\epsilon)_{z,v}=K_{s,p}(z+\epsilon v)$ for $v$ an arbitrary function in the appropriate space. Now take the derivative in $\epsilon$ and evaluate at $\epsilon =0$. This is the directional derivative of the functional along the line given by $v$.
