0% found this document useful (0 votes)
11 views7 pages

Sol 1

The document consists of exercise problems and solutions related to continuity in mathematics, particularly in the context of functions and their properties. It covers various functions, including rational, irrational, and piecewise functions, and provides proofs of continuity and discontinuity using theorems and ε-δ criteria. Additionally, it includes Python code for implementing floor and ceiling functions and discusses their continuity.

Uploaded by

Gergely Terényi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views7 pages

Sol 1

The document consists of exercise problems and solutions related to continuity in mathematics, particularly in the context of functions and their properties. It covers various functions, including rational, irrational, and piecewise functions, and provides proofs of continuity and discontinuity using theorems and ε-δ criteria. Additionally, it includes Python code for implementing floor and ceiling functions and discusses their continuity.

Uploaded by

Gergely Terényi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Mathematics for AI 2 Exercise Sheet 1 SS24

1. (a) Using only the fact that constant functions, x and sin(x) are continuous and
the computation rules for continuous functions prove that

x3 + cos(x)2 + πx − 2
f (x) =
x2 + π
is continuous as a function from R to R.
(b) Let the function f : R → R be defined by

x2 + 2 cos(x) − max(0, x)
f (x) := q .
ln(|x3 − 1| + 2) + π x

Cite all necessary arguments to argue that f is continuous.


Solution:

(a) Since multiples of continuous functions are continuous, then −2, π and πx
are continuous. As the product of continuous functions is continuous, it
follows that x2 is continuous, as well as x3 . Since 1 and sin(x) are continuous
functions, hence sin(x)2 is again a continuous function as the product of
two continuous functions is continuous. Then, the fact that cos(x)2 = 1 −
sin(x)2 implies that cos(x)2 is a continuous function as the sums of continuous
functions are continuous. Further, it follows that x3 + πx − 2 and x2 +
π are continuous. Quotients of continuous functions are continuous if the
denominator is not zero. Since x2 + π ̸= 0 for all x ∈ R, the function f is
continuous.
(b) • Theorem 4.4 (the cosine function is continuous)
• Lemma 4.9 (the absolute value of continuous function is continuous)
• Lemma 4.10 (the maximum of continuous functions is continuous)
• Example on page 154 (the root function is continuous)
• Example on page 155 (polynomials are continuous)
• Theorem 4.3 (the exponential function is continuous)
• Theorem 4.7 (the sum, product, and quotient, where defined, of two
continuous functions is continuous)
• Theorem 4.8 (the composition of two continuous functions is continuous)

1
Mathematics for AI 2 Exercise Sheet 1 SS24

2. Determine the largest domain of the following functions and check their continuity
using the appropriate arguments.

• h1 (x) = 1
x

• h2 (x) = x
• h3 (x) = √1
x

• h4 (x) = √ 1
x2 +1

• h5 (x) = ln( √x12 +1 )


• h6 (x) = cos(ln(x))
• h7 (x) = ln(cos(x))

Solution:

• The domain of h1 is D1 = R \ {0}. Let f (x) = 1, g(x) = x, since f, g are


continuous and g(x) ̸= 0 for all x ∈ D1 . Using Theorem 4.7, we obtain
h1 (x) = fg is continuous.
• The domain of h2 is R≥0 , h2 is continuous thanks to the Example on page
154.

• The domain of h3 is D3 = R>0 . Again if we let f (x) = 1, g(x) = x, since
f, g are continuous and g(x) ̸= 0 for all x ∈ D3 . Using Theorem 4.7, we
obtain h3 (x) = fg is continuous.

• The domain of h4 is D4 = R. Let f (x) = 1, g(x) = x and k(x) = x2 , since
f, g and k are continuous in view of Theorem 4.8 it turns out that g(k(x) +
f (x)) is continuous as composition of continuous functions. Furthermore,
since g(k(x) + f (x)) ̸= 0 for all x ∈ D4 . Using Theorem 4.7, we obtain
h4 (x) = g(k+f
f
)
is continuous.
• The domain of h5 is D5 = R. Since we know that f (x) = ln(x) is defined and
continuous on R>0 and that h4 is a continuous function from R to R>0 , then
in view of Theorem 4.8 it follows that f (h4 ) is continuous.
• The domain of h6 is D6 = R>0 . Again the fact that f (x) = ln(x) is defined
and continuous on D6 and that g(x) = cos(x) is a continuous function on R.
Using Theorem 4.8 it follows that g ◦ f .
• The domain of h7 is D7 = {x ∈ R : − π2 < x − 2πn < π2 where n ∈ Z}. Since
g(x) = cos(x) is a continuous function from D7 to (0, 1], and that f (x) = ln(x)
is defined and continuous on g(D7 ). Using Theorem 4.8 it follows that f ◦ g
is continuous.

