[proofplan]
Fix an admissible direction $v \in H^1_0(U)$ and restrict the functional $I$ to the affine line $u+\varepsilon v$. Because the Dirichlet energy is quadratic in $\nabla u$ and the forcing term is linear in $u$, this one-variable function is a quadratic polynomial in $\varepsilon$. Its derivative at $\varepsilon=0$ is exactly the weak residual against $v$, so vanishing of all first variations is equivalent to the weak formulation of $-\Delta u=f$ with zero boundary condition encoded by $H^1_0(U)$.
[/proofplan]
[step:Verify that the energy and first variation terms are finite]
Let $L^2(U)$ denote the space $L^2(U, \mathcal{B}(U), \mathcal{L}^n)$ of square-integrable real-valued functions on $U$, and let $L^1(U)$ denote the space $L^1(U, \mathcal{B}(U), \mathcal{L}^n)$ of integrable real-valued functions on $U$. Let $L^2(U;\mathbb{R}^n)$ denote the space of measurable maps $G:U \to \mathbb{R}^n$ whose components belong to $L^2(U)$. Let $H^1(U)$ denote the [Sobolev space](/page/Sobolev%20Space) of functions $w \in L^2(U)$ whose weak first partial derivatives $\partial_{x_i}w$ belong to $L^2(U)$ for $1 \leq i \leq n$, and let $H^1_0(U)$ denote the closure of $C_c^\infty(U)$ in the $H^1(U)$ norm, where $C_c^\infty(U)$ is the space of smooth compactly supported functions $\varphi:U \to \mathbb{R}$.
Let $u \in H^1_0(U)$ and let $v \in H^1_0(U)$. By definition of $H^1_0(U) \subset H^1(U)$, the functions $u$, $v$, and $f$ belong to $L^2(U)$, and the weak gradients $\nabla u$ and $\nabla v$ belong to $L^2(U;\mathbb{R}^n)$.
The energy term is finite because $|\nabla u|^2 \in L^1(U)$. The forcing term is finite since
\begin{align*}
|f(x)u(x)| \leq \frac{1}{2}|f(x)|^2 + \frac{1}{2}|u(x)|^2
\end{align*}
for $\mathcal{L}^n$-a.e. $x \in U$, and the right-hand side is integrable on $U$. Thus $I[u]$ is well-defined. The same argument applies to $u+\varepsilon v \in H^1_0(U)$ for every $\varepsilon \in \mathbb{R}$.
Similarly,
\begin{align*}
|\nabla u(x)\cdot \nabla v(x)| \leq |\nabla u(x)|\,|\nabla v(x)| \leq \frac{1}{2}|\nabla u(x)|^2 + \frac{1}{2}|\nabla v(x)|^2
\end{align*}
for $\mathcal{L}^n$-a.e. $x \in U$, and
\begin{align*}
|f(x)v(x)| \leq \frac{1}{2}|f(x)|^2 + \frac{1}{2}|v(x)|^2.
\end{align*}
Hence both integrals appearing in the weak formulation are finite.
[/step]
[step:Compute the directional derivative along an arbitrary admissible direction]
Fix $v \in H^1_0(U)$ and define the one-variable function
\begin{align*}
\Phi_v: \mathbb{R} \to \mathbb{R}, \quad \Phi_v(\varepsilon) := I[u+\varepsilon v].
\end{align*}
Since $H^1_0(U)$ is a [vector space](/page/Vector%20Space), $u+\varepsilon v \in H^1_0(U)$ for every $\varepsilon \in \mathbb{R}$. Linearity of weak derivatives gives
\begin{align*}
\nabla(u+\varepsilon v)=\nabla u+\varepsilon \nabla v
\end{align*}
in $L^2(U;\mathbb{R}^n)$. Therefore
\begin{align*}
|\nabla(u+\varepsilon v)|^2 = |\nabla u|^2 + 2\varepsilon \nabla u\cdot \nabla v + \varepsilon^2 |\nabla v|^2
\end{align*}
for $\mathcal{L}^n$-a.e. $x \in U$, and
\begin{align*}
f(u+\varepsilon v)=fu+\varepsilon fv.
\end{align*}
Substituting these identities into the definition of $I$ gives
\begin{align*}
\Phi_v(\varepsilon)=I[u]+\varepsilon\left(\int_U \nabla u\cdot \nabla v\,d\mathcal{L}^n(x)-\int_U fv\,d\mathcal{L}^n(x)\right)+\frac{\varepsilon^2}{2}\int_U |\nabla v|^2\,d\mathcal{L}^n(x).
\end{align*}
Thus $\Phi_v$ is a quadratic polynomial in $\varepsilon$, so it is differentiable at $0$, and
\begin{align*}
\Phi_v'(0)=\int_U \nabla u\cdot \nabla v\,d\mathcal{L}^n(x)-\int_U fv\,d\mathcal{L}^n(x).
\end{align*}
[guided]
Fix an admissible variation $v \in H^1_0(U)$. To test whether $u$ is critical, we do not vary $u$ in all possible ways at once; we restrict the functional to the affine line through $u$ in the direction $v$. Define
\begin{align*}
\Phi_v: \mathbb{R} \to \mathbb{R}, \quad \Phi_v(\varepsilon) := I[u+\varepsilon v].
\end{align*}
The expression is meaningful because $H^1_0(U)$ is closed under addition and scalar multiplication, so $u+\varepsilon v \in H^1_0(U)$ for every $\varepsilon \in \mathbb{R}$.
The [weak derivative](/page/Weak%20Derivative) is linear. Therefore the weak gradient of the varied function is
\begin{align*}
\nabla(u+\varepsilon v)=\nabla u+\varepsilon \nabla v
\end{align*}
in $L^2(U;\mathbb{R}^n)$. The point of this computation is that the energy term is quadratic in the gradient. Expanding the Euclidean square gives
\begin{align*}
|\nabla(u+\varepsilon v)|^2 = |\nabla u|^2 + 2\varepsilon \nabla u\cdot \nabla v + \varepsilon^2 |\nabla v|^2
\end{align*}
for $\mathcal{L}^n$-a.e. $x \in U$. The forcing term is linear in the function, so
\begin{align*}
f(u+\varepsilon v)=fu+\varepsilon fv.
\end{align*}
Substituting both identities into the definition of $I$ yields
\begin{align*}
\Phi_v(\varepsilon)=I[u]+\varepsilon\left(\int_U \nabla u\cdot \nabla v\,d\mathcal{L}^n(x)-\int_U fv\,d\mathcal{L}^n(x)\right)+\frac{\varepsilon^2}{2}\int_U |\nabla v|^2\,d\mathcal{L}^n(x).
\end{align*}
This is a genuine quadratic polynomial in the real variable $\varepsilon$; all coefficients are finite by the previous step. Hence $\Phi_v$ is differentiable at $\varepsilon=0$, and differentiating the polynomial gives
\begin{align*}
\Phi_v'(0)=\int_U \nabla u\cdot \nabla v\,d\mathcal{L}^n(x)-\int_U fv\,d\mathcal{L}^n(x).
\end{align*}
This formula identifies the first variation of the energy with the weak residual of the equation $-\Delta u=f$ tested against $v$.
[/guided]
[/step]
[step:Show that criticality implies the weak formulation]
Assume that $u$ is a critical point of $I$ in the stated sense. Let $v \in H^1_0(U)$ be arbitrary. By the [first variation formula](/theorems/2728) just computed,
\begin{align*}
0=\frac{d}{d\varepsilon}\Big|_{\varepsilon=0}I[u+\varepsilon v]=\int_U \nabla u\cdot \nabla v\,d\mathcal{L}^n(x)-\int_U fv\,d\mathcal{L}^n(x).
\end{align*}
Rearranging gives
\begin{align*}
\int_U \nabla u\cdot \nabla v\,d\mathcal{L}^n(x)=\int_U fv\,d\mathcal{L}^n(x).
\end{align*}
Since $v \in H^1_0(U)$ was arbitrary, this is exactly the homogeneous Dirichlet weak formulation of $-\Delta u=f$ in $U$.
[/step]
[step:Show that the weak formulation implies criticality]
Conversely, assume that $u \in H^1_0(U)$ satisfies
\begin{align*}
\int_U \nabla u\cdot \nabla v\,d\mathcal{L}^n(x)=\int_U fv\,d\mathcal{L}^n(x)
\end{align*}
for every $v \in H^1_0(U)$. Fix such a $v$. The first variation formula gives
\begin{align*}
\frac{d}{d\varepsilon}\Big|_{\varepsilon=0}I[u+\varepsilon v]=\int_U \nabla u\cdot \nabla v\,d\mathcal{L}^n(x)-\int_U fv\,d\mathcal{L}^n(x)=0.
\end{align*}
Since this holds for every admissible direction $v \in H^1_0(U)$, $u$ is a critical point of $I$ in the stated sense. This proves the equivalence.
[/step]