# Proof that $E_n = \int_0^1 \left| \ln t - P_n(t) \right|\mathrm{d}t = 1/(n+1)^2$

Assume one wants to minimize the distance between $f(x)=\ln x$ and $P_n(t)$ where $P_n$ denotes a polynomial of degree $n$. Etc $P_1 = ax 0+ b$. One way to judge whether the polynomial is a good approximation is to minimize the integral

$$E_n = \int_0^1 \left| \ln(t) -P_n(t)\right|^2\mathrm{d}t$$

The polynomials I have found so far are

\begin{align} P_1(t) & = 3x - \frac{5}{2} \\ P_2(t) & = -5x^2 + 8x - \frac{10}{3} \\ P_3(t) & = \frac{35}{3}x^3 - \frac{45}{2}x^2 + 15x - \frac{47}{12} \end{align}

Now after some numerical calculations, it seems that $E_n =1/(n+1)^2$. But why?

-
I think you can consider the orthogonal projection of ln(x) onto the subspace generated by polynomial of degree lesser or equal to n. – Ben Nov 22 '12 at 14:56
If you take $$P_N(x)=-1+\sum_{m=1}^{N}\frac{(-1)^{m+1}(2m+1)}{m(m+1)!}\,\frac{d^m}{dx^m}(x(1‌​-x))^m$$ you have $$\|\log(x)-P_N(x)\|_2^2=\frac{1}{(N+1)^2},$$ proof below. – Jack D'Aurizio Nov 22 '12 at 18:50

Let $L_n(x)$ be the $n$-th Legendre polynomial. These polynomials are a complete orthogonal base of $\mathcal{L}^2([-1,1])$ with respect to the inner product $$<f,g>=\int_{-1}^{1}f(x)\,g(x)\,dx$$ and they satisfy $$\int_{-1}^{1}L_n(x)\,L_m(x)\,dx=\frac{2}{2n+1}\,\delta_{m,n}.$$ Since, by the Rodrigues formula, $$L_n(x) = \frac{1}{2^n\,n!}\cdot\frac{d^n}{dx^n}(1-x^2)^n,$$ it is not difficult to compute $$\int_{-1}^{1} L_n(x)\,\log(1+x)\,dx = (-1)^{n+1}\frac{2}{n(n+1)},$$ from which it follows that $$\log(1+x) = -\frac{\log 2}{2}+\sum_{n=1}^{+\infty}\frac{2n+1}{n(n+1)}L_n(x).$$ Now, if you take $$P_N(x) = -\frac{\log 2}{2}+\sum_{n=1}^{N}\frac{2n+1}{n(n+1)}L_n(x).$$ as a polynomial approximation of $\log(1+x)$ with degree $N$, by the orthogonality of the Legendre polynomials you get: $$\|P_N(x)-\log(1+x)\|_2^2 = \sum_{n>N}\frac{(2n+1)^2}{n^2(n+1)^2}\|L_n(x)\|_2^2=$$ $$= 2\sum_{n>N}\frac{2n+1}{n^2(n+1)^2}=2\sum_{n>N}\left(\frac{1}{n^2}-\frac{1}{(n+1)^2}\right)=\frac{2}{(N+1)^2},$$ with the same magnitude of the error of the best polynomial approximation of degree $N$.
In a similar manner, the polynomials $$J_n(x)=\frac{1}{n!}\frac{d^n}{dx^n}(x(1-x))^n$$ form a complete orthogonal base of $\mathcal{L}^2([0,1])$ with the standard inner product, $\|J_n\|_2^2 = \frac{1}{2n+1}$ and $$\int_{0}^{1}\log(x)\,J_n(x)\,dx = \frac{(-1)^{n+1}}{n(n+1)},$$ so if you take $$P_N(x)=-1+\sum_{m=1}^{N}\frac{(-1)^{m+1}(2m+1)}{m(m+1)}\,J_m(x)$$ you have $$\|\log(x)-P_N(x)\|_2^2=\frac{1}{(N+1)^2}.$$