I'm currently studying general projections over inner product spaces, and encounter this following generalization.
If $\mathbb{W}$ is a $k$ dimensional vector subspace of an inner product space $\mathbb{V}$, then for any $\vec{v}\in\mathbb{V}$ we have $$\mathrm{perp}_\mathbb{W}(\vec{v})=\vec{v}-\mathrm{proj}_\mathbb{W}(\vec{v})\in\mathbb{W}^\bot$$
My book proves this by making the expanding $\mathrm{proj}_\mathbb{W}(\vec{v})\in\mathbb{W}$ as
$$\mathrm{perp}_\mathbb{W}(\vec{v})=\vec{v}-\frac{\langle\vec{v},\vec{v_1}\rangle}{\Vert\vec{v_1}\Vert^2}\vec{v_1}-...-\frac{\langle\vec{v},\vec{v_k}\rangle}{\Vert\vec{v_k}\Vert^2}\vec{v_k}$$
, where $\{\vec{v_1},...,\vec{v_k}\}$ is an orthogonal basis that spans $\mathbb{W}$, and then using using the Gram-Schmidt Orthogonalization Theorem to deduce that $\{\vec{v_1},...,\vec{v_k},\mathrm{perp}_\mathbb{W}(\vec{v})\}$ is an orthogonal basis and hence $\mathrm{perp}_\mathbb{W}(\vec{v})$ being in the orthogonal complement of $\mathbb{W}$ under $\langle,\rangle$.
What I don't understand is the usage of the GSOT to prove orthogonality of $\vec{v}$, since $\{\vec{v_1},...,\vec{v_k}\}$ was not constructed from a basis $\{\vec{w_1},...,\vec{w_k},\vec{w_{k+1}}\}$, yet the proof says that any vector $\vec{v}\in\mathbb{V}$ to replace $\vec{w_{k+1}}$ would instantly make $\mathrm{perp}_\mathbb{W}(\vec{v})$ orthogonal.
Well, it's not the whole Gram-Schmidt process used here, only its computation part, which shows that the given formula for $\mathrm{perp}_W(v)$ yields indeed a vector orthogonal to each $v_i$.
Nevertheless, this can be thought of as being in the middle of the Gram-Schmidt process, where $v_1,\dots, v_n$ orthogonal vectors are already chosen (spanning $W$), and then we are given a next candidate vector $v$ (presumably $v\notin W$), and make it orthogonal by applying $v_{n+1}:=\mathrm{perp}_W(v)$.