Basics of real analysis#
ECON2125/6012 Lecture 4
Fedor Iskhakov
Announcements & Reminders
The first test is due before the next lecture!
The test will be published tomorrow (before midnight on Friday)
The test will include multiple choice questions (where multiple options can be correct), True/False questions and open response questions where you may need to upload a file
Please, find the practice test on Wattle and make sure you are comfortable with the setup, including uploading an image/pdf file
Tests are timed: practice paying attention to the countdown timer
The deadline for submission of the first test is midnight on Wednesday, August 23
I am traveling next week, no face-to-face lecture on August 24!
Plan for this lecture
Continuing with revision of fundamental concepts and ideas
Sequences
Convergence and limits
Differentiation, Taylor series
Analysis in
Open and closed sets
Continuity of functions
Mainly review of key ideas
Supplementary reading:
Simon & Blume: 12.1, 12.2, 12.3, 12.4, 12.5 10.1, 10.2, 10.3, 10.4, 13.4
Sundaram: 1.1.1, 1.1.2, 1.2.1, 1.2.2, 1.2.3, 1.2.7, 1.2.8, 1.4.1
Analysis in #
Example
Let
Or: we want to solve an equation

Fig. 31 Existence of a root#

Fig. 32 Non-existence of a root#
One answer: a solution exists under certain conditions including continuity.
Questions:
So how can I tell if
is continuous?Can we weaken the continuity assumption?
Does this work in multiple dimensions?
When is the root unique?
How can we compute it?
These are typical problems in analysis
Bounded sets#
Definition
The absolute value of
Show code cell source
import numpy as np
import matplotlib.pyplot as plt
def subplots():
"Custom subplots with axes throught the origin"
fig, ax = plt.subplots()
# Set the axes through the origin
for spine in ['left', 'bottom']:
ax.spines[spine].set_position('zero')
for spine in ['right', 'top']:
ax.spines[spine].set_color('none')
ax.grid()
return fig, ax
fig, ax = subplots()
ax.set_ylim(-3, 3)
ax.set_yticks((-3, -2, -1, 1, 2, 3))
x = np.linspace(-3, 3, 100)
ax.plot(x, np.abs(x), 'g-', lw=2, alpha=0.7, label=r'$f(x) = |x|$')
ax.plot(x, x, 'k--', lw=2, alpha=0.7, label=r'$f(x) = x$')
ax.legend(loc='lower right')
plt.show()
Fact
For any
if and only if if and only if if and only if
Last inequality is called the triangle inequality
Using these rules, let’s show that if
Proof
Hint:
Definition

Example
Every finite subset
Set
Example
For any
Example
Proof
We have to show that each
Cases:
Fact
If
Proof
Let
By definition,
Let
Epsilon-balls ( -balls)#
Definition
Given
Equivalently,

Exercise: Check equivalence
Fact
If
Proof
Suppose to the contrary that
is in every -ball around and yet
Since
Set
Since
This means that
That is,
Contradiction!
Fact
If

Proof
Let
If we set
To see this, suppose to the contrary that
Then
But then
Contradiction!
Sequences#
Definition
A sequence is a function from
To each
Typically written as
Example
Definition
Sequence
bounded if
is a bounded setmonotone increasing if
for allmonotone decreasing if
for allmonotone if it is either monotone increasing or monotone decreasing
Example
is monotone decreasing, bounded is not monotone but is bounded is monotone increasing but not bounded
Convergence#
Let
Suppose, for any
Then
Convergence to
The sequence

…and this one

…and this one

…and this one

