Show that the distance from the point $(1,1,1,1)$ to $W$ is $\sqrt 2$. 
Let $W=\text{Span}\{(0,0,1,1),(1,-1,0,0)\}$ be a subspace of the Euclidean space $\Bbb R^4.$
Prove that the square of the distance from the point $(1,1,1,1)$ to $W$ is $2$.

 A: Note that distance of $x=(1,1,1,1)$ to $W=d(x,W)=\inf\{(d(x,w):w\in W\}$ 
Now $(1,-1,1,1)=(0,0,1,1)+(1,-1,0,0)\in W$ and hence 
$d((1,-1,1,1),(1,1,1,1))=\sqrt 4=2$
ELSE:
Any element of $W$ is $a(0,0,1,1)+b(1,-1,0,0)=(b,-b,a,a)$
Now $d((b,-b,a,a),(1,1,1,1))=\sqrt {(1-b)^2+(1+b)^2+(1-a)^2+(1-a)^2=F(a,b)}$
For extrema of $F$; $F_a=0\implies a=1;F_b=0\implies b=0;F_{aa},F_{bb}>0$
Hence $F$ has minima at $(b,-b,a,a)=(0,0,1,1)$
Also$F(1,0)=4\implies 
d((b,-b,a,a),(1,1,1,1))=2$
A: Square of the distance from (1,1,1,1) to W is minimum of 
$(1-x)^2 + (1+x)^2 +(1-y)^2 + (1-y)^2 = 2+ 2x^2 + (1-y)^2$ over $\mathbb{R}^2$
Simple to see it is 2 
A: The distance between a vector and a subspace is measured along a direction orthogonal to the subspace, i.e., it’s the length of the orthogonal rejection of the vector from the subspace. So, if $\mathbf\pi_W$ is orthogonal projection onto $W$, then distance to $W$ from $\mathbf v$ is $\|\mathbf v-\mathbf\pi_W\mathbf v\|$.  
In this case, $W$ is given as the span of a pair of orthogonal vectors $\mathbf w_1=(0,0,1,1)$ and $\mathbf w_2=(1,-1,0,0)$, so $\mathbf\pi_W\mathbf v={\mathbf v\cdot\mathbf w_1\over\mathbf w_1\cdot\mathbf w_1}\mathbf w_1+{\mathbf v\cdot\mathbf w_2\over\mathbf w_2\cdot\mathbf w_2}\mathbf w_2$. I’ll leave it to you work out what $(1,1,1,1)-\mathbf\pi_W(1,1,1,1)$ is.
