Consider the graph of $\cos(x)$ on the interval $[-\pi/2,\pi/2]$. It looks very close to a parabola. I would like to find the parabola (or possibly family of parabolas) that "fit" the $\cos$ function the best on this interval.
By "fit" the best, I mean I want to minimize the absolute area between the curves as much as possible, i.e. minimize $$\int_{-\pi/2}^{\pi/2}|\cos(x)-p_2(x)|dx,$$
where $p_2$ is a degree $2$ polynomial.
My initial approach was to look at the Taylor approximation about $x=0$ of degree $2$
$$\cos(x)\approx1-\frac {x^2}2$$
The area between these curves is $2-\pi-\frac{\pi^3}{24}\approx0.15403$. Surely we can do better.
I then looked at the interpolating polynomial through the points $(-\pi/2,0),(0,1),(\pi/2,0)$, which gives the function $1-\frac{4x^2}{\pi^2}$.
The area between these two curves is $\frac23(\pi-3)\approx0.094395$. Better!
Next, I tried looking what quadratic, with vertex $(0,1)$, satisfies $$\int_{-\pi/2}^{\pi/2}\cos(x)-p_2(x)dx=0.$$
We then find that $p_2(x)=1-\frac{12(\pi-2)}{\pi^3}x^2$.
So, there area between these two curves is $0$, but the absolute area is approximately $0.0539276$. Checking numerically, this appears to be the best-fitting parabola that has vertex $(0,1)$.
Is the polynomial $p(x)=1-\frac{12(\pi-2)}{\pi^3}x^2$ the unique quadratic that minimizes $$\int_{-\pi/2}^{\pi/2}|\cos(x)-p_2(x)|dx,$$ where $p_2$ is a degree two polynomial?
Of course, it could be that there is a better-fitting polynomial that does not have its vertex at $(0,1)$. If not, then I simply ask:
Find a quadratic polynomial $p_2(x)$ that minimizes $$\int_{-\pi/2}^{\pi/2}|\cos(x)-p_2(x)|dx.$$
Now, this can be extended to other degree polynomials. For example, the best fitting constant is $c=\sqrt{2}/2$, and that gives $$\int_{-\pi/2}^{\pi/2}|\cos(x)-\frac{\sqrt2}2|dx=2(\sqrt2-1)\approx0.82843.$$ This raises my more general question.
Let $n\in\mathbb{N}$ and let $p_n(x)$ be an $n$th degree polynomial. For each $n$, what polynomial minimizes $$\int_{-\pi/2}^{\pi/2}|\cos(x)-p_n(x)|dx?$$


