Minimizer on Sobolev space $H^1 (\Omega)$. I am trying to go to the next level in the calculus of variation of parameters, which is the minimization on Sobolev spaces. I come a cross this problem in which I stuck for how to attack it, could you please show me how to solve it.
For a bounded connected domains $\Omega \subset \mathbb R^n$ with Lipschitz boundary, let $g \in L^2 (\Omega)$ and define the functional $J$ and function space $X$ by
$$J[u] = \int_\Omega \left\{ \frac{1}{2} \left| \nabla u(x) \right|^2 - g(x) u(x) \right\} dx,\quad X = \left\{ u \in H^1(\Omega); \int_\Omega u(x) dx=0 \right\}.$$
Show that the minimization problem $\inf_{u \in X} J[u]$ admits a unique minimizer $\overline u \in X$.
My try
Since $\Omega$ is bounded with Lischitz boundary, then (by Trace theorem) there exists a bounded linear operator $T: H^1(\Omega) \to L^p (\partial \Omega)$ such that
\begin{align}
    T u &= u\big|_{\partial \Omega}  &u \in H^1(\Omega) \cap C(\overline{\Omega})\\
    \| Tu\|_{L^p(\partial \Omega)} &\leq c(\Omega) \|u\|_{H^1 (\Omega)}), & u \in H^1(\Omega).
\end{align}
where $c$ a constant depends on $\Omega$.

First note that, by Poincaré inequality (as $\Omega$ is bounded),
$$\|u\|_{L^2(\Omega)} \le K\|\nabla u\|_{L^2(\Omega)}$$
so that the norms
$$u \mapsto \|u\|_{L^2(\Omega)} + \|\nabla u\|_{L^2(\Omega)} \quad \text{and} \quad u \mapsto \|\nabla u\|_{L^2(\Omega)}$$
are equivalent on $X$ (and on $H^1(\Omega)$) so that we can choose the inner product in $X$ as
$$(u, v) = \int_\Omega \nabla u \cdot \nabla v.$$
Therefore,
$$J[u] = \frac{1}{2}\|u\|^2_X - \int gu.$$
Now let us show that the minimum of $J$ is well-defined. We have, by Hölder inequality,
\begin{align}
J[u] &\ge \frac{1}{2}\|u\|^2_X - \|g\|_{L^2}\|u\|_{L^2}\\
&\ge  \frac{1}{2}(\|u\|_X - \|g\|_{L^2})^2 - \frac{1}{2}\|g\|_{L^2}\\
&\ge - \frac{1}{2}\|g\|_{L^2}.
\end{align}
Now let us consider $m = \inf_{X}J[u]$ and $(u_n)_n \subset X$ such that
$$J[u_n] = m + \varepsilon_n \quad \text{with } \lim_n \varepsilon_n = 0.$$
By the paralllelogram law, we have
\begin{align}
\left\|\frac{u_n - u_m}{2}\right\|_X^2 &= \frac{1}{2}\|u_n\|_X^2 + \frac{1}{2}\|u_m\|_X^2 - \frac{1}{2}\left\|\frac{u_n + u_m}{2}\right\|_X^2\\
&= J[u_n] + J[u_m] - 2J[u_n + u_m]\\
&\le \varepsilon_n + \varepsilon_m
\end{align}
so that $(u_n)_n$ is a Cauchy sequence in the Hilbert space $X$ (exercise: show that $X$ with this norm is an Hilbert space), hence there is $u \in X$ such that $\lim_n u_n = u$.
Now let us consider $t \in \mathbb R$ and $v \in X$. We have
\begin{align}
m \le J[u + tv] &= \frac{1}{2}\|u\|_X^2 - \int_\Omega gu + t(u, v) + \frac{t^2}{2}\|v\|^2_X - t\int_\Omega g v\\
&= J[u] + t(u, v) + \frac{t^2}{2}\|v\|^2_X - t\int_\Omega g v.
\end{align}
This implies,
$$(u, v) + \frac{t}{2}\|v\|^2_X - \int_\Omega g v\ge 0 \quad \forall t \in \mathbb R, \forall v \in X.$$
Therefore,
$$(u, v) = \int_\Omega gv$$
for all $v \in X$. This gives us uniqueness by considering $u_1, u_2 \in X$ two minimizers and setting $u = u_1 - u_2$ and $v = u_1 - u_2$ (details left as an exercise).
In fact this proof in more general: it shows that for an Hilbert space $X$ and a continuous linear map $\ell: H \to \mathbb R$, there exists a unique minimizer $u \in X$ to the functional
$$J[v] = \frac{1}{2}\|v\|^2_X - \ell(v)$$
and it satisfies
$$(u, v)_X = \ell(v).$$
