Minimizing the error for a second degree interpolating polynomial

129 Views Asked by At

Construct the second degree polynomial $q_2(t)$ that approximates $g(t) = \sin(\pi t)$ on the interval [0,1] by minimizing $$\int_0^1 [g(t) - q_2(t)]^2dt$$ A useful integral: $\int_0^1 (6t^2-6t+1)^2dt=\frac{1}{5}$

My attempt:

We Know $q_2(t)$ will come in the form of $q_2(t) = zt^2 + yt + x$.

First we can expand $[g(t) - q_2(t)]^2dt$ and get the integral $$\int_0^1 g^2(t)-2q_2(t)g(t)+q_2^2(t)dt$$ $$\rightarrow \int_0^1 \sin^2(\pi t)-2\sin(\pi t)(zt^2+yt+x)+(zt^2+yt+x)^2dt$$ $$\rightarrow \frac{1}{2}-\frac{4x}{\pi}-\frac{2y}{\pi}-\frac{2z(\pi^2-4)}{\pi^3}+\int_0^1 (zt^2+yt+x)^2dt$$

I am having difficulty utilizing the hint to handle $\int_0^1 (zt^2+yt+x)^2dt$. Is the hint implying that the the second degree polynomial $q_2(t)$ is equal to $6t^2-6t+1$? My big picture goal of this problem was to find $x,y,z$ such that the integral is minimized by expanding and solving the integral and then solving for $x,y,z$. What am I missing, or what am I doing wrong? Thank you!

2

There are 2 best solutions below

0
On BEST ANSWER

This problem is actually much easier using tools from linear algebra rather than calculus.

Edit: Perhaps it was an exaggeration that this approach is 'much easier' than the calculus approach (as discussed in @Claude Leibovici's excellent answer), due to the simplicity of the resulting system to find the local minima of the integral (I did not expect the system to be that simple). However, the linear algebra approach does use the hint suggested by the question (so this is likely the method your professor wanted you to solve it), and gives the same answer as the other one (I have checked this explicitly, as shown in my recent edit). Moreover, from this approach we can be absolutely sure that the minimum computed is a global minimum, and not just a local one with respect to the coefficients of the polynomial.


What you actually want to be using here is the Gram-Schmidt procedure to find an orthogonal basis $\{u_1,u_2,u_3\}$ for $\{v_1,v_2,v_3\}=\{1,t,t^2\}$ under the standard $L^2$ inner product on the interval $[0,1]$, then from this derive the orthonormal basis $\{e_1,e_2,e_3\}$ and then compute the coefficients of $q_2(t)=\sum_{i=1}^3 a_i e_i$ by using the formula (since the integral you want to minimize is equal to $\|g-q_2\|^2=\langle g-q_2,g-q_2\rangle$, and minimizing $\|\cdot \|^2$ is equivalent to minimizing $\|\cdot \|$): $$a_i=\langle g,e_i \rangle$$ Via the procedure, we can obtain the following orthogonal basis (I would suggest you check this yourself): $$\{u_1,u_2,u_3\}=\{1,t-1/2,t^2-t+1/6\}$$ The hint you are given becomes useful when you want to normalize $u_3$ to find $e_3$, namely we have that: $$\|u_3\|^2=\langle u_3,u_3 \rangle=\int_0^1 (t^2-t+1/6)^2~dt=\frac{1}{36}\color{green}{\int_0^1 (6t^2-6t+1)^2~dt}=\frac{1}{36\cdot \color{green}{5}}$$ This leads to the orthonormal basis (again, check this yourself): $$\{e_1,e_2,e_3\}=\{1,\sqrt{3}(2t-1),\sqrt{5}(6t^2-6t+1)\}$$ For the coefficients, we obtain (check this): $$a_1=\frac{2}{\pi},\quad a_2=0,\quad a_3=\frac{2\sqrt{5}(\pi^2-12)}{\pi^3}$$ Therefore, leading to the polynomial: $$\begin{align} q_2(t)&=\frac{2}{\pi}\cdot 1+0\cdot \sqrt{3}(2t-1)+\frac{2\sqrt{5}(\pi^2-12)}{\pi^3}\cdot \sqrt{5}(6t^2-6t+1)\\&=\frac{12(\pi^2-10)}{\pi^3}+\frac{60(12-\pi^2)}{\pi^3}t+\frac{60(\pi^2-12)}{\pi^3}t^2 \end{align}$$ This agrees with @Claude Leibovici's answer.

0
On

I do not see why the hint was even given since $$I=\int_0^1 (zt^2+yt+x)^2\,dt=\int_0^1 (x^2+2 x yt+ \left(2 x z+y^2\right)t^2+2 y z t^3+ z^2 t^4)\,dt$$ that is to say $$I=x^2+x y+\frac{2 x z}{3}+\frac{y^2}{3}+\frac{y z}{2}+\frac{z^2}{5}$$ So, for the total $$R=\frac{1}{2}-\frac{4x}{\pi}-\frac{2y}{\pi}-\frac{2z(\pi^2-4)}{\pi^3}+x^2+x y+\frac{2 x z}{3}+\frac{y^2}{3}+\frac{y z}{2}+\frac{z^2}{5}$$ Computing the partial derivatives $$\frac{\partial R}{\partial x}=2 x+y+\frac{2 z}{3}-\frac{4}{\pi }=0$$ $$\frac{\partial R}{\partial y}=x+\frac{2 y}{3}+\frac{z}{2}-\frac{2}{\pi }=0$$ $$\frac{\partial R}{\partial z}=\frac{2 x}{3}+\frac{y}{2}+\frac{2 z}{5}-\frac{2 \left(\pi ^2-4\right)}{\pi ^3}=0$$

Solving for $(x,y,z)$ $$x=\frac{12 \left(\pi ^2-10\right)}{\pi ^3} \qquad y=\frac{60 \left(12-\pi^2\right)}{\pi ^3}\qquad z=\frac{60 \left(\pi ^2-12\right)}{\pi ^3}$$ and, for these values, $$R=\frac{1}{2}-\frac{24 \left(120-20 \pi ^2+\pi ^4\right)}{\pi ^6}\approx 3 \times 10^{-4}$$