Let J ⊆ { 1 , … , n } {\displaystyle {}J\subseteq \{1,\ldots ,n\}} , and let U = ⟨ e i , i ∈ J ⟩ ⊆ R n {\displaystyle {}U=\langle e_{i},\,i\in J\rangle \subseteq \mathbb {R} ^{n}} denote the linear subspace spanned by this choice of standard vectors. Let
Then, the distance of v {\displaystyle {}v} to U {\displaystyle {}U} equals
The dropped perpendicular foot of v {\displaystyle {}v} on U {\displaystyle {}U} is
where