Definition
The point
if
We call
Example
To prove this must show that
To show this formally we need to come up with an “algorithm”
You give me any
I respond with an
such that equation above holds
In general, as
Proof
Here’s how to do this for the case
First pick an arbitrary
Now we have to come up with an
Let
Then
Remark: Any
Example
The sequence
Proof
Must show that,
So pick any
Hence we take
Then
What if we want to show that
To show convergence fails we need to show the negation of
Negation: there is an
More specifically,
One way to say this: there exists a
This is the kind of picture we’re thinking of
Show code cell source
from __future__ import division
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import rc
rc('font',**{'family':'serif','serif':['Palatino']})
rc('text', usetex=True)
N = 80
epsilon = 0.15
a = 1
def x(n):
return 1 + 1/(n**(0.7)) - 0.3 * (n % 8 == 0)
def subplots(fs):
"Custom subplots with axes throught the origin"
fig, ax = plt.subplots(figsize=fs)
# Set the axes through the origin
for spine in ['left', 'bottom']:
ax.spines[spine].set_position('zero')
for spine in ['right', 'top']:
ax.spines[spine].set_color('none')
return fig, ax
fig, ax = subplots((9, 5))
xmin, xmax = 0.5, N+1
ax.set_xlim(xmin, xmax)
ax.set_ylim(0, 2)
n = np.arange(1, N+1)
ax.set_xticks([])
ax.plot(n, x(n), 'ko', label=r'$x_n$', alpha=0.8)
ax.hlines(a, xmin, xmax, color='k', lw=0.5, label='$a$')
ax.hlines([a - epsilon, a + epsilon], xmin, xmax, color='k', lw=0.5, linestyles='dashed')
ax.fill_between((xmin, xmax), a - epsilon, a + epsilon, facecolor='blue', alpha=0.1)
ax.set_yticks((a - epsilon, a, a + epsilon))
ax.set_yticklabels((r'$a - \epsilon$', r'$a$', r'$a + \epsilon$'))
ax.legend(loc='upper right', frameon=False, fontsize=14)
plt.show()
Example
The sequence
Proof
This is what we want to show
Since it’s a “there exists”, we need to come up with such an
Let’s try
We have:
If
is odd then when for any .If
is even then when for any .
Therefore even if
Properties of Limits#
Fact
Let
Proof
Compare the definitions:
, s.t. , s.t.
Clearly these statements are equivalent
Fact
Each sequence in
Proof
Suppose instead that
Take disjoint

Since
s.t. s.t.
But then
Contradiction, as the balls are assumed disjoint
Fact
Every convergent sequence is bounded
Proof
Let
Fix any
Regarded as sets,
Both of these sets are bounded
First because finite sets are bounded
Second because
is bounded
Further, finite unions of bounded sets are bounded
Operations with limits#
Here are some basic tools for working with limits
Fact
If
when and are for all
Let’s check that
Proof
Fix
Need to find
Note that
by triangle inequality such that by definition of the limit such that by definition of the limit as well
Take
Combining the inequalities above concludes the proof.
Let’s also check the claim that
Proof
Suppose instead that
Take disjoint

There exists an
But then
In words: “Weak inequalities are preserved under limits”
Here’s another property of limits, called the “squeeze theorem”
Fact
Let
for all and
then
Proof
Pick any
We can choose an
such that such that
Exercise: Show that
Infinite Sums#
Definition
Let
Then the infinite sum of
Thus,
Other notation:
Example
If
Exercise: show that
Example
If
Fact
If
Proof
Suppose to the contrary that
Then
Because
But then
In other words,
Cauchy Sequences#
Informal definition: Cauchy sequences are those where

