numerical methods for
differential equations and
applications
Professor: Camile Fraga Delfino Kunz
October 16th, 2018
What do we have for today?
A brief calculus review:
• What is the derivative of a function and what it’s relation
with the definitions of limit and continuity of a function?
• How can we use the derivatives of a function to
approximate this function by a polynomial?
What do we need to keep in mind?
Definition (Function):
• Consider A and B nonempty sets.
A function f from A to B is a rule that associates any
element x of A to exactly one element y = f (x) of B.
Vertical line test:
• Does the curves bellow show the graph of a function?
Why?
Limits
• Do you remember what does it mean to say that the limit
of a function exist on a point?
An example
x f (x) = x + 1 x f (x) = x + 1
0 1 2 3
0.5 1.5 1.5 2.5
0.6 1.6 1.4 2.4
0.7 1.7 1.3 2.3
0.8 1.8 1.2 2.2
0.9 1.9 1.1 2.1
0.95 1.95 1.05 2.05
0.96 1.96 1.04 2.04
0.99 1.99 1.01 2.01
Observe that more x gets near to 1, more f (x) gets near to 2.
Mathematically we write: limx−→1 (x + 1) = 2.
Definition of Limit
Intuitive
• Consider that f is defined on a neighborhood of a number
a (this means that f is defined on a open interval that
contains a, except possibly at a itself).
• If we can obtain values for f arbitrarily near from L taking
x near enough from a (by both sides of a), but not equal
to a, so we write:
lim f (x) = L
x−→a
and we say that the limit of f, as x approaches a, equals L.
Definition of Limit
Formal
• Suppose that f is defined on the neighborhood of a
number a, except possibly at a itself. We say that the
limit of f, as x approaches a, equals L, and write
lim f (x) = L
x−→a
if for every number > 0 there is a number δ > 0 such
that
if |x − a| < δ, then |f (x) − L| < .
Graphically
Definition of Limit
Exercise
• Show, the formal definition of limit, that:
lim 2x + 4 = 10
x−→3
• Question: how we go from 0 < |x − 3| < δ
to |(2x + 4) − 10| < ?
Definition of Limit
Solution
Let us find a relation between and δ:
|(2x + 4) − 10| <
|2x − 6| <
2|x − 3| <
|x − 3| <
2
So taking δ = might work!
2
Definition of Limit
Solution
Let us test if the previous relation is valid:
0 < |x − 3| < δ
0 < |x − 3| <
2
0 < 2|x − 3| <
0 < |2x − 6| <
0 < |(2x + 4) − 10| <
Yes, it works!
Definition: Right-Hand Limit
(
∀ > 0 , ∃ δ > 0 such that
lim f (x) = L ⇐⇒
x−→a+ a < x < a + δ =⇒ |f (x) − L| <
Definition: Left-Hand Limit
(
∀ > 0 , ∃ δ > 0 such that
lim f (x) = L ⇐⇒
x−→a− a − δ < x < a =⇒ |f (x) − L| <
Theorem One-Sided Limits
lim f (x) = L , if and only if, lim − f (x) = L and lim f (x) = L.
x−→a x−→a x−→a+
...is it clear?
Use the graph of g to state the values (if they exists):
a) lim g (x) b) lim g (x) c) lim g (x)
x−→2− x−→2+ x−→2
d) lim g (x) e) lim g (x) f) lim g (x)
x−→5− x−→5+ x−→5
Example
Find
lim f (x) and lim f (x)
x−→1+ x−→1−
such that
( 2
x , if x < 1
f (x) =
2x , if x > 1
Question: does the limit limx−→1 f (x) exist?
Example
Solution
lim f (x) = lim + 2x = 2
x−→1+ x−→1
lim − f (x) = lim − x 2 = 1
x−→1 x−→1
How limx−→1+ f (x) = 2 6= limx−→1− f (x) = 1, that is, the
one-sided limits are different from each other, so the limit
limx−→1 f (x) does not exist.
Limits on the infinity
Definition
(
∀ > 0 , ∃ δ > 0 such that
lim f (x) = L ⇐⇒
x−→+∞ x > δ =⇒ |f (x) − L| <
Infinite Limits
Definition
(
∀ > 0 , ∃ δ > 0 such that
lim f (x) = +∞ ⇐⇒
x−→a 0 < |x − a| < δ =⇒ f (x) >
saying that the limit of f, as x approaching a, is infinity, means
that f(x) can be made arbitrarily large as we approach to a.
Examples
Properties of Limits
Consider c a constant and suppose that the limits
limx−→a f (x) and limx−→a g (x) exist. Then:
1. lim [f (x) + g (x)] = lim f (x) + lim g (x)
x−→a x−→a x−→a
2. lim [f (x) − g (x)] = lim f (x) − lim g (x)
x−→a x−→a x−→a
3. lim [cf (x)] = c lim f (x)
x−→a x−→a
4. lim [f (x)g (x)] = lim f (x) . lim g (x)
x−→a x−→a x−→a
f (x) limx−→a f (x)
5. lim = if lim g (x) 6= 0
x−→a g (x) limx−→a g (x) x−→a
And now?
...we are going to understand the definition of continuity of a
function.
Why is it important to have a continuous function?
• Most of the problems on Engeneering, Biology and
Economy are modeled by piecewise continuous functions;
• Continuous functions have usefull properties that we can’t
find on noncontinuous ones;
• Many of the Calculus results are valid only for continuous
functions.
Definition
A function f is continuous on a point a if
lim f (x) = f (a)
x−→a
Note that the definition is satisfied if:
• f(a) is defined, that is, a belongs to the domain of f;
• limx−→a f (x) exists;
• limx−→a f (x) = f (a)
A function is continuous on a interval if it is continuous on
every points of the interval.
What is a discontinuous function?
Example 1: Removable Discontinuity
x2 − x − 2
f (x) =
x −2
Exemplo 2: Removable Discontinuity
2
x − x − 2 , if x 6= 2
f (x) = x −2
1, if x = 2
Example 3: Infinite Discontinuity
1
, if x 6= 0
f (x) = x2
1, if x = 0
Exemplo 4: Jump Discontinuities
f (x) = kxk
We can also define:
• f is continuous from the right at a number a if:
lim f (x) = f (a)
x−→a+
• f is continuous from the left at a number a if:
lim f (x) = f (a)
x−→a−
Squeeze Theorem
Consider f, g and h three functions and suppose that exists
r > 0 such that
f (x) ≤ g (x) ≤ h(x) , for 0 < |x − a| < r
Under this conditions, if
lim f (x) = L = lim h(x)
x−→a x−→a
then
lim g (x) = L
x−→a
The demonstration of the theorem can be found at [1].
The Intermediate Value Theorem
Suppose that f is continuous on the closed interval [a, b] and
let d be a number between f (a) and f (b), where f (a) 6= f (b).
Then exist a number c in (a, b) such that f (c) = d.
Question
...what it all has to do whit the concept of derivative?
Derivative
Introduction
• The problem of finding the tangent line to a curve and
the problem of finding the velocity of an object is related
to the same limit.
• This limit is called derivative and can be interpreted as
the rate of change as on science as on engineering.
Derivative
• Consider the problem of calculating the slope of the
tangent line to a curve on a point a.
• The slope of the secant line that goes through the points
x and a is:
f (x) − f (a)
m1 =
x −a
Derivative
• Observe that more x approaches a, better will de the
estimate for the slope of the tangent line to the curve at
the point a.
• Then, the slope of the tangent line is given by:
f (x) − f (a)
m = lim
x−→a x −a
whereas this limit exists.
Derivative
• Still considering
f (x) − f (a)
m = lim
x−→a x −a
we see that if we have x −→ a, we have (x − a) −→ 0.
• If we take h = x − a, the limit above can be rewritten as:
f (a + h) − f (a)
m = lim
h−→0 h
What is the derivative?
• Consider f a function and a a point on it’s domain. The
limit
f (x) − f (a)
lim
x−→a x −a
when exists, it’s finite.
• It is called derivative of f on a and we write f 0 (a):
f (x) − f (a)
f 0 (a) = lim
x−→a x −a
• If f admits derivative on a, then we say that f is
differentiable on a.
Example
Consider f (x) = x 2 . Valuate:
a) f 0 (1)
f (x) − f (1) x2 − 1
f 0 (1) = lim = lim = lim (x + 1) = 2
x−→1 x −1 x−→1 x − 1 x−→1
b) f 0 (x)
f (x + h) − f (x) (x + h)2 − x 2
f 0 (x) = lim = lim
h−→0 h h−→0 h
2xh + h2
= lim = lim (2x + h) = 2x
h−→0 h h−→0
Differentiation Rules
Consider f e g differentiables on the point a and let c be a
constant. So the functions f + g , kf e f .g are differentiable
on a and:
• (f + g )0 (a) = f 0 (a) + g 0 (a) ;
• (cf )0 (a) = c f 0 (a) ;
• (f .g )0 (a) = f 0 (a).g (a) + f (a).g 0 (a) ;
f 0 f 0 (a)g (a) − f (a)g 0 (a)
• (a) =
g [g (a)]2
Tip: to demonstrate them use the definition of derivative and
the limit properties.
What are the conditions to a function be
differentiable?
Example:
The function f (x) = |x| is not differentiable on a = 0, because
(
f (x) − f (0) |x| 1 , if x > 0
= =
x −0 x −1 , if x < 0
Then
f (x) − f (0) f (x) − f (0)
lim + = 1 e lim − = −1
x−→0 x −0 x−→0 x −0
f (x) − f (0)
therefore, the limit limx−→0 does not exist and f is
x −0
not differentiable on x = 0.
Derivability and continuity
• From the last example, we see that continuity does not
imply derivability.
• But derivability implies continuity.
• A function is differentiable if it’s derivative is a
continuous function.
Approximation of functions
Taylor polynomial of order n
Suppose that f is differentiable until the n-th order on the
interval I and consider x0 ∈ I . The polynomial
f 00 (x0 ) f (n) (x0 )
Pn (x) = f (x0 ) + f 0 (x0 )(x − x0 ) + (x − x0 )2 + . . . + (x − x0 )n+1
2! n!
is called Taylor polynomial, of order n, around x0 .
Approximation of functions
Taylor’s Theorem
Suppose f differentiable until the order n + 1 on the interval I
and consider x, x0 ∈ I . Then exist at least one x̄ on the open
interval in the open interval with extremes x and x0 such that:
f (n+1) (x̄)
f (x) = Pn (x) + (x − x0 )n+1
(n + 1)!
What does it mean?
Approximation of functions
Taylor’s Theorem
f (n+1) (x̄)
f (x) = Pn (x) + (x − x0 )n+1
| {z } (n + 1)!
Taylor’s polynomial | {z }
Lagrange’s remainder
Obs: If we write f (x) = Pn (x) + Rn (x), the Lagrange’s
remainder is given by Rn (x) = f (x) − Pn (x) and satisfies [1]:
M
|Rn (x)| ≤ |x − x0 |n+1
(n + 1)!
for |f (n+1) (x)| ≤ M.
Taylor’s Theorem
f (x) = Pn (x) + Rn (x)
| {z } | {z }
Taylor’s polynomial Lagrange’s remainder
What does it mean?
The Taylor’s polynomial, of order n, of f around x0 is the only
polynomial of degree at maximum n that approximates f
locally such that the error converges to zero faster than
(x − x0 )n when x −→ x0 .
Observe that the error on the approximation is
E (x) = |f (x) − Pn (x)| = |Rn (x)|,
which is superior bounded by a polynomial of degree n + 1.
About the error order
An example
We can approximate e x around x0 = 0 using:
e x = 1 + x + o(x 2 ) (1st order approx.)
x2
ex = 1 + x + + o(x 3 ) (2nd order approx.)
2
... let’s see how the error behaves on each approximation.
About the error order
On the 1st order approximation the error behaves as a 2nd degree
polynomial, and for the 2nd order of approximation the error behaves as
3rd degree polynomial.
Exercises
1) Determine the Taylor polynomial, of order 2, for f around
the given point x0 :
a) f (x) = ln(1 + x) x0 = 0
x
b) f (x) = e x0 = 0
√
c) f (x) = x) x0 = 1
d) f (x) = sin(x) x0 = 0
References
1. Stewart, J. Calculus., 7th ed, Cengage Learning, 2013.
2. Guidorizzi, H. L. Um curso de Cálculo, vol. 1, São Paulo,
LTC, 5a Ed., 2001.