[proofplan]
We prove necessity by restricting the functional to the line segment from the minimizer $u$ to an arbitrary admissible point $v\in K$. Convexity of $K$ makes the whole segment admissible, so the one-variable restriction has a minimum at the endpoint $0$, forcing its right derivative there to be nonnegative. For sufficiency under convexity of $I$, we prove the differentiable convex subgradient inequality directly from the definition of convexity and the Gateaux derivative, then combine it with the assumed variational inequality.
[/proofplan]
[step:Restrict the functional to each feasible segment and take the endpoint derivative]
Fix $v\in K$, and define $h:=v-u\in X$. Since $K$ is convex and $u,v\in K$, for every $t\in[0,1]$ the point
\begin{align*}
u+t h=(1-t)u+t v
\end{align*}
belongs to $K$.
Define the one-variable map
\begin{align*}
\phi:[0,1]&\to\mathbb R
\end{align*}
\begin{align*}
t&\mapsto I[u+t h].
\end{align*}
Because $u$ minimizes $I$ over $K$ and $u+t h\in K$ for every $t\in[0,1]$, we have
\begin{align*}
\phi(t)\ge \phi(0)
\end{align*}
for every $t\in[0,1]$. Hence, for every $t\in(0,1]$,
\begin{align*}
\frac{\phi(t)-\phi(0)}{t}\ge 0.
\end{align*}
Since $I$ is Gateaux differentiable at $u$ in the direction $h$, the right-hand limit of these difference quotients exists and equals $I'[u](h)$. Therefore
\begin{align*}
I'[u](v-u)=I'[u](h)=\lim_{t\downarrow 0}\frac{I[u+t h]-I[u]}{t}\ge 0.
\end{align*}
Because $v\in K$ was arbitrary, the variational inequality holds for every $v\in K$.
[guided]
Fix an arbitrary admissible comparison point $v\in K$. The direction from the candidate minimizer $u$ to this point is
\begin{align*}
h:=v-u\in X.
\end{align*}
The reason for introducing $h$ is that the Gateaux derivative $I'[u](h)$ measures the first-order change of $I$ at $u$ in precisely this feasible direction.
We must first check that moving from $u$ toward $v$ stays inside the admissible set. Since $K$ is convex and $u,v\in K$, every convex combination of $u$ and $v$ lies in $K$. For each $t\in[0,1]$,
\begin{align*}
u+t h=u+t(v-u)=(1-t)u+t v,
\end{align*}
so $u+t h\in K$.
Now define the one-variable restriction of $I$ to this feasible segment:
\begin{align*}
\phi:[0,1]&\to\mathbb R
\end{align*}
\begin{align*}
t&\mapsto I[u+t h].
\end{align*}
This map converts the constrained problem on $K$ into a one-dimensional endpoint problem. Since $u$ minimizes $I$ over $K$, and since every $u+t h$ with $t\in[0,1]$ is still in $K$, we have
\begin{align*}
\phi(t)=I[u+t h]\ge I[u]=\phi(0)
\end{align*}
for every $t\in[0,1]$. Therefore $t=0$ is a minimum of $\phi$ on the interval $[0,1]$.
For each $t\in(0,1]$, division by the positive number $t$ preserves the inequality:
\begin{align*}
\frac{\phi(t)-\phi(0)}{t}\ge 0.
\end{align*}
By the definition of Gateaux differentiability of $I$ at $u$ in the direction $h$, the [directional derivative](/page/Directional%20Derivative) is
\begin{align*}
I'[u](h)=\lim_{t\to 0}\frac{I[u+t h]-I[u]}{t}.
\end{align*}
In particular, the right-hand limit exists and has the same value:
\begin{align*}
I'[u](h)=\lim_{t\downarrow 0}\frac{I[u+t h]-I[u]}{t}.
\end{align*}
Every quotient in this right-hand limit is nonnegative, so the limit is nonnegative:
\begin{align*}
I'[u](v-u)=I'[u](h)\ge 0.
\end{align*}
Since the point $v\in K$ was arbitrary, this proves the first-order necessary condition for every admissible comparison point.
[/guided]
[/step]
[step:Derive the convex subgradient inequality from one-dimensional convexity]
Assume now that $I$ is convex. Fix $w\in X$, and define $k:=w-u\in X$. For every $s\in(0,1]$, convexity of $I$ gives
\begin{align*}
I[u+s k]=I[(1-s)u+s w]\le (1-s)I[u]+s I[w].
\end{align*}
Rearranging this inequality yields
\begin{align*}
\frac{I[u+s k]-I[u]}{s}\le I[w]-I[u].
\end{align*}
Taking the limit as $s\downarrow 0$ and using Gateaux differentiability at $u$ in the direction $k$, we obtain
\begin{align*}
I'[u](w-u)\le I[w]-I[u].
\end{align*}
Equivalently,
\begin{align*}
I[w]\ge I[u]+I'[u](w-u)
\end{align*}
for every $w\in X$.
[/step]
[step:Combine the subgradient inequality with the variational inequality]
Assume that $I$ is convex and that $u\in K$ satisfies
\begin{align*}
I'[u](v-u)\ge 0
\end{align*}
for every $v\in K$. Applying the subgradient inequality from the previous step with $w:=v$ gives
\begin{align*}
I[v]\ge I[u]+I'[u](v-u)
\end{align*}
for every $v\in K$. The assumed variational inequality then implies
\begin{align*}
I[v]\ge I[u]
\end{align*}
for every $v\in K$. Hence $u$ minimizes $I$ over $K$, completing the proof of the converse and therefore of the theorem.
[/step]