Example
Sequences generated by iterative methods for solving nonlinear equations often have this property
Show code cell source
f = lambda x: -4*x**3+5*x+1
g = lambda x: -12*x**2+5
def newton(fun,grad,x0,tol=1e-6,maxiter=100,callback=None):
'''Newton method for solving equation f(x)=0
with given tolerance and number of iterations.
Callback function is invoked at each iteration if given.
'''
for i in range(maxiter):
x1 = x0 - fun(x0)/grad(x0)
err = abs(x1-x0)
if callback != None: callback(err=err,x0=x0,x1=x1,iter=i)
if err<tol: break
x0 = x1
else:
raise RuntimeError('Failed to converge in %d iterations'%maxiter)
return (x0+x1)/2
def print_err(iter,err,**kwargs):
x = kwargs['x'] if 'x' in kwargs.keys() else kwargs['x0']
print('{:4d}: x = {:14.8f} diff = {:14.10f}'.format(iter,x,err))
print('Newton method')
res = newton(f,g,x0=123.45,callback=print_err,tol=1e-10)
Newton method
0: x = 123.45000000 diff = 41.1477443465
1: x = 82.30225565 diff = 27.4306976138
2: x = 54.87155804 diff = 18.2854286376
3: x = 36.58612940 diff = 12.1877193931
4: x = 24.39841001 diff = 8.1212701971
5: x = 16.27713981 diff = 5.4083058492
6: x = 10.86883396 diff = 3.5965889909
7: x = 7.27224497 diff = 2.3839931063
8: x = 4.88825187 diff = 1.5680338561
9: x = 3.32021801 diff = 1.0119341175
10: x = 2.30828389 diff = 0.6219125117
11: x = 1.68637138 diff = 0.3347943714
12: x = 1.35157701 diff = 0.1251775194
13: x = 1.22639949 diff = 0.0188751183
14: x = 1.20752437 diff = 0.0004173878
15: x = 1.20710698 diff = 0.0000002022
16: x = 1.20710678 diff = 0.0000000000
Cauchy sequences “look like” they are converging to something
A key axiom of analysis is that such sequences do converge to something — details follow
Definition
A sequence
Example
Proof
For any
Fix
We can show that
Hence any integer
Fact
For any sequence the following equivalence holds: convergent
Proof
Proof of
Let
Fix
We can choose
For this
Proof of
This is basically an axiom in the definition of
Either
We assume it, or
We assume something else that’s essentially equivalent
Implications:
There are no “gaps” in the real line
To check
converges to something we just need to check Cauchy property
Fact
Every bounded monotone sequence in
Sketch of the proof:
Suffices to show that
Suppose not
Then no matter how far we go down the sequence we can find another jump
of size
Since monotone, all the jumps are in the same direction
But then
Full proof: See any text on analysis
Subsequences#
Definition
A sequence
is a subset ofthe indices
are strictly increasing
Example
In this case
Example
Fact
Every sequence has a monotone subsequence
Proof omitted
Example
The sequence
This leads us to the famous Bolzano-Weierstrass theorem, to be used later when we discuss optimization.
Fact: Bolzano-Weierstrass theorem
Every bounded sequence in
Proof
Let
There exists a monotone subsequence
which is itself a bounded sequence (why?)
and hence both monotone and bounded
Every bounded monotone sequence converges
Hence
Derivatives#
Definition
Let
Let
If there exists a constant
for every
is said to be differentiable at is called the derivative of at

Example
Let
Fix any
We have
Example
Let
This function is not differentiable at
Indeed, if
On the other hand, if
Taylor series#
Loosely speaking, if
for
on a slightly wider interval, etc.
These are the 1st and 2nd order Taylor series approximations
to
As the order goes higher we get better approximation

Fig. 33 4th order Taylor series for

Fig. 34 6th order Taylor series for

Fig. 35 8th order Taylor series for

Fig. 36 10th order Taylor series for
Analysis in #
Now we switch from studying points
Replace distance
with
Many of the same results go through otherwise unchanged
We state the analogous results briefly since
You already have the intuition from
Similar arguments, just replacing
with
We’ll spend longer on things that are different
Norm and distance#
Definition
The (Euclidean) norm of
Interpretation:
represents the length of represents distance between and

Fig. 37 Length of red line

Fig. 38 Length of red line
Fact
For any
and if and only if (triangle inequality) (Cauchy-Schwarz inequality)
For example, let’s show that
First let’s assume that
Since
That is
Next let’s assume that
This is immediate from the definition of the norm
Bounded sets and -balls#
Definition
A set
Remarks:
A generalization of the scalar definition
When
, the norm reduces to
Fact
If
Proof: Same as the scalar case — just replace
Exercise: Check it
Definition
For

Fact
If
Fact
If
Definition
A sequence
Definition
Sequence
We say: “
In this case
Definition
We call



