Solution (source code)

= Solution

For every real $a$, the <gauge transform> $w_a=e^{ia\psi}w$ has the same $L^2$ norm as $w$. Since $\|w\|_2\leq\|Q\|_2$, the variational bound from part 1 gives $E(w_a)\geq0$. Expanding its gradient gives
$$
E(w_a)=E(w)+aI+\frac{a^2}{2}A,
$$
where
$$
I=\operatorname{Im}\int\overline w\,\nabla w\mathbin{\cdot}\nabla\psi,
\qquad
A=\int|\nabla\psi|^2|w|^2.
$$
This quadratic polynomial is nonnegative for every $a\in\mathbb R$, so its discriminant is nonpositive. Therefore
$$
I^2\leq2E(w)A,
$$
which is the desired estimate.