2
Mathematics for AI 2 Exercise Sheet 1 SS24

3. Let x ∈ R, then the floor and ceiling functions can be defined as follows:
f loor(x) :=⌊x⌋ = max{m ∈ Z | m ≤ x},
ceiling(x) :=⌈x⌉ = min{n ∈ Z | n ≥ x}.
• Plot both functions on the interval [−13, 3] using any software of your choice.
• Write a Python script regarding the implementation of the floor and ceiling
functions without using any external packages.
• Study the continuity of the floor and ceiling functions.
Solution:


Listing 1: Python code
• # Floor function implementation
def f l o o r ( x ) :
i f ( x >= 0 or int ( x)−x==0):
return int ( x )
else :
return int ( x ) − 1
# Ceiling function implementation
def c e i l i n g ( x ) :
i f ( x >= 0 and int ( x)−x !=0) :
return int ( x ) + 1
else :
return int ( x )

# Test v a l u e s
t e s t _ v a l u e s = [ −3 , 3 , 2 . 3 , 4 . 8 , −3.5 , 7 . 1 ]

# C a l c u l a t e f l o o r and c e i l i n g f o r each t e s t v a l u e
for v a l in t e s t _ v a l u e s :
print ( f " ␣ Input ␣ : ␣{ v a l }␣ " )
print ( f " ␣ F l o o r ␣ : ␣{␣ f l o o r ␣ ( ␣ v a l ␣ )} ␣ " )
print ( f " ␣ C e i l i n g ␣ : ␣{␣ c e i l i n g ␣ ( ␣ v a l ␣ )} ␣ " )
print ( )

3
Mathematics for AI 2 Exercise Sheet 1 SS24

• The floor function f (x) = ⌊x⌋ is continuous in every open interval between
integers, (n, n + 1) for any integer n. However, it is not continuous at any
integer n.
To prove that the floor function, denoted by ⌊x⌋, is not continuous, we can
show that it fails to satisfy the definition of continuity at certain points.
Let’s consider the point x = n, where n is an integer.
For any x in the interval (n, n + 1), the floor function takes the value n.
However, as we approach x = n from the left, i.e., as x approaches n from
the interval (n − 1, n), the function jumps from n − 1 to n. This means that
there exists a discontinuity at every integer n.
Formally, let’s show this using the definition of continuity at x = n:
Let ε = 12 , then for any δ > 0, if we consider x = n− 2δ , which is in the interval
(n − 1, n) then |x − n| < δ. However, |⌊x⌋ − ⌊n⌋| = |(n − 1) − n| = 1 > ε.
Thus, the floor function fails to satisfy the definition of continuity at x = n.
Since there are discontinuities at every integer, the floor function is not con-
tinuous over its entire domain. Therefore, we have proven that the floor
function is not continuous.
The same argument can be used to show that ⌈x⌉ is not continuous. In fact,
for any x in the interval (n − 1, n), the ceiling function takes the value n.
However, as we approach x = n from the right, i.e., as x approaches n from
the interval (n, n + 1), the function jumps from n to n + 1. This means that
there exists a discontinuity at every integer n. Formally, let ε = 21 , for any
choose δ > 0 if we consider x = n + 2δ , which is in the interval (n, n + 1), it
follows that |x − n| < δ. However, |⌈x⌉ − ⌈n⌉| = |(n + 1) − n| = 1 > ε. Thus,
the ceiling function fails to satisfy the definition of continuity at x = n.

4
Mathematics for AI 2 Exercise Sheet 1 SS24

4. (a) Give an example of functions f : R → R and g : R → R such that the


function defined by h(x) := f (x) + g(x) is continuous but f and g are not
continuous. Can you find f and g that are nowhere continuous, but h is a
continuous function.
(b) Let f : R → R defined by