Vector vs Componentwise Convergence#
Fact
A sequence
That is,

From Scalar to Vector Analysis#
More definitions analogous to scalar case:
Definition
A sequence
Definition
A sequence
is a subset ofthe indices
are strictly increasing
Fact
Analogous to the scalar case,
in if and only if inIf
and thenIf
and thenIf
and thenEach sequence in
has at most one limitEvery convergent sequence in
is boundedEvery convergent sequence in
is CauchyEvery Cauchy sequence in
is convergent
Exercise: Adapt proofs given for the scalar case to these results
Example
Let’s check that
Proof
in means that
in means that
Obviously equivalent
Reminder — these facts are more general than scalar ones!
True for any finite
So true for
This recovers the corresponding scalar fact
You can forget the scalar fact if you remember the vector one
Fact
If

Fig. 39 Convergence of subsequences#
Infinite Sums in #
Analogous to the scalar case, an infinite sum in
Definition
If
In other words,
Open and Closed Sets#
Let
Definition
We call
Loosely speaking, interior means “not on the boundary”

Example
If

Proof
Fix any
Let
If
Exercise: Show
Example
If

Intuitively, any
More formally, pick any
There exists a
For example, consider the point
Exercise: Check this point: lies in
Definition
A set
Example
Open sets:
any “open” interval
, since we showed all points are interiorany “open” ball
itself
Example
Sets that are not open
because is not interior because is not interior
Closed Sets#
Definition
A set
Rephrased: If
Example
All of
Example
If
Proof
True because
is a sequence in converging to ,and yet
Example
If
Proof
Take any sequence
for all for some
We claim that
Recall that (weak) inequalities are preserved under limits:
for all and , so for all and , so
therefore
Example
Any “hyperplane” of the form
is closed
Proof
Fix
Let
We claim that
Since
Properties of Open and Closed Sets#
Fact
Proof
First prove necessity
Pick any
Suppose to the contrary that
Then
Since
This contradicts
Next prove sufficiency
Pick any closed
Suppose to the contrary that
Then exists some non-interior
Then it is possible to find a sequence
This contradicts the fact that
Example
Any singleton
Proof
Let’s prove this by showing that
Pick any
We claim that
Since
Therefore, exists
In particular,
Therefore
Since
Fact
Any union of open sets is open
Any intersection of closed sets is closed
Proof
Proof of first fact:
Let
We claim that any given
Pick any
By definition,
Since
But
In other words,
But be careful:
An infinite intersection of open sets is not necessarily open
An infinite union of closed sets is not necessarily closed
For example, if
To see this, suppose that
Then
Therefore
On the other hand, if
Fact
If
Take any sequence
Since
Therefore it has a convergent subsequence
Since the subsequence is also contained in
Definition
Bounded and closed sets are called compact sets or compacts
Continuity#
One of the most fundamental properties of functions
Related to existence of
optima
roots
fixed points
etc
as well as a variety of other useful concepts
Definition
A function
Fact
If
Proof
Proof for the case
Let
Fix any
Applying the triangle inequality gives
Since
Let
Definition
Requires that
converges for each choice of ,The limit is always the same, and that limit is
Definition

Fig. 40 Continuity#

Fig. 41 Discontinuity at
Example
Let
The function
To see this take
any
any
By the definition of the matrix norm
Exercise: Exactly what rules are we using here?
Fact
If
Fact
Some functions known to be continuous on their domains:
Example
Discontinuous at zero:
Fact
Let
If
and are continuous at then so is , where
If
is continuous at then so is , where
If
and are continuous at and real valued then so is , where
In the latter case, if in addition
As a result, set of continuous functions is “closed” under elementary arithmetic operations
Example
The function
is continuous
Proof
Just repeatedly apply the rules on the previous slide
Let’s just check that
Let
Pick any
We claim that
By assumption,
From this and the triangle inequality we get
Extra material#
Watch excellent video by Grant Sanderson (3blue1brown) on limits, and continue onto his whole amazing series on calculus