Minimum distance between a vector and a subspace I have a subspace S of R4 with basis (w1, w2, w3).
And i have some vector x and i'm asked to determine the vector s in subspace S that is closest to x, that is, find s that minimizes ||x-s||.
I did this question by projecting vector x onto subspace S (i did the projection of x onto w1, w2, w3)
However, when i asked professor about this question, he told that in order to find the minimum distance between a vector and subspace, we need to produce an orthogonal basis for S and only then do the projection of vector x onto orthogonal basis. 
Can someone explain why do i necessarily need orthogonal basis and why can't i just project vector x onto set of vectors that are not orthogonal to each other?
 A: If you have a point $x$ and a subspace $S$, then the orthogonal projection of $x$ onto $S$ is the unique $s_0\in S$ such that $(x-s_0)\perp S$, meaning that $(x-s_0)\cdot s=0$ for all $s \in S$. The closest point projection of $x$ onto $S$ is the unique $s_0 \in S$ such that $\|x-s_0\| \le \|x-s\|$ for all $s\in S$. The closest point projection and the orthogonal projections exist and are the same.
In your case, you want to find $s=\alpha_1 w_1 + \alpha_2 w_2 + \alpha_3 w_3$ such that
$$
                (x-\alpha_1 w_1 - \alpha_2 w_2-\alpha_3 w_3) \perp w_1 \\
           (x-\alpha_1 w_1 - \alpha_2 w_2-\alpha_3 w_3) \perp w_2 \\
           (x-\alpha_1 w_1 - \alpha_2 w_2-\alpha_3 w_3) \perp w_3.
$$
This gives you a 3x3 matrix problem for thecoefficients $\alpha_1,\alpha_2,\alpha_3$:
$$
         \begin{pmatrix}
                  w_1\cdot w_1 & w_2 \cdot w_1 & w_3 \cdot w_1 \\
                  w_1\cdot w_2 & w_2 \cdot w_2 & w_3 \cdot w_2 \\
                  w_1\cdot w_3 & w_2 \cdot w_3 & w_3 \cdot w_3
         \end{pmatrix}
         \begin{pmatrix}
                \alpha_1 \\
                \alpha_2 \\
                \alpha_3
         \end{pmatrix} =
         \begin{pmatrix}
               x\cdot w_1 \\
               x\cdot w_2 \\
               x\cdot w_3
         \end{pmatrix}
$$
This is an invertible 3x3 matrix if $\{w_1,w_2,w_3\}$ is a linearly independent set of vectors. The coefficient matrix is symmetric.
The alternative is to find an orthonormal basis of $S$, as your Professor mentioned.
