Question:
Let $E = \Bbb{R}_2[X]$ an euclidian space with a dot product $\left\langle P,Q\right\rangle \ = \int^1_0 {P(t)Q(t)dt}$.
Calculate the distance from $X^2$ to $\operatorname{span}(1,X)$.
Answer:
Let $(a,b) \in \Bbb{R}^2$. $p$ is the orthogonal projector. We have:
\begin{equation} a + bX = p^\perp_{\operatorname{span}(1,X)}(X^2) \iff \left\{\begin{array}{@{}l@{}} \langle X^2 - (a+bX), 1\rangle = 0\\ \langle X^2 - (a+bX), X\rangle = 0\\ \end{array}\right.\, \iff \left\{\begin{array}{@{}l@{}} a = -1/6\\ b = 1\\ \end{array}\right.\,. \end{equation}
So the wanted distance is $\left\|X^2-(X-1/6)\right\| = \frac{1}{6\sqrt 5}$.
I am a little bit lost since I don't understand how $X^2$ can be projected on $\operatorname{span}(1, X)$.
Since $X^2$ is not a linear combination of $\operatorname{span}(1, X)$.
Why $a + bX$ is not equal to zero?
How the dot products $\langle X^2 - (a+bX), 1\rangle \ = 0$ and $\langle X^2 - (a+bX), X\rangle \ = 0$ helps to get the projector? It means that we need to gets $a$ and $b$ where $\left[X^2 - (a+bX)\right] \perp 1$, why?
I would like to have great explanations (like if I didn't have the answer).

Think about $\mathbb R^3$ for a moment. Suppose you have a plane $P$ spanned by two vectors $u, v$ and you have a third vector $w$ which is not in the plane but is also not orthogonal to the plane. Then it makes sense to project $w$ onto the plane, right? But $w$ is not a linear combination of $u$ and $v$ because $w$ is not contained in the plane. It's the same idea here: as long as $X^2$ is not orthogonal to $\mathrm{span}\{1, X\}$ then $X^2$ has a non-zero projection onto that plane.
Now what does "orthogonal projection" mean? It means precisely the point $s = p^\perp_P(w)$ contained in $P = \mathrm{span}\{u,v\}$ such that the line from $s$ to $w$ is orthogonal to $P$. "The line from $s$ to $w$" is parallel to the vector $w - s$, so that means $$ \langle w-s, u\rangle = 0\quad \langle w-s, v\rangle = 0 \tag{$*$} $$ because $u,v \in P$.
Now apply this when $u = 1$, $v = X$, and $w = X^2$. What the answer does is write $s = a + bX$ for some unknown scalars $a, b$; we can do this because $s \in P = \mathrm{span}\{1, X\}$. Then the equations ($*$) above give us two linear equations for the unknowns $a, b$ which we can then solve. This gives us the orthogonal projection $s = p^\perp_P(X^2)$, and finally the distance between $X^2$ and $P$ is defined to be the distance between $X^2$ and $s$, which is $||X^2 - s||$.