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.

  • $\begingroup$ First write down the expression of $p(x)$, which I don't see. $\endgroup$ – Yves Daoust Dec 15 '15 at 9:36
  • $\begingroup$ @YvesDaoust p(x) was not given in the problem. $\endgroup$ – wrenyoong Dec 15 '15 at 9:37
  • 1
    $\begingroup$ No but you have to find it. This is elementary from its definition. $\endgroup$ – Yves Daoust Dec 15 '15 at 9:38
  • $\begingroup$ @YvesDaoust is $\ p(x) = (x-0)(x-\pi/2)$ ? $\endgroup$ – wrenyoong Dec 15 '15 at 9:42
  • 1
    $\begingroup$ I don't think this is linear... $\endgroup$ – Yves Daoust Dec 15 '15 at 9:42

$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.

  • $\begingroup$ Thank you for additional explanation on the last equality! Now I know what I misunderstood. :D $\endgroup$ – wrenyoong Dec 15 '15 at 10:18


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


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)


  • $\begingroup$ Thank you so much! I knew my first step of figuring out p(x) was wrong since it can't be square function.. $\endgroup$ – wrenyoong Dec 15 '15 at 10:02
  • $\begingroup$ You need to put absolute value signs around that result. The linear interpolation stays below the sine as the latter is concave. $\endgroup$ – Justpassingby Dec 15 '15 at 10:07
  • $\begingroup$ @Justpassingby: I was about to do it when the telephone rang :-) $\endgroup$ – Yves Daoust Dec 15 '15 at 10:12

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



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.