Skip to content

3.17 Approximation of Functions

Approximation of Functions and the Riemann Integral

Approximation of Functions

Since we've known Taylor series \(S(x)=\sum_{n=0}^{\infty} a_nx^n\) in \((-R,R)\) where

\(a_{n}=\frac{f^{(n)}(0)}{n!}\) and \(S(x)=\lim_{N\to\infty} S_N(x)\), \(S_N(x)=\sum_{n=0}^Na_nx^n\)

And we know \(f(x)=S(x)\) iff \(\lim_{N\to\infty}E_{N}(x)=0\) where \(E_N(x)=f(x)-S_N(x)\)

Example

  1. \(f:\mathbb{R}\setminus\{1\}\to\mathbb{R},f\left(x\right)=\frac{1}{1-x},S\left(x\right )=\sum_{n=0}^{\infty}x^{n}\) in \((-1,1)\)

    We cannot approximate \(f(x)\) at \(x=2\) with series around \(x=0\) since it's divergent

  2. \(f(x)=\sin(x),S(x)=0+\frac{1}{1!}x+\frac{0}{2!}x^{2}+\frac{-1}{3!}x^{3}+\frac{1}{5!} x^{5}-\frac{1}{7!}x^{7}+\ldots\) We've proven \(f(x)=S(x)\)

    Thus take \(x\in (0,1)\) and compute \(\sin x\) with a error less than \(0.01\)

    It means we want \(|E_N(x)|<0.01\), then by Theorem (Lagrange's Remainder Theorem)

    We get \(\left|\frac{f^{\left(n+1\right)}\left(c\right)}{\left(n+1\right)!}x^{n+1}\right| <0.01\) where \(0<c<\left|x\right|\), then \(\leq\frac{|x|^{N+1}}{(N+1)!}<\frac{1^{N+1}}{(N+1)!}=\frac{1}{(N+1)!}<0.01\)

    Look for \(N\) such that: \(\frac{1}{(N+1)!} < \frac{1}{100}\)

    • \(N = 1\)

    \(\frac{1}{2!} = \frac{1}{2} < \frac{1}{100} \quad \text{(False)}\) * \(N = 2\)

    \(\frac{1}{3!} = \frac{1}{6} < \frac{1}{100} \quad \text{(False)}\) * \(N = 3\)

    \(\frac{1}{4!} = \frac{1}{24} < \frac{1}{100} \quad \text{(False)}\) * \(N = 4\)

    \(\frac{1}{5!} = \frac{1}{120} < \frac{1}{100} \quad \text{(True, so we take } N = 4 \text{)}\)

    Now, compute \(S_4(x)\).

    Example: Take \(x = \frac{1}{2}\)

    \(\sin\left(\frac{1}{2}\right) \approx S_{4}\left(\frac{1}{2}\right) = \frac{1}{2} - \frac{\left(\frac{1}{2}\right)^{3}}{3!}\) \(= \frac{1}{2}- \frac{1/8}{6}= \frac{1}{2}- \frac{1}{48}\) \(= \frac{23}{48} = 0.479\)

What if our function is not smooth enough?

What can we do if our function is not as smooth as we need (not differentiable or not many times differentiable at \(x = 0\))?

Can we still approximate it with a polynomial?

The answer is yes, and it is given by the following theorem.

The point is that we do not use the Taylor polynomial, but others.

Theorem (Weierstrass Approximation Theorem)

Let \(f\) be a continuous function defined on a closed interval \([a, b]\). Then there exists a sequence of polynomials that converges uniformly to \(f\) on \([a, b]\).

Suppose \(f: [a, b] \to \mathbb{R}\). We want to approximate it with polynomials.

image

Polygonal functions on \([a, b]\): Given a partition of \([a, b]\): \(P = (x_0, x_1, x_2, \dots, x_n), \quad x_0 = a, \quad x_n = b\) where \(a = x_0 < x_1 < x_2 < \dots < x_n = b\)

A polygonal function is a piecewise function such that it is a linear function (a line) in each interval \([x_i, x_{i+1}]\), \(0 \leq i \leq n - 1\)

Example

  1. \(f(x)=\sqrt{1-x}\) in \([0,1]\)

    image

    We could get \((0,1),(\frac{3}{4},\frac{1}{2}),(1,0)\)

    Then after computing we get \(f_{1}(x)=-\frac{2}{3}x+1\) in \([0,\frac{3}{4}]\) and \(f_2(x)=-2x+\frac{1}{2}\) in \((\frac{3}{4},1]\)​​

The Riemann Integral

What is an integral?

The first notion of an integral is related to the concept of the inverse process of differentiation. So, an integral of a function is a kind of anti-derivative or primitive function.

By studying the properties of primitives of known functions, eventually one realizes (Newton, Leibniz, Euler) that the primitive is related to the area determined by the graph of the function and the \(x\)-axis.

Obstacle with the notion of anti-derivative

The first obstacle with the notion of an anti-derivative or primitive is that the derivative of a function has some regularity.

For example, by the Intermediate Value Theorem, if a function \(F\) is differentiable in a closed interval \([a, b]\), and \(F'(a) < \alpha < F'(b)\), then there exists \(c \in (a, b)\) such that \(F'(c) = \alpha\).

Hence, a function as the one below cannot be a derivative of a function on the whole interval \([0,3]\):

If \(f(x) = F'(x)\), we have that \(F'(0) = 0 < \alpha < F'(3) = 1\), but there is no \(c \in (0,3)\) such that \(F'(c) = f(c) = \alpha\).

On the other hand, we can relate this function with the function given by computing the area determined by it and the \(x\)-axis.

Nevertheless, if the function is nice enough, the two notions are related via the so-called Fundamental Theorem of Calculus.

image

Arquímedes

Assume \(f:[a,b]\to \R\) be positive continuous

Idea: Approximate the area by rectangles image

The Riemann Integral of a Function

Refining the Partition

Question: If we refine the partition, that is, if we take more points, are the numbers \(L(f, P)\) and \(U(f, P)\) close to each other?

Definition

Let \(f: [a, b] \to \mathbb{R}\) be a function defined on a closed interval \([a, b]\) and let \(P = (x_0, x_1, \dots, x_n)\) be a partition of \([a, b]\).

image

The lower sum of \(f\) with respect to the partition \(P\) is: \(L(f, P) = \sum_{i=1}^{n} m_i \Delta x_i\)

The upper sum of \(f\) with respect to the partition \(P\) is: \(U(f, P) = \sum_{i=1}^{n} M_i \Delta x_i\)

where:

  • \(m_i = \inf\{ f(x) \mid x \in [x_{i-1}, x_i] \}\)
  • \(M_i = \sup\{ f(x) \mid x \in [x_{i-1}, x_i] \}\)
  • \(\Delta x_i = x_i - x_{i-1}\)

Remark

Given a partition \(P = (x_0, x_1, \dots, x_n)\) we have that: \(m_i \leq M_i \quad \forall 1 \leq i \leq n.\)

Thus, \(L(f, P) \leq U(f, P).\)

Comparing Lower and Upper Sums

The idea is to compare lower and upper sums for different partitions.

Definition: A partition \(Q\) of an interval \([a, b]\) is a refinement of a partition \(P\) if \(Q\) contains all the points of \(P\), that is, \(P \subseteq Q\).

If \(P = (x_0, x_1, \dots, x_n)\) then it is of the form: \(Q = (a = x_0 = z_0, z_1, z_2 = x_1, \dots, z_{m-1}, z_m = x_n = b).\)

image

Lemma

If \(P \subseteq Q\), then \(L(f,P)\leq L(f,Q)\text{ and }U(f,Q)\leq U(f,P)\) for all bounded functions \(f\) defined on \([a, b]\).