Find the polynomial p(x) $\displaystyle \in P_3$ which minimizes the distance $\displaystyle \int\limits_{-1}^{1} (cos(\pi x) - p(x))^2 dx$
Presumably $\displaystyle P_3$ means the set of cubic polynomials?
Step 1 is to find an orthonormal basis $\displaystyle \{f_0(x),f_1(x),f_2(x),f_3(x)\}$ for $\displaystyle P_3$, with respect to the inner product given by $\displaystyle \langle f(x),g(x)\rangle = \int_{-1}^1f(x)g(x)\,dx$. You do this by starting with the natural basis $\displaystyle \{1,x,x^2,x^3\}$ and applying the Gram–Schmidt process.
After you have done that, the rest is easy, because p(x) will be given by the formula $\displaystyle p(x) = \sum_{j=0}^3\langle\cos(\pi x),f_j(x)\rangle f_j(x)$.