PDE and Minimal Energy Here is an exercise taken from Strauss' book (it is Problem 11.3.2.)
Take a smooth function $f$ defined on some domain $D$ and a continuous function $g$ defined on $\partial D$. Suppose $u$ is a smooth function on a domain $D$ which minimizes the "energy",
$$ E(u) = \tfrac{1}{2} \int_D |\nabla u|^2 ~ dx - \int_D fu ~ dx - \oint_{\partial D} gu ~ ds $$
with the condition that $\int_D u^2 ~ dx = 1 $ then $u$ must solve the PDE problem that,
$$\tag{1} -\Delta u = f \text{ on } D\hspace{10mm} \frac{\partial u}{\partial n} = g \text{ on }\partial D$$
I looked at the solution to this problem because it was not working out for me, and the solution manual for the book said, to pick an arbitrary smooth function $v$ defined on $D$ and consider the perturbed quantity $E(u+\varepsilon v)$. The solution manual argues that because the minimum is achieved at $\varepsilon = 0$ it means that the derivative of the perturbed expression must be zero. But I have a problem with this reasoning. The requirement for the minimum energy problem is that $\int_D (u+\varepsilon v)^2 ~ dx = 1$. That is the required condition that needs to be satisfied. Therefore, the solution in the manual looks wrong. How do you fix it?
--
Edit: I have include the actual question from the text itself,

 A: You are correct that the test functions $v$ cannot be arbitrary. Indeed, let $u_\epsilon$ be a family of functions so that $u_0 = u$ and
$$\int_D u_\epsilon^2 = 1.$$
Taking derivative with respect to $\epsilon$ and sets $\epsilon = 0$ give
$$ \int_D uv dx = 0,$$
where $v = \partial_\epsilon |_{\epsilon = 0} u_\epsilon$. Also
$$\tag{2} 0 = \frac{d}{d\epsilon} E(u_\epsilon)\bigg|_{\epsilon =0 } = -\int_D (\Delta u +f) v + \int_{\partial D} \left(\frac{\partial u}{\partial n} - g \right)v dS. $$
So you have (see remark 2)
$$\tag{3} -\Delta u = f + \lambda u, \ \ \ \frac{\partial u}{\partial n} = g.$$
Remark Note that the Neumann boundary problem (1) don't always have a solution: for example, take $f = 1$ and $g=1$. Then $\Delta  u =-1$ in $D$. Thus $u$ has no interior minimum (since any interior minimum $x_0\in D$ has $\Delta u(x_0) \ge 0$). Let $y\in \partial D$ be where $u$ attains it's minimum. Then $u(x) \ge u(y)$ for all $x\in D$, which implies
$$\frac{\partial u }{\partial n} (y) \le 0$$
(since $n$ is pointing outward). Thus $\frac{\partial u }{\partial n}=1$ is impossible. Together with the fact (that you need more analysis to prove) that the minimization problem always has a solution $u$, there are cases that $\lambda$ is really non-zero.
Remark 2 first we show that
$$ \tag{4} \int_D (\Delta u + f) w dx = 0$$
for all $w$ such that $\int _D uw dx = 0$. To see this, assume that $w$ satisfies $\int_D uw =0$. Then let $v_n$ be a sequence so that $v_n$ is zero on $\partial D$, $v_n \to w$ in $L^2 (D)$ and $\int_D uv_n = 0$. By (2) we have
$$\int_D (-\Delta u + f) v_n = 0$$
taking $n \to \infty$ we obtain (4). Together with (2), we have
$$ \oint _{\partial D} \left( \frac{\partial u}{\partial n} - g\right) v dS=0$$
for all $v$ with $\int uv = 0$. This implies
$$\frac{\partial u}{\partial n} =g \ \ \ \text{ on } \partial D.$$
Lastly, since $\| u\|_2 =1$, write
$$ -\Delta u - f = \langle (-\Delta u -f), u\rangle _{L^2(D)} u + p,$$
where $p\in u^\perp$. (4) implies that $p = 0$ (say, by choosing $v=p$ in (4)). Thus
$$-\Delta u -f = \lambda u$$
with $\lambda  = \langle (-\Delta u -f), u\rangle _{L^2(D)}$.
A: I figured out the solution in case someone is interested. The problem is indeed rather straightforward. However, the way the problem is stated in the Walter Strauss book is incorrect. The problem also includes a condition that causes further confusion. Hopefully this answer will help clarify this problem so that any future students from the Strauss book would see it resolved.

