Solution of elliptic problem is a minimizer of certain functional Let $f$ be continuously differentiable convex function on $\mathbb{R}$ and $U$ be Lipschitz domain. Suppose $u \in C^2(U) \cap C(\overline{U})$ is a solution to the following problem
\begin{cases}
 -\Delta u + f'(u)=0  \ \ \ \ \ \ \ \text{ in }  \ \  U, \\ u(x)= 0  \ \ \ \ \ \ \ \text{ in } \ \ \ \partial U,
\end{cases}
Show that $u$ is a minimizer for the following functional
$$ \int_{U} \frac{|\nabla u|^2}{2} + f(u) \ \ dx$$
over all functions that vanish at the boundary. That is, if $v = 0$ on $\partial U$, then the following hold
$$ \int_{U} \frac{|\nabla u|^2}{2}  + f(u) \ \  dx \leq \int_{U} \frac{|\nabla v|^2}{2} + f(v) \ \  dx$$
My attempt:
Let $J(u) =\int_{U} \frac{|\nabla u|^2}{2}  + f(u) \ \  dx$. Suppose $v$ solves the problem and define $w = v-u$. Then I want to show $J(v) \geq J(u)$
\begin{align} J(v) = J(u + w) &=  \int_{U} \frac{|\nabla u|^2}{2}  + f(u) \ \  dx + \int_{U} \frac{|\nabla w|^2}{2}  + f(w) \ \  dx + \int_U \nabla u \cdot \nabla w \ \ dx\\
&= J(u) + J(w) + a(u,w)
\end{align}
Now it is clear that $J(w) \geq 0$. How to deal with the form $a(u,w)$ to conclude the desired inequality? How to relate that to the latter part of the question including the inequality over the defined space of functions?
 A: Let $v\in C^1_0(U)$ be arbitrary and not identically zero. Define $$ i(\tau) =J(u+\tau v)$$ with $$J(w) = \int_U \frac12 \vert \nabla w \vert^2 +f(w) \, dx.$$ As in the derivation of the Euler-Lagrange equation, we can calculate $$ i'(\tau) = \int_U \nabla u \cdot \nabla v + \tau \vert \nabla v\vert^2 +f'(u+\tau v) v \, dx .$$ Since $u$ satisfies $-\Delta u +f'(u) =0$ in $U$, we have that $$ i'(0) =    \int_U \nabla u \cdot \nabla v  +f'(u) v \, dx = \int_U -v\Delta u+f'(u) v =0.$$ Hence, $0$ is a critical point of $i$.
Now let's calculate the second derivative of $i$. We find that $$i''(\tau) = \int_U \vert \nabla v \vert^2 +f''(u+\tau v)v^2 \, d x. $$ Since $f$ is convex, $f'' \geqslant 0$ in $\mathbb R$. Hence, $$ i''(\tau) \geqslant\int_U \vert \nabla v \vert^2  \, d x> 0$$ where the second inequality is strict since $v$ is not identically zero. This implies that $i$ is a strictly convex function on $\mathbb R$. It is well known that strictly convex functions can have at most one critical point and that this critical point (if it exists) is a global minimum. Since $0$ is a critical point of $i$, we have $$ J(u) =i(0) < i(\tau)= J(u+\tau v)$$ for all $\tau \in \mathbb R\setminus \{0\}$, $v \in C^1(U)$, $v \not\equiv 0$.
Finally, let $w \in C^1_0(U)$ be an arbitrary function. If $w \equiv u$ then of course $J(u)=J(w)$. If $w \not\equiv u$ then setting $\tau =1$ and $v=w-u$ in the above inequality gives $$J(u) < J(u+(w-v))=J(w) $$ as required.
