Find the polynomial $P$ of degree 2 in $\mathbb{R}[X]$ such that $P(0)=1, P(1)=2$ and $P(2)=5$.
The sought polynomial is

$$
\begin{aligned}
P(X) & =\frac{(X-1)(X-2)}{(0-1)(0-2)}+2 \frac{(X-0)(X-2)}{(1-0)(1-2)}+5 \frac{(X-0)(X-1)}{(2-0)(2-1)} \\
& =\frac{X^{2}-3 X+2}{2}+2 \frac{X^{2}-2 X}{-1}+5 \frac{X^{2}-X}{2} \\
& =\frac{X^{2}-3 X+2-4 X^{2}+8 X+5 X^{2}-5 X}{2} \\
& =\frac{2 X^{2}+2}{2} \\
& =X^{2}+1
\end{aligned}
$$