find the closest point using orthogonal projection In the example below, how would we have solved it if $v_1$ and $v_2$ were not orthogonal?

Note: the second term above should be $\frac{x \cdot v_2}{v_2 \cdot v_2}v_2$
 A: In that case one would use Gram-Schmidt orthogonalization to make them orthogonal. Then follow the solution using the found set of orthogonal vectors.
Let's say $v_1=(1,0,0,0)$ and $v_2=(1,1,0,0)$. These are not orthogonal, but we can take $u_1=v_1$ and $u_2=v_2-{\langle u_1, v_2\rangle\over\langle u_1, u_1\rangle}{u_1}=(1,1,0,0)-\frac{1}{1}(1,0,0,0)=(0,1,0,0)$, where $\langle u, v\rangle$ denotes the dot product of $u$ and $v$.
A: You can always try to write $x=y+\alpha_1v_1+\alpha_2v_2$, with $y\bot v_1,v_2$. Do the dot product of this with $v_1$ and $v_2$:
$$x\cdot v_1=(v_1\cdot v_1)\alpha_1+(v_2\cdot v_1)\alpha_2$$
$$x\cdot v_2=(v_1\cdot v_2)\alpha_1+(v_2\cdot v_2)\alpha_2$$
Now solve on $\alpha_1,\alpha_2$.
Note: The following formula would come as a result of using the Cramer’s rule to solve the system, then replacing $\alpha_1$ and $\alpha_2$:
$$x-y=\frac{\left|\begin{matrix}x\cdot v_1 & v_2\cdot v_1\\ x\cdot v_2 & v_2\cdot v_2\end{matrix}\right|}{\left|\begin{matrix}v_1\cdot v_1 & v_2\cdot v_1\\ v_1\cdot v_2 & v_2\cdot v_2\end{matrix}\right|}v_1+ \frac{\left|\begin{matrix}v_1\cdot v_1 & x\cdot v_1\\ v_1\cdot v_2 & x\cdot v_2\end{matrix}\right|}{\left|\begin{matrix}v_1\cdot v_1 & v_2\cdot v_1\\ v_1\cdot v_2 & v_2\cdot v_2\end{matrix}\right|}v_2 $$
It simplifies to your formula if $v_1\cdot v_2=0$. (Note the typo in your formula - should have $v_2\cdot v_2$ instead of $v_1\cdot v_2$.)