x if x is rational
(
f (x) :=
x2 if x is irrational

using Theorem 4.2, prove that f is continuous at 1 and discontinuous at 2.


Solution:

(a) Let

0 if x > 0 1 if x > 0
(
f (x) := and g(x) :=
1 if x ≤ 0 0 if x ≤ 0

Then both f (x) and g(x) are discontinuous at 0. However, h(x) := f (x)+
g(x) = 1 for all x ∈ R. which is continuous everywhere.
Let
 
 1 if x ∈ Q −1 if x ∈ Q
f (x) :=  and g(x) := 
0 if x ∈ R \ Q 0 if x ∈ R \ Q

Then both f (x) and g(x) are discontinuous everywhere. However, h(x) =
f (x) + g(x) = 0 for all x ∈ R, i.e., continuous everywhere.
n o
(b) For the continuity at 1. Let ϵ > 0, choose δ = min 1, 3ϵ , then,

|x − 1| < δ =⇒ |x + 1| = |x − 1 + 2| ≤ |x − 1| + 2 < 3

Hence,

if x is rational |x − 1|
(
|f (x) − 1| =
if x is irrational |x2 − 1| = |x + 1||x − 1|

hence in both cases we have |f (x) − 1| ≤ 3|x − 1| < 3δ = ϵ. Therefore, f (x)


is continuous at 1 . For the discontinuity at 2. In view of Theorem 4.2, f is
discontinuous at 2, if there exists ϵ > 0 such that for any δ > 0, there exists
x satisfying |x − 2| < δ but |f (x) − f (2)| ≥ ϵ.
Now take ϵ = 1, then for any δ, we can find an irrational number x in (2, 2+ 2δ )
that is |x − 2| < δ, and such that,

|f (x) − f (2)| = x2 − 2 = x2 − 2 > 22 − 2 = 4 − 2 = 2 > 1

Then, we have f is discontinuous at 2.

5
Mathematics for AI 2 Exercise Sheet 1 SS24

5. Use the ε − δ−criterion to show that the following functions are discontinuous.:

0, x < −1




x = −1

1
,

−1, x < 0
 

 2
 


sgn(x) := 0, x = 0 , rect(x) := 1, x ∈ (−1, 1)
1, x > 0
 
x=1
 
1
,





 2
0, x > 1

Solution:
If sgn were continuous at 0, it would have to hold that

∀ε > 0 ∃δ > 0 ∀x ∈ R : |x − 0| < δ ⇒ | sgn(x) − sgn(0)| < ε

However, we show that this does not hold for ε = 12 and any δ > 0. Consider
x = δ/2, then |x − 0| < δ, but | sgn(x) − sgn(0)| = |1 − 0| = 1 > ϵ.
Suppose rect were continuous at 1 and −1, then:

∀ε > 0 ∃δ > 0 ∀x ∈ R : |x − 1| < δ ⇒ | rect(x) − rect(1)| < ε,

and
∀ε > 0 ∃δ > 0 ∀x ∈ R : |x + 1| < δ ⇒ | rect(x) − rect(−1)| < ε.
Yet, we disprove this for ε = 14 and any δ > 0. Let x = 1 + 2δ , then |x − 1| < δ,
but | rect(x) − rect(1)| = |0 − 21 | = 21 > ϵ.
Similarly we can conclude that rect is not continuous at −1 if we select a sequence
xn = −1 − 2δ and ε = 41 .

6
Mathematics for AI 2 Exercise Sheet 1 SS24

6. Use the ε − δ−criterion to show that the following functions are continuous:
 
 0, x < 0  1 x, x<0
ReLU(x) := , LeakyReLU(x) := 2
 x, x ≥ 0  x, x ≥ 0

Solution:
To prove the continuity of the ReLU function at any point c ∈ R, first we observe
that ReLU is continuous for both for x > 0 and x < 0 given that both the identity
and the constant functions are continuous in their domains of definition. Thus,
we need to check the continuity of ReLU at x = 0. That is we need to show that
for any ϵ > 0, there exists a δ > 0 (may depend on ϵ) such that for all x ∈ R
satisfying |x − 0| = |x| < δ, we have |ReLU (x) − ReLU (0)| = |ReLU (x)| < ϵ. Our
aim is to find δ that satisfies the previous claim.

• If x < 0, then ReLU (x) = 0 hence it is enough to let δ = ϵ.


• If x > 0, then ReLU (x) = x, and |ReLU (x)| = x < ϵ holds true if we let
δ = ϵ.

Thus, the ReLU function is continuous at any point c, and the proof is complete.
In order to prove continuity of the LeakyReLU function, we argue as in the
previous case of ReLU . That is, since LeakyReLU is continuous for both for
x > 0 and x < 0 given that linear functions are continuous in their domains of
definition. Thus, we need to check the continuity of LeakyReLU at x = 0.

• If x < 0, then LeakyReLU (x) = 21 x hence it is enough to let δ = 2ϵ, hence


for any |x−0| = |x| < 2ϵ it follows that |LeakyReLU (x)−LeakyReLU (0)| =
|LeakyReLU (x)| < ϵ.
• If x > 0, then LeakyReLU (x) = x, and |LeakyReLU (x)| = x < ϵ holds true
if we let δ = ϵ.

Thus, if we select δ = min(ϵ, 2ϵ) = ϵ, then the LeakyReLU function is continuous


at 0 and therefore at any point c, and the proof is complete.

You might also like