Linear interpolation with two points

626 Views Asked by At

Question: $p(x)$ is the linear function that interpolates $\sin(x)$ at $0$ and $\frac{\pi}{2}$. And I need to show that $\ |p(x) - \sin(x)|\le\ \frac{1}{2}(\frac{\pi}{4})^2$

My attempt: $\ |f(x)-p(x)| \le (K_n/(n+1)!) * |W(x)|$

where $\ K_2 = -\sin(x)$ and $\max|W(x)| = ||W(x)||\inf$ where x is in $\ [0, \pi/2]$

I ended up with $\ \frac {1}{2}(x^2 - (\frac{ \pi}{2})x)$ which I cannot find a connection with the given relationship in the problem. Am I missing something?

Sorry in advanced for the poor syntax.

3

There are 3 best solutions below

0
On

The maximum of the difference $\sin(x)-p(x)$ is reached when $\cos(x)=\frac2\pi,$ so the maximum difference is actually

$$\sqrt{1-\frac4{\pi^2}}-\frac2{\pi}\arccos\frac2{\pi}.$$

3
On

Hint:

As $p(x)$ is linear through $(0,0)$ and $(\frac\pi2,1)$, we have $p(x)=\frac{2x}\pi$.

Then consider $|p(x)-\sin(x)|^2=(\frac{2x}\pi-\sin(x))^2$.

We find the maximum of this function by derivation

$$2(\frac2\pi-\cos(x))(\frac{2x}\pi-\sin(x)).$$

The first factor cancels for $\cos(x)=\frac2\pi$. It corresponds to a single extremum of the second factor. The latter is known to cancel for $x=0$ and $x=\frac\pi2$ and has no other root.

Hence the maximum occurs at $x=\arccos(\frac2\pi)$, with value (of the square)

$$\left(\frac2\pi\arccos(\frac2\pi)-\sqrt{1-\frac4{\pi^2}}\right)^2.$$

1
On

$p(x)=ax+b$ such that $p(0)=0$ and $p(\frac{\pi}2)=1$ That is $p(x) = \frac2{\pi} x$

The error of linear interpolation is given by $$|E(x)|=|p(x)-\sin x|=\max_{x\in[0,\pi/2]}\left|\frac{ (x-0)(x-\pi/2)}2 \left\{\frac{d^2}{dx^2}\sin\right\} (c)\right| =\max_{x\in[0,\pi/2]}\left|\frac{ (x-0)(x-\pi/2)}2 \sin(c)\right|\le \max_{x\in[0,\pi/2]}\frac{ (x-0)(x-\pi/2)}2 = \frac{1}{2} \left(\frac{\pi }{4}\right)^2 $$

To show the last equality note that $\frac{d}{dx}x(x-\frac\pi2)=(x-\frac\pi2)+x=0 $ iff $x=\frac\pi4$, this is of course a maximum (why)? Finally evaluate the polynomial at this point, to get the required result.