Let us start with the correct version of the problem.
Take a smooth function $f$ defined on some domain $D$ and a continuous function $g$ defined on $\partial D$. The function $f$ and $g$ satisfy the condition that,
$$ \int_D f ~ dx + \oint_{\partial D} g ~ ds = 0 \hspace{10mm} (1) $$
Suppose $u$ is a smooth function on a domain $D$ which minimizes the "energy",
$$ E(u) = \tfrac{1}{2} \int_D |\nabla u|^2 ~ dx - \int_D fu ~ dx - \oint_{\partial D} gu ~ ds $$
The problem is to show that $u$ must solve the PDE problem,
$$ -\Delta u = f \text{ on } D\hspace{10mm} \frac{\partial u}{\partial n} = g \text{ on }\partial D \hspace{10mm} (2)$$

Before we proceed with the solution we should note that the normalization condition $$\int_D u^2 ~ dx = 1 $$ is not part of the problem. This is a mistake. It should have not been included in the problem whatsoever.
It will also be helpful to say something about the condition in $(1)$. From the way the problem is stated you might think that you need to use $(1)$ somewhere in the solution of the problem. This is not the case at all. Instead condition $(1)$ is a necessary requirement for the PDE problem to have a solution as Rem helpfully pointed out in the comments. An interesting question to ask is whether $(1)$ is a sufficient condition for the PDE problem, or for that matter, for the minimization problem, to have a solution. However, that is a different discussion.
The problem in Strauss's book is to simply accepted the fact that the minimization problem has a solution and argue that is leads to a solution of the PDE problem. Condition $(1)$ is just a necessity from the PDE being satisfied.

Let us begin by showing why $(1)$ is a necessary condition.
We start with Green's theorem,
$$ \int_D \triangle u ~ dx = \oint_{\partial D} \frac{\partial u}{\partial n} ~ ds $$
Since $\triangle u = -f$ and $\frac{\partial u}{\partial n} = g$ we substitute and get that $-\int_D f ~ dx = \oint_{\partial D} g ~ ds$. Thus, condition $(1)$ must be forced in order to have a solution to the minimization of the energy.
Again whether $(1)$ is sufficient for energy minimization is a separate discussion entirely and Strauss only wants you to accept that it has a solution.

We accept that there is a minimal energy $u$. Now pick any smooth function $v$ which is defined over this domain $D$. Let $\varepsilon \in \mathbb{R}$ and consider the perturbed function $u + \varepsilon v$. Since $u$ is the minimal energy we have that $E(u+\varepsilon v) \leq E(u)$ for every $\varepsilon \in \mathbb{R}$. If we expand $E(u+\varepsilon v)$ we will notice it is a quadratic in terms of $\varepsilon$. Therefore, its derivative at $\varepsilon = 0$ must vanish since the minimum occurs at $\varepsilon = 0$. If we calculate this derivative we find that,
$$  \int_D (\nabla u \cdot \nabla v) ~ dx - \int_D fv - \int_{\partial D} gv = 0$$
By Green's theorem,
$$ \int_D (\nabla u \cdot \nabla v) ~ dx = \int_{\partial D} \frac{\partial u}{\partial n} \cdot v ~ ds - \int_D \triangle u \cdot v ~ dx $$
If we substitute that into the previous equation we find,
$$  \int_D (\triangle u + f) \cdot v ~ dx = \oint_{\partial D} \left( \frac{\partial u}{\partial n} - g \right) \cdot v ~ ds \hspace{10mm} (3)$$
The equation $(3)$ is true for any test function $v$. If we pick $v$ to be a test function which vanishes on the boundary of $D$ then we find that,
$$ \int_D (\triangle u + f) \cdot v ~ dx = 0 $$
This is true for all test functions which vanish on the boundary. In particular it forces $\triangle u + f$ to be identically zero throughout $D$. Therefore, $-\triangle u = f$ and we proved that the PDE condition is satisfied.
It remains to show why the Neumann condition is satisfied. To that end we go back to $(3)$ and use the fact that was already established that $\triangle u + f = 0$. Therefore, we are left with the equation that,
$$ \oint_{\partial D} \left(\frac{\partial u}{\partial n} - g\right) \cdot v ~ ds = 0 $$
This is true for all test functions which are defined on the boundary of $D$. Hence it forces that $\frac{\partial u}{\partial n} - g = 0$ also, and so the Neumann condition is also satisfied.

The interesting remaining question (not part of the book's problem) is whether condition $(1)$ is also a sufficient condition to have minimal energy? Perhaps, somebody who is well-versed in these variational methods might enlighten us.
