# Maximum error for the Lagrange interpolating polynomials

#### mathmari

##### Well-known member
MHB Site Helper
Hey !!!

Could you help me at the following exercise?

$k, n \in \mathbb{N}$
$f(x)=cos(k \pi x), x \in [0,1]$
$x_i=ih, i=0,1,2,...,n, h=\frac{1}{n}$

Let $p \in \mathbb{P}_n$ the Lagrange interpolating polynomials of $f$ at the points $x_i$.
Calculate an upper bound of the maximum error $\varepsilon_p =max_{0 \leq x \leq 1}{|f(x)-p(x)|}$ as a function of $k$ and $n$, and find a relation that $k$ and $n$ should satisfy so that $\varepsilon_p \rightarrow 0$ while $k \rightarrow \infty$ and $n \rightarrow \infty$.

I have found that an upper bound of the maximum error is $\frac{(k \pi h)^{n+1}}{n+1}$.

How can I find the relation that $k$ and $n$ should satisfy so that $\varepsilon_p \rightarrow 0$ while $k \rightarrow \infty$ and $n \rightarrow \infty$ ??

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Hey !!!

Could you help me at the following exercise?

$k, n \in \mathbb{N}$
$f(x)=cos(k \pi x), x \in [0,1]$
$x_i=ih, i=0,1,2,...,n, h=\frac{1}{n}$

Let $p \in \mathbb{P}_n$ the Lagrange interpolating polynomials of $f$ at the points $x_i$.
Calculate an upper bound of the maximum error $\varepsilon_p =max_{0 \leq x \leq 1}{|f(x)-p(x)|}$ as a function of $k$ and $n$, and find a relation that $k$ and $n$ should satisfy so that $\varepsilon_p \rightarrow 0$ while $k \rightarrow \infty$ and $n \rightarrow \infty$.

I have found that an upper bound of the maximum error is $\frac{(k \pi h)^{n+1}}{n+1}$.
Oi!!

Hmm, how did you get that?
I get $$\displaystyle \frac{(k \pi)^{n+1} h^n}{n+1}$$.

How can I find the relation that $k$ and $n$ should satisfy so that $\varepsilon_p \rightarrow 0$ while $k \rightarrow \infty$ and $n \rightarrow \infty$ ??
First substitute $$\displaystyle h=\frac{1}{n}$$?
And then find the necessary condition for the limit to be zero?

#### mathmari

##### Well-known member
MHB Site Helper
Hmm, how did you get that?
I get $$\displaystyle \frac{(k \pi)^{n+1} h^n}{n+1}$$.
$$|(x-0h)(x-h)(x-2h)...(x-nh)| \frac{(k \pi)^{n+1}}{(n+1)!} \leq (h-x)(h-x)(2h-x)...(nh-x)| \frac{(k \pi)^{n+1}}{(n+1)!} \leq n! h^{n+1}\frac{(k \pi)^{n+1}}{(n+1)!} =\frac{(k \pi h)^{n+1}}{n+1}$$

First substitute $$\displaystyle h=\frac{1}{n}$$?
And then find the necessary condition for the limit to be zero?
$$\frac{(k \pi h)^{n+1}}{n+1}=\frac{(k \pi )^{n+1}}{n^{n+1} n+1}$$

So that the limit is zero the condition is $k \pi <1$, isn't it? But shouldn't $k \rightarrow \infty$ ?

#### Klaas van Aarsen

##### MHB Seeker
Staff member
$$|(x-0h)(x-h)(x-2h)...(x-nh)| \frac{(k \pi)^{n+1}}{(n+1)!} \leq (h-x)(h-x)(2h-x)...(nh-x)| \frac{(k \pi)^{n+1}}{(n+1)!} \leq n! h^{n+1}\frac{(k \pi)^{n+1}}{(n+1)!} =\frac{(k \pi h)^{n+1}}{n+1}$$
Ah yes. That works!

$$\frac{(k \pi h)^{n+1}}{n+1}=\frac{(k \pi )^{n+1}}{n^{n+1} n+1}$$

So that the limit is zero the condition is $k \pi <1$, isn't it? But shouldn't $k \rightarrow \infty$ ?
Not quite.
Aren't you forgetting the $n^{n+1}$ in the denominator?
(And also a couple of parentheses? )
Perhaps you can merge it in the power that you have in the numerator?

#### mathmari

##### Well-known member
MHB Site Helper
(And also a couple of parentheses? )

Not quite.
Aren't you forgetting the $n^{n+1}$ in the denominator?
(And also a couple of parentheses? )
Perhaps you can merge it in the power that you have in the numerator?
So $$(\frac{k \pi}{n})^{n+1} \frac{1}{n+1}$$

While $n \rightarrow \infty, \frac{1}{n+1} \rightarrow 0$.

But what about $(\frac{k \pi}{n})^{n+1}$ ? Since $n$ is a power, $\frac{k \pi}{n}$ should be smaller than $1$. But what can I do in this case where there is a $n$ in the denominator?

#### Klaas van Aarsen

##### MHB Seeker
Staff member
So $$(\frac{k \pi}{n})^{n+1} \frac{1}{n+1}$$

While $n \rightarrow \infty, \frac{1}{n+1} \rightarrow 0$.

But what about $(\frac{k \pi}{n})^{n+1}$ ? Since $n$ is a power, $\frac{k \pi}{n}$ should be smaller than $1$. But what can I do in this case where there is a $n$ in the denominator?
Well, you needed a relation between $k$ and $n$.
What about $\frac{k \pi}{n} < 1$, or say $k \pi < n$?
Does that look like a relation?

#### mathmari

##### Well-known member
MHB Site Helper
Well, you needed a relation between $k$ and $n$.
What about $\frac{k \pi}{n} < 1$, or say $k \pi < n$?
Does that look like a relation?
Does this relation stand for $k \rightarrow \infty$ and $n \rightarrow \infty$?

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Does this relation stand for $k \rightarrow \infty$ and $n \rightarrow \infty$?
It's a condition.
If we set for instance $n = 2\pi k$ and let $k \to \infty$, obviously we also have that $n \to \infty$. Furthermore, $\varepsilon_p \to 0$.
However, if we set $n = k$ and let $k \to \infty,\ n \to \infty$, we do not necessarily get that $\varepsilon_p \to 0$.

Last edited:

#### mathmari

##### Well-known member
MHB Site Helper
It's a condition.
If we set for instance $n = 2\pi k$ and let $k \to \infty$, obviously we also have that $n \to \infty$. Furthermore, $\varepsilon_p \to 0$.
However, if we set $n = k$ and let $k \to \infty,\ n \to \infty$, we get that $\varepsilon_p \to \infty$.
A ok!!! Thank you!!!

Last edited by a moderator: