Calculate the distance of the point $(1,1,1,1)$ from the subspace $W$. This is a duplicate question.

Let $W$=span$\left(\frac{1}{\sqrt{2}}(0,0,1,1),\frac{1}{\sqrt{2}}(1,-1,0,0)\right)$ be a subspace of the Euclidean space $\mathbb{R^4}$. Then the square of the distance from the point $(1,1,1,1)$ to the subspace $W$ is equal to_____?

So this question is already been asked and has an accepted answer here.
But I didn't understand the answer fully. To be honest, I didn't get the idea at all. The answer is talking about some distance $r_{AA_w}$ I don't know nothing how to get that.
So by this question, I want to know about the concept behind the distance of a point to a subspace. How to calculate this distance and what is the idea behind this? If someone can explain this to me then it would be really helpful. Thanks.
Start with simple cases: What’s the distance from a point to a line? How about to a plane? After a bit of experimentation, you might hit upon the idea that it’s the minimum distance between that fixed external point and any point on the line/plane. Simple geometric considerations show that this minimum distance is obtained when we measure it in a direction perpendicular to the line/plane, and so the nearest point to the fixed external point is the latter’s orthogonal projection onto the line/plane (labeled $\pi A$ in the diagram).  



If we subtract this projection from the original point, we get a vector that’s orthogonal to the line/plane (called the orthogonal rejection from the line/plane), so the distance we’re looking for is equal to the length of this difference vector.  

One can prove in various ways that this holds in general, namely, that the minimum distance from a point to an $m$-dimensional subspace lies along a direction that’s perpendicular to it. We’ll just take that as given. So, to compute this distance, you project the point onto the subspace and find the length of the difference between that projection and the original point.  

There are many ways to construct this projection, depending on what you’re starting with. For this problem, you’ve got an orthonormal basis for $W$ (verify that for yourself), so you can use what you might recognize as a step in the Gram-Schmidt process, which computes successive orthogonal rejections from ever-growing subspaces. So, letting $\mathbf w_1$ and $\mathbf w_2$ be the two basis vectors of $W$, and $\mathbf v=(1,1,1,1)^T$, you would compute $\mathbf v-(\mathbf v\cdot \mathbf w_1)\mathbf w_1-(\mathbf v\cdot \mathbf w_2)\mathbf w_2$ and then compute the norm of this vector.
Here is the general idea behind this problem ...
Instead of working in $\mathbb{R^4}$, consider a more general euclidean vector space $E$ (that is a real vector space, equipped with an inner product (aka dot product)).
Let us denote by $\left&lt;a\mid b\right&gt;$ the scalar product of $a$ by $b$.
The norm of a vector is defined by $\Vert x\Vert=\sqrt{\left&lt; x\mid x\right&gt;}$.
The distance between two vectors $x$ and $y$ is $\Vert x-y\Vert$.
Consider a finite dimensional subspace $W$ of $E$ and $x\in E$.
The question is to minimize the distance from $x$ to the vectors of $W$.
It can be proved that :

there exist a unique $p\in W$ such that :
$$\Vert x-p\Vert=\inf\{\Vert x-w\Vert;\;w\in F\}$$

and that $p$ is obtained as the orthogonal projection of $x$ on $F$, that is :

$$p=\sum_{k=1}^n\left&lt;x\mid e_k\right&gt;\,e_k$$

where $(e_1,\cdots,e_n)$ denotes any orthonormal basis of $W$.
As an example, you could calculate the square of the distance of the map $x\mapsto x^2$ to $W=\mathrm{span}\left(x\mapsto 1,\,x\mapsto x\right)$. Here $E$ is the space of all continuous functions from $[0,1]$ to $\mathbb{R}$ and the inner product is defined by :
$$\forall (u,v)\in E^2,\left&lt;u\mid v\right&gt;=\int_0^1u(t)v(t)\,dt$$
The correct answer is $\frac{1}{180}$