[proofplan]
We prove the two implications separately. If $v^*$ minimizes the distance from $f$ to $V$, then moving from $v^*$ along any direction $v \in V$ gives a one-variable quadratic function whose minimum occurs at the origin; this forces the real part of $(f-v^*,v)_H$ to vanish, and in the complex case applying the same argument to $iv$ also forces the imaginary part to vanish. Conversely, if the residual $f-v^*$ is orthogonal to $V$, then the squared distance to any other $v \in V$ decomposes into an orthogonal sum, so it is at least the squared distance to $v^*$.
[/proofplan]
[step:Use minimality along affine lines in $V$ to force vanishing real parts]
Assume that $v^*$ is a best approximation to $f$ from $V$. Define the residual $r \in H$ by $r := f-v^*$. Let $v \in V$ be arbitrary. Since $V$ is a linear subspace and $v^* \in V$, for every real number $t \in \mathbb{R}$ the vector $v^*+tv$ belongs to $V$. By minimality of $v^*$,
\begin{align*}
\|r\|_H^2 = \|f-v^*\|_H^2 \leq \|f-(v^*+tv)\|_H^2 = \|r-tv\|_H^2.
\end{align*}
Expanding the Hilbert norm using the [inner product](/page/Inner%20Product), with linearity in the first argument and conjugate-linearity in the second in the complex case, gives
\begin{align*}
\|r-tv\|_H^2 = \|r\|_H^2 - 2t\,\operatorname{Re}(r,v)_H + t^2\|v\|_H^2.
\end{align*}
Therefore
\begin{align*}
0 \leq -2t\,\operatorname{Re}(r,v)_H + t^2\|v\|_H^2 \quad \text{for every } t \in \mathbb{R}.
\end{align*}
If $\operatorname{Re}(r,v)_H > 0$, choosing a sufficiently small positive $t$ makes the right-hand side negative. If $\operatorname{Re}(r,v)_H < 0$, choosing a sufficiently small negative $t$ makes the right-hand side negative. Hence
\begin{align*}
\operatorname{Re}(r,v)_H = 0.
\end{align*}
[guided]
Assume that $v^*$ is a best approximation to $f$ from $V$. The residual is the error vector left after approximating $f$ by $v^*$, so define $r \in H$ by
\begin{align*}
r := f-v^*.
\end{align*}
To test whether this residual is orthogonal to $V$, fix an arbitrary direction $v \in V$. Because $V$ is a linear subspace, every point of the affine line through $v^*$ in the direction $v$ remains in $V$:
\begin{align*}
v^*+tv \in V \quad \text{for every } t \in \mathbb{R}.
\end{align*}
Since $v^*$ is assumed to minimize the distance from $f$ to all elements of $V$, it must in particular minimize the distance along this line. Thus
\begin{align*}
\|r\|_H^2 = \|f-v^*\|_H^2 \leq \|f-(v^*+tv)\|_H^2 = \|r-tv\|_H^2
\end{align*}
for every real number $t$.
Now expand the right-hand side. The inner product is linear in the first argument, and in a complex [Hilbert space](/page/Hilbert%20Space) it is conjugate-linear in the second argument. Since $t$ is real, this gives
\begin{align*}
\|r-tv\|_H^2 = (r-tv,r-tv)_H = \|r\|_H^2 - t(r,v)_H - t(v,r)_H + t^2\|v\|_H^2.
\end{align*}
Because $(v,r)_H = \overline{(r,v)_H}$ in a complex Hilbert space, and the same identity is valid over the real field, the middle terms combine as
\begin{align*}
-t(r,v)_H - t(v,r)_H = -2t\,\operatorname{Re}(r,v)_H.
\end{align*}
Therefore
\begin{align*}
\|r-tv\|_H^2 = \|r\|_H^2 - 2t\,\operatorname{Re}(r,v)_H + t^2\|v\|_H^2.
\end{align*}
Substituting this expansion into the minimality inequality and subtracting $\|r\|_H^2$ gives
\begin{align*}
0 \leq -2t\,\operatorname{Re}(r,v)_H + t^2\|v\|_H^2 \quad \text{for every } t \in \mathbb{R}.
\end{align*}
This is a quadratic polynomial in the real variable $t$ which is nonnegative for all real $t$ and has no constant term. If $\operatorname{Re}(r,v)_H$ were positive, then the linear term would be negative for all sufficiently small positive $t$, while the quadratic term would be too small to compensate. If $\operatorname{Re}(r,v)_H$ were negative, the same contradiction would occur for all sufficiently small negative $t$. Hence the linear coefficient must vanish:
\begin{align*}
\operatorname{Re}(r,v)_H = 0.
\end{align*}
[/guided]
[/step]
[step:Recover full orthogonality from the real part condition]
We have shown that
\begin{align*}
\operatorname{Re}(r,v)_H = 0 \quad \text{for every } v \in V.
\end{align*}
If $H$ is a real Hilbert space, this is exactly $(r,v)_H=0$ for every $v \in V$.
If $H$ is a complex Hilbert space, then for every $v \in V$ the vector $iv$ belongs to $V$. Applying the already proved real-part condition to $iv$ gives
\begin{align*}
0 = \operatorname{Re}(r,iv)_H = \operatorname{Re}(-i(r,v)_H) = \operatorname{Im}(r,v)_H.
\end{align*}
Together with $\operatorname{Re}(r,v)_H=0$, this gives $(r,v)_H=0$. Since $v \in V$ was arbitrary,
\begin{align*}
(f-v^*,v)_H = 0 \quad \text{for every } v \in V.
\end{align*}
[/step]
[step:Use orthogonality to compare every competitor with $v^*$]
Conversely, assume that
\begin{align*}
(f-v^*,w)_H = 0 \quad \text{for every } w \in V.
\end{align*}
Let $v \in V$ be arbitrary. Define $r \in H$ by $r := f-v^*$ and define $h \in V$ by $h := v^*-v$. Since $V$ is a linear subspace and $v^*,v \in V$, we have $h \in V$. Hence the orthogonality assumption gives
\begin{align*}
(r,h)_H = 0.
\end{align*}
Since $f-v = r+h$, expanding the squared norm gives
\begin{align*}
\|f-v\|_H^2 = \|r+h\|_H^2 = \|r\|_H^2 + 2\operatorname{Re}(r,h)_H + \|h\|_H^2.
\end{align*}
Using $(r,h)_H=0$, we obtain
\begin{align*}
\|f-v\|_H^2 = \|r\|_H^2 + \|h\|_H^2 \geq \|r\|_H^2 = \|f-v^*\|_H^2.
\end{align*}
Since norms are nonnegative, taking square roots yields
\begin{align*}
\|f-v^*\|_H \leq \|f-v\|_H.
\end{align*}
Because $v \in V$ was arbitrary, $v^*$ is a best approximation to $f$ from $V$.
[/step]