[proofplan]
We prove that the residual $v-w_0$ is orthogonal to every vector of $W$. Then, for an arbitrary competitor $w \in W$, the vector $v-w$ decomposes as the orthogonal sum of $v-w_0$ and $w_0-w$. Expanding the squared norm of this orthogonal sum gives a nonnegative error term $|w_0-w|^2$, so $w_0$ minimizes the squared distance. Equality forces $w=w_0$, which proves uniqueness.
[/proofplan]
[step:Verify that the proposed vector belongs to $W$]
Since each $e_i$ lies in $W$ and $W$ is a vector subspace of $V$, the finite linear combination $w_0 = \sum_{i=1}^{k} (v,e_i)_V e_i$ belongs to $W$. If $k=0$, the sum is empty and equals $0$, which belongs to $W=\{0\}$.
[/step]
[step:Show that the residual is orthogonal to the basis of $W$]
Let $r := v-w_0$ denote the residual vector in $V$. Fix an index $j \in \{1,\ldots,k\}$. Since the [inner product](/page/Inner%20Product) is linear in the first variable and $(e_i,e_j)_V=0$ for $i \ne j$ while $(e_j,e_j)_V=1$, we compute
\begin{align*}
(w_0,e_j)_V = \sum_{i=1}^{k} (v,e_i)_V (e_i,e_j)_V = (v,e_j)_V
\end{align*}
Therefore
\begin{align*}
(r,e_j)_V = (v-w_0,e_j)_V = (v,e_j)_V - (w_0,e_j)_V = 0
\end{align*}
Thus $r$ is orthogonal to every basis vector $e_j$.
[guided]
The purpose of the coefficient formula is exactly to make the residual perpendicular to each basis direction. Define the residual vector $r \in V$ by $r := v-w_0$. We check orthogonality against a fixed basis vector $e_j$, where $j \in \{1,\ldots,k\}$. Because Androma's inner product convention is linear in the first variable, scalar coefficients in the first slot pull out without conjugation. To make that calculation readable, we write it as a displayed computation:
\begin{align*}
(w_0,e_j)_V = \left(\sum_{i=1}^{k} (v,e_i)_V e_i,e_j\right)_V = \sum_{i=1}^{k} (v,e_i)_V (e_i,e_j)_V = (v,e_j)_V
\end{align*}
The basis is orthonormal, so $(e_i,e_j)_V=0$ when $i \ne j$ and $(e_j,e_j)_V=1$. Subtracting this identity from $(v,e_j)_V$ gives another displayed computation:
\begin{align*}
(r,e_j)_V = (v-w_0,e_j)_V = (v,e_j)_V - (w_0,e_j)_V = 0
\end{align*}
So $v-w_0$ is orthogonal to every vector in the chosen [orthonormal basis](/page/Orthonormal%20Basis) of $W$.
[/guided]
[/step]
[step:Extend orthogonality from the basis to all of $W$]
Let $z \in W$. Since $(e_1,\ldots,e_k)$ is a basis of $W$, there are scalars $a_1,\ldots,a_k$ in the scalar field of $V$ such that $z = \sum_{i=1}^{k} a_i e_i$. Using conjugate-linearity in the second variable and the identities $(r,e_i)_V=0$, we obtain $(r,z)_V = \sum_{i=1}^{k} \overline{a_i}(r,e_i)_V = 0$. Thus $r=v-w_0$ is orthogonal to every vector of $W$.
[/step]
[step:Decompose every competitor error into orthogonal pieces]
Let $w \in W$ be arbitrary. Define $z := w_0-w$, which belongs to $W$ because both $w_0$ and $w$ belong to $W$. From the previous step, $(r,z)_V=0$. Since $v-w = (v-w_0)+(w_0-w)=r+z$, we expand the squared norm as $|v-w|^2 = (r+z,r+z)_V$. By sesquilinearity and conjugate symmetry of the inner product, $(r+z,r+z)_V = (r,r)_V + (r,z)_V + (z,r)_V + (z,z)_V$. Because $(r,z)_V=0$ and $(z,r)_V=\overline{(r,z)_V}=0$, this becomes $|v-w|^2 = |r|^2 + |z|^2$. Substituting back $r=v-w_0$ and $z=w_0-w$ gives $|v-w|^2 = |v-w_0|^2 + |w_0-w|^2$.
[/step]
[step:Conclude minimality and uniqueness]
For every $w \in W$, the identity from the previous step gives $|v-w|^2 = |v-w_0|^2 + |w_0-w|^2$. Since $|w_0-w|^2 \ge 0$, we have $|v-w|^2 \ge |v-w_0|^2$. Therefore $w_0$ is a least-squares approximation to $v$ from $W$.
If equality holds for some $w \in W$, then $|w_0-w|^2=0$. Positivity of the inner product implies $w_0-w=0$, hence $w=w_0$. Thus the minimizer is unique, and $w_0$ is the unique least-squares approximation to $v$ from $W$.
[/step]