I have the integral $\int_{0}^{h} e^{x}cos(x) dx$ and then I am asked to find the highest error term for this integral with trapezoidal.

My textbook denotes the highest error term |E| to be $- \frac{h^3}{12}f''(c)$

Since $f''(x)= -2sin(x) e^{x}$

I see that |E| $\leq \frac{(h-0)^3}{12} \cdot |-2sin(x)e^{x}|$

But my problem is I have to if 0 or h gives me the greatest value to find the highest error term. since h (the upper bound) is not a number I'm a little bit confused.

In one way plugging in 0 the value of the term will just be 0. if you plug in h where $h \neq 0$ then you will get something bigger. so I am thinking plugging in h will be the right way to go? (not so mathematically...)

  • $\begingroup$ $h$ is the size of the distances between two nodes. How many nodes are used ? $\endgroup$
    – Peter
    Commented May 24, 2018 at 9:51
  • $\begingroup$ I am not sure if I understand the meaning of nodes correctly. I am aware that the h in the error ''formula'' is the distance between $x_{1}$ and $x_{0}$ $\endgroup$
    – user420309
    Commented May 24, 2018 at 10:04
  • $\begingroup$ The nodes are the $x$-values used for the approximation. Without knowing how many such values are used, the error cannot be estimated. $\endgroup$
    – Peter
    Commented May 24, 2018 at 10:06
  • $\begingroup$ well in the question it is just mentiond that: Express the integral via the trapezoidal rule including the error term E. Give the best possible guaranteed bound for |E|. $\endgroup$
    – user420309
    Commented May 24, 2018 at 10:09
  • 1
    $\begingroup$ so we get that |E| $\leq \frac{h^3}{6} sin(h)e^{h}$? $\endgroup$
    – user420309
    Commented May 24, 2018 at 10:18

1 Answer 1


I think you are confused with the meaning of the expression for the error. What it states is:

There is a point $c$ in the interval $(a, b)$ such that the error in calculating the integral $\int_{a}^bf(x)~{\rm d}x$ using the trapezoid rule is given by the expression $$ \epsilon = (b-a)\frac{h^2}{12}f''(c) \tag{1} $$ here $h$ is the size of the partition.

To give you an example, take $a = 0$, $b= h=1$, and $f(x) = e^{x}\cos x$, using the trapezoidal rule you get

$$ S = \int_0^1{\rm d}f(x) \approx \frac{1}{2}(f(0) + f(1)) = 1.2343 $$

whereas the actual integral is

$$ I = \int_0^1{\rm d}x~f(x) = \frac{1}{2}[-1 + e(\cos 1 + \sin 1)] = 1.37802 $$

The statement above just tells you that there exist a number $c$ in $(0,1)$ such that

$$ -\frac{f''(c)}{12} = 1.37802 - 1.2343 $$

you can actually check this is true, with $c = 0.531375$.

Here is the deal, in most cases we do not know the actual value of the integral, but we can still actually use $(1)$ to put a constraint on the error you are making. For example, in your case

$$ f''(x) = -2e^{x}\sin x $$

So that in the case $a = 0$ and $b = h$ you have

$$ |\epsilon| = \frac{h^3}{12} |2e^{c}2\sin c | = \frac{h^3}{6}e^c|\sin c| \leq \frac{h^3}{6}e^h\sin h \tag {2} $$

where I have used the fact that for $h >0$ small, then $f(x)$ increases, so $f(h) > f(c)$ for $c < h$. End there you have it, you don't know what the actual error you are making, but you know it will never exceed the value in (2)

  • $\begingroup$ Thank you for your detailed answer. I was just confused since this is a practice exam question and my teacher told me the right answer is going to be $|E| \leq \frac{h^4}{6} e^{h}$ $\endgroup$
    – user420309
    Commented May 26, 2018 at 13:26
  • $\begingroup$ @Djhoe For $h \ll 1$, recall that $\sin h \approx h$ $\endgroup$
    – caverac
    Commented May 26, 2018 at 13:29
  • $\begingroup$ why can h not be bigger than 1? $\endgroup$
    – user420309
    Commented May 26, 2018 at 14:04
  • 1
    $\begingroup$ @Djhoe it can, but then you cannot make the approximation $|\sin x| \approx x$ $\endgroup$
    – caverac
    Commented May 26, 2018 at 14:26
  • $\begingroup$ ok thank you I think I understand your answer and the way that my teacher wants me think about this question now $\endgroup$
    – user420309
    Commented May 26, 2018 at 14:32

You must log in to answer this question.