<<

Math.Comput.Sci. (2017) 11:363–381 DOI 10.1007/s11786-017-0321-5 in Computer Science

Familiarizing Students with Definition of Lebesgue : Examples of Calculation Directly from Its Definition Using Mathematica

Włodzimierz Wojas · Jan Krupa

Received: 7 December 2016 / Revised: 19 April 2017 / Accepted: 20 April 2017 / Published online: 30 May 2017 © The Author(s) 2017. This article is an open access publication

Abstract We present in this paper several examples of Lebesgue integral calculated directly from its definitions using Mathematica. Calculation of Riemann directly from its definitions for some elementary functions is standard in higher mathematics education. But it is difficult to find analogical examples for Lebesgue integral in the available literature. The paper contains Mathematica codes which we prepared to calculate symbolically Lebesgue sums and limits of sums. We also visualize the graphs of simple functions used for approximation of the integrals. We also show how to calculate the needed sums and limits by hand (without CAS). We compare our calculations in Mathematica with calculations in some other CAS programs such as wxMaxima, MuPAD and Sage for the same integrals.

Keywords Higher education · Lebesgue integral · Application of CAS · Mathematica · Mathematical didactics

Mathematics Subject Classification 97R20 · 97I50 · 97B40

1 Introduction

Young man, in mathematics you don’t understand things. You just get used to them John von Neumann

I hear and I forget. I see and I remember. I do and I understand Chinese Quote

Electronic Supplementary material The online version of this article (doi:10.1007/s11786-017-0321-5) contains supplementary material, which is available to authorized users.

W. Wojas · J. Krupa (B) Department of Applied Mathematics, Warsaw University of Life Sciences (SGGW), ul. Nowoursynowska 159, 02-776 Warsaw, Poland e-mail: [email protected] W. Wojas e-mail: [email protected] 364 W. Wojas, J. Krupa

In popular books of , for example [3,7,12], we can find many examples of calculated directly from its definition. The aim of these examples is to familiarize students with the definition of Riemann integral. But we cannot find analogical examples for Lebesgue integral. In this article, with similar aim but for Lebesgue integral definition, we present the following examples of π/2 ( ) 1 ( ) ( ) π ( − + 2) ( ) > calculation directly from its definition: 0 sin x dm x , 0 exp x dm x , 0 ln 1 2r cos x r dm x (r 1), 1 xk dm(x) (k ∈ N), 1 x2 dm(x) where dm(x) denotes the Lebesgue on the . The way we 0 −1    1 ( ) 1 2 ( ) 1 3 ( ) presented we may also calculate e.g. 0 x dm x , 0 x dm x , 0 x dm x . We also consider the calculation of 1 2 ( ) 1 1/m ( ) ∈ N b χ ( ) e ( ) integrals 0 x dm x , 0 x dm x (m ), a [a,b]\Q dm x , 1 ln x dm x using “partition the range of f ” Lebesgue philosophy. We calculate sums, limits and plot graphs of needed simple functions using Mathematica.

2 Definitions of Lebesgue Integral

The following two definitions of Lebesgue integral are used in the first part of this article: Let (R, M, m) be the measure , where M is σ -algebra of Lebesgue measurable subsets in R, and m is the on R. Let R be extended real numbers R with two more elements adjoined, denoted +∞ and −∞.LetA be Lebesgue measurable subset of R. A real-valued f on A is called simple if it assumes only finitely many distinct values. Let f : A → R be measurable nonnegative function (we’ve omitted the definition of Lebesgue integral for simple real measurable functions).

Definition 1 (See [4,6,8,10,13])     f dm(x) = sup s dm(x) : 0 ≤ s ≤ f, s : A → R is simple . (2.1) A A

Definition 2 (See [1,11,15]) Let sn : A → R be nondecreasing sequence of nonnegative simple measurable functions such that limn→∞ sn(x) = f (x) for every x ∈ A. Then:   f dm(x) = lim s dm(x). (2.2) →∞ n A n A

We stress the fact that the value of the Lebesgue integral of function f in the Definition 2 is independent of the choice of the sequence sn. The proof of this fact can be found in [1, p. 130, Theorem 17.5.] and in [11, p. 300], [15, p. 289, Theorem 4.6]. The equivalence of the two definitions follows from the Lebesgue’s Monotone convergence theorem (See [13, Theorem 11.28, p. 318], [6]) or it could be proved more elementary (sketch of the proof):  ( ) From the basic properties of Lebesgue integral for simple measurable function we have that A sn dm x is ( ) ∞ nondecreasing sequence of real numbers. Hence the limit limn→∞ A sn dm x exists (finte or ). Suppose that ( ) = ≥ limn→∞ A sn dm x a 0 for some nondecreasing sequence sn of nonnegative simple measurable functions such that limn→∞ sn(x) = f (x) for every x ∈ A. Directly from properties of the least upper bound we have that    sup s dm(x) : 0 ≤ s ≤ f, s : A → R is simple measurable function ≥ a. A   When a =∞then the equivalence is obvious. Suppose that a < ∞ and that sup s dm(x) : 0 ≤ s ≤ f, s :  A A → R is simple measurable function > a. That means that there exists simple measurable function s such that  ≤ ≤ ( ) ( )> ( ) = { ( ), ( )} ∈ = , ,... 0 s f and A s x dm x a.Lettn x max s x sn x for all x A and for n 1 2 . Familiarizing Students with Definition of Lebesgue Integral... 365

It can be shown that tn are simple measurable functions for n = 1, 2,..., s(x) ≤ tn(x) ≤ tn+1(x) for all x ∈ A, n ∈ N and limn→∞ tn(x) = f (x) for all x ∈ A.  < ( ) ( ) ≤  Because the limit in the Definition 2 is independent of the choice of the sequence sn and a A s x dm x ( ) ( ) A tn x dm x we have:    a < s(x) dm(x) ≤ lim t (x) dm(x) = lim s (x) dm(x) →∞ n →∞ n A n A n A  ( ) = which contradicts the assumption limn→∞ A sn dm x a. So it must be:     sup s dm(x) : 0 ≤ s ≤ f, s is simple measurable function = lim s (x) dm(x). →∞ n A n A We will consider six examples of calculating Lebesgue integral directly from its definition.

 π/2 ( ) 3 Example: 0 sin x dm x

Let us consider the function: f (x) = sin x, x ∈[0,π/2). For the rest of this example we will restrict our consideration to x ∈[0,π/2). π/2 ( ) We will calculate 0 sin x dm x applying directly Definition 1. Consider n   2−1 k s (x) = π χ + (x), x ∈[ ,π/ ), n = , ,... n sin n+1 k π, k 1 π for 0 2 1 2 2 n+1 n+1 k=0 2 2 n   2 k s¯ (x) = π χ − (x), x ∈[ ,π/ ), n = , ,.... and n sin n+1 k 1 π, k π for 0 2 1 2 2 n+1 n+1 k=1 2 2 Using Wolfram Mathematica we get the following Figs. 1 and 2:

Fig. 1 Graphs of functions f , s1, s2. We can see that s1(x) ≤ s2(x) for x ∈[0,π/2) 366 W. Wojas, J. Krupa

Fig. 2 Graphs of functions f , s2, s3. We can see that s2(x) ≤ s3(x) for x ∈[0,π/2)

It is clear that sn, s¯n are sequences of nonnegative simple measurable functions and that sn ≤ f and s¯n ≥ f on [0,π/2) for all n = 1, 2,.... Using Wolfram Mathematica we get: Listing 1 Mathematica code:

n − π 21 πk In[1]:= Simplify Sin 2n+1 2n+1 k=0  − − − − Out[1]= 2 2 nπ −1 + Cot 2 2 nπ

In[2]:= Limit[%, n →∞] Out[2]= 1

So  n π/2 2−1 π k 1 −2−n −2−n an = sn dm(x) = sin · π = 2 π(−1 + cot(2 π)) → 1 (3.1) 2n+1 2n+1 0 k=0 Similarly Listing 2 Mathematica code:

n π 2 πk In[3]:= Simplify Sin 2n+1 2n+1 k= 1  − − − − Out[3]= 2 2 nπ 1 + Cot 2 2 nπ

In[4]:= Limit[%, n →∞] Out[4]= 1 Familiarizing Students with Definition of Lebesgue Integral... 367

So

 n π/2 2 π  k 1 −2−n −2−n a¯n = s¯n dm(x) = sin · π = 2 π 1 + cot(2 π) → 1(3.2) 2n+1 2n+1 0 k=1 +  sin n 1 x sin n x n ( ) = 2 2 sin x = Of course we could use the following formulae: k=1 sin kx x and limx→0 1 instead of sin 2 x the code in Listings 1 and 2 to get the results in formulae (3.1) and (3.2). Using formulae (3.1) and (3.2), basic properties of least upper, greatest lower bounds and properties of Lebesgue integral of simple measurable functions we will prove that:   π/2  sup s dm(x) : 0 ≤ s ≤ f, s is simple measurable function ≥ 1 (3.3) 0 and   π/2  sup s dm(x) : 0 ≤ s ≤ f, s is simple measurable function ≤ 1. (3.4) 0

Inequalities (3.3) and (3.4)give   π/2  sup s dm(x) : 0 ≤ s ≤ f, s is simple measurable function = 1, 0  π/  π/ which means that 2 f dm(x) = 2 sin x dm(x) = 1. 0 0  π/2 Because limn→∞ an = 1, so sup sn dm(x) : n = 1, 2,... = sup an ≥ 1.   0     π/2 ( ) : = , ,... ⊂ π/2 ( ) : ≤ ≤ , From 0 sn dm x n 1 2 0 s dm x 0 s f s is simple measurable function follows   π/2  sup s dm(x) : 0 ≤ s ≤ f, s is simple measurable function ≥ 1. (3.5) 0

For every simple measurable function s such that s ≤ f we have also that s ≤¯sn, n = 1, 2,.... Hence for every ≤ π/2 ( ) ≤ ¯ ( ), = , ,... simple measurable function s such that s f we have 0 s dm x sn dm x n 1 2 , hence    π/2  π/2 sup s dm(x) : 0 ≤ s ≤ f, s is simple measurable function ≤ s¯n dm(x), n = 1, 2,..., hence 0 0  π/2  sup s dm(x) : 0 ≤ s ≤ f, s is simple measurable function 0   π/2  ≤ inf s¯n dm(x), n = 1, 2,... ≤ 1. (3.6) 0    ¯ = π/2 ¯ ( ), = , ,... = ¯ ≤ The last inequality follows because limn→∞ an 1, which means inf 0 sn dm x n 1 2 inf an 1. Inequalities (3.5)i(3.6)give   π/2  sup s dm(x) : 0 ≤ s ≤ f, s is simple measurable function = 1, 0   π/2 ( ) = π/2 ( ) = . and that means 0 f dm x 0 sin x dm x 1 π/2 ( ) Let calculate 0 sin x dm x applying directly Definition 2. 368 W. Wojas, J. Krupa

We can see that sn(x) ≤ sn+1(x) for x ∈[0,π/2) and for all n = 1, 2,....InFigs.1 and 2 we can see that s1(x) ≤ s2(x) and s2(x) ≤ s3(x) for x ∈[0,π/2). We can also see that limn→∞ sn(x) = sin(x) for all x ∈[0,π/2). So sn is nondecreasing sequence of nonnegative simple measurable functions and sn converges pointwise to f . So by formula (3.1) and directly by Definition 2 we get    π/2 π/2 π/2 sin x dm(x) = f dm(x) = lim s dm(x) = lim a = 1. →∞ n →∞ n 0 0 n 0 n

In the following Sects. 4–8 we omitted graphs of function f, sn(x), s¯n(x) because they are similar to the previous ones in Sect. 3.

 1 ( ) 4 Example: 0 exp x dm x

Let consider the function: f (x) = exp x, x ∈[0, 1). For the rest of this example we will restrict our consideration to x ∈[0, 1).  1 ( ) We will calculate 0 exp x dm x applying directly Definition 1. Consider n   2−1 ( ) = k χ ( ), ∈[ , ), = , ,... sn x exp n k , k+1 x for x 0 1 n 1 2 2 2n 2n k=0 n   2 ¯ ( ) = k χ ( ), ∈[ , ), = , ,.... and sn x exp n k−1 , k x for x 0 1 n 1 2 2 2n 2n k=1

It is clear that sn, s¯n are sequences of nonnegative simple measurable functions and that sn ≤ f and s¯n ≥ f on [0, 1) for all n = 1, 2,.... Using Wolfram Mathematica we get: Listing 3 Mathematica code:

n − 1 21 k In[5]:= Simplify Exp 2n 2n k=0 2−n(−1 + e) Out[5]= − −1 + e2 n

In[6]:= Limit[%, n →∞] Out[6]= −1 + e

So

 n 1 2−1 k 1 −n 2−n an = sn dm(x) = exp · = 2 (1 − e)/(−1 + e ) → e − 1 (4.1) 2n 2n 0 k=0 Familiarizing Students with Definition of Lebesgue Integral... 369

Similarly Listing 4 Mathematica code:

n 1 2 k In[7]:= Simplify Exp 2n 2n k=1 −n 2−n(−1 + e)e2 Out[7]= − −1 + e2 n

In[8]:= Limit[%, n →∞] Out[8]= −1 + e

So

 n 1 2 k 1 −n 2−n 2−n a¯n = s¯n dm(x) = exp · = 2 e (1 − e)/(−1 + e ) → e − 1(4.2) 2n 2n 0 k=1

 + n k = 1−qn 1 = exp x−1 = Of course we could use the following formulae: k=0 q 1−q (q 1) and limx→0 x 1 instead of the code in Listings 3 and 4 to get the results in formulae (4.1) and (4.2). Using formulae (4.1) and (4.2) and similar reasoning like in the previous example (Sect. 3) we get: 1 ( ) = 1 ( ) = − 0 f dm x 0 exp x dm x e 1 directly from Definition 1 and   1 ( ) = 1 ( ) = 1 ( ) = = − 0 exp x dm x 0 f dm x limn→∞ 0 sn dm x limn→∞ an e 1 directly from Definition 2.

 π ( − + 2) ( )( > ) 5 Example: 0 ln 1 2r cos x r dm x r 1

Let consider the function: f (x) = ln(1 − 2r cos x + r 2), x ∈[0,π), r > 1. For the rest of this example we will restrict our consideration to x ∈[0,π). π ( − + 2) ( ) We will calculate 0 ln 1 2r cos x r dm x applying directly Definition 1. Consider n   2−1 ( ) = k π χ ( ), ∈[ ,π), = , ,... sn x f n k π, k+1 π x for x 0 n 1 2 2 2n 2n k=0 n   2 ¯ ( ) = k π χ ( ), ∈[ ,π), = , ,.... and sn x f n k−1 π, k π x for x 0 n 1 2 2 2n 2n k=1

It is clear that sn, s¯n are sequences of nonnegative simple measurable functions and that sn ≤ f and s¯n ≥ f on [0,π)for all n = 1, 2,.... In the Mathematica code below we use the fact that if s k is a sequence of positive values with convergent sum, = ( ) = ( ) then we have k sk ln exp k sk ln k exp sk . 370 W. Wojas, J. Krupa

Using Wolfram Mathematica we get: Listing 5 Mathematica code:

In[1]:= g[x_]=1 − 2 r Cos[x]+r 2; n− 1 kπ    In[2]:= pr=Simplify g . n → 2n n k=0  1+n (−1 + r) −1 + r 2 Out[2]= 1 + r = 2n+1 ; In[3]:= d r π pr π In[4]:= Limit Log , n →∞, Assumptions → r > 1 +Limit Log[d], n →∞, Assumptions → r > 1 2n d 2n Out[4]= 2πLog[r]

So

 n−  π 21 kπ 1 an = sn dm(x) = f · π → 2π ln(r) (5.1) 2n+1 2n 0 k=0

Similarly Listing 6 Mathematica code:

∗ [π] In[5]:= pr1=Simplify pr g g[0] 1+n (1 + r) −1 + r 2 Out[5]= − + 1 r π pr1 π In[6]:= Limit Log , n →∞, Assumptions → r > 1 +Limit Log[d], n →∞, Assumptions → r > 1 2n d 2n Out[6]= 2πLog[r]

In listings 5, 6 we used the substitution rule (n->2ˆn) because when we used directly 2ˆn instead n, Math- ematica could not simplify the expression. We cannot calculate these limits in one step using Mathematica. But using other CAS (wxMaxima, MuPAD) we cannot calculate these limits even in two steps in any way. So

 n  π 2 kπ 1 a¯n = s¯n dm(x) = f · π → 2π ln(r) (5.2) 2n+1 2n 0 k=1

Of course we could use the following formulae: n−1  z2n − 1 = (z2 − 1) 1 − 2z cos(kπ/n) + z2 k=1 instead of the code in Listings 5 and 6 to get the results in formulae (5.1) and (5.2). Using formulae (5.1) and (5.2) and similar reasoning like in the previous example (Sect. 3) we get: π ( ) = π ( − + 2) ( ) = π ( ) 0 f dm x 0 ln 1 2r cos x r dm x 2 ln r directly from Definition 1 and π ( − + 2) ( ) = π ( ) = π ( ) = = π ( ) 0 ln 1 2r cos x r dm x 0 f dm x limn→∞ 0 sn dm x limn→∞ an 2 ln r directly from Definition 2. Familiarizing Students with Definition of Lebesgue Integral... 371  1 m ( )( ∈ N) 6 Example: 0 x dm x m

Let consider the function: f (x) = xm, x ∈[0, 1), m ∈ N. For the rest of this example we will restrict our consideration to x ∈[0, 1). 1 m ( ) We will calculate 0 x dm x applying directly Definition 1. Consider n   2−1 m ( ) = k χ ( ), ∈[ , ), = , ,... sn x n k , k+1 x for x 0 1 n 1 2 2 2n 2n k=0 n   2 m ¯ ( ) = k χ ( ), ∈[ , ), = , ,.... and sn x n k−1 , k x for x 0 1 n 1 2 2 2n 2n k=1 As in the previous examples it is clear that sn, s¯n are sequences of nonnegative simple measurable functions and that sn ≤ f and s¯n ≥ f on [0, 1) for all n = 1, 2,.... Using Wolfram Mathematica we get: Listing 7 Mathematica code:

2n −1  1  j m In[1]:= Limit , n →∞, Assumptions → m ∈ Integers &&m > 0 2n 2n j=0 1 Out[1]= 1 + m

So

 2n−1  1  k m 1 1 an = sn dm(x) = · → (6.1) 2n 2n m + 1 0 k=0

Similarly Listing 8 Mathematica code:

2n  1  j m In[2]:= Limit , n →∞, Assumptions → m ∈ Integers &&m > 0 2n 2n j=1 1 Out[2]= 1 + m

So

 2n  1  k m 1 1 a¯n = s¯n dm(x) = · → (6.2) 2n 2n m + 1 0 k=1

Of course we could use the Stolz and binomial theorems instead of the code in Listings 7 and 8 to get the results in formulae (6.1) and (6.2). Using formulae (6.1) and (6.2) and similar reasoning like in the previous example (Sect. 3) we get: 1 ( ) = 1 m ( ) = 1 0 f dm x 0 x dm x m+1 directly from Definition 1 and   1 m ( ) = 1 ( ) = 1 ( ) = = 1 0 x dm x 0 f dm x limn→∞ 0 sn dm x limn→∞ an m+1 directly from Definition 2. 372 W. Wojas, J. Krupa  1 2 ( ) 7 Example: −1 x dm x

Let consider the function: f (x) = x2, x ∈[−1, 1). For the rest of this example we will restrict our consideration to x ∈[−1, 1).  1 2 ( ) We will calculate −1 x dm x applying directly Definition 1. Consider n   2−1 2 ( ) = k χ ( ), ∈[− , ), = , ,... sn x n − k+1 ,− k ∪ k , k+1 x for x 1 1 n 1 2 2 2n 2n 2n 2n k=0 n   2 2 ¯ ( ) = k χ ( ), ∈[− , ), = , ,.... and sn x n − k ,− k−1 ∪ k−1 , k x for x 1 1 n 1 2 2 2n 2n 2n 2n k=1

As in the previous examples it is clear that sn, s¯n are sequences of nonnegative simple measurable functions and that sn ≤ f and s¯n ≥ f on [−1, 1) for all n = 1, 2,.... Using Wolfram Mathematica we get:

Listing 9 Mathematica code:

n − 2 21 In[1]:= k2 23n k=1   1 − + Out[1]= ∗ 2 2n −1 + 2n −1 + 21 n 3 In[2]:= Limit[%, n →∞] 2 Out[2]= 3

So

 2n−1  1  k 2 2 2 an = sn dm(x) = · → (7.1) − 2n 2n 3 1 k=0

Similarly

Listing 10 Mathematica code:

n 2 2 In[3]:= k2 23n k=1   1 − + Out[3]= ∗ 2 2n 1 + 2n 1 + 21 n 3

In[4]:= Limit[%, n →∞] 2 Out[4]= 3

So

 2n  1  k 2 2 2 a¯n = s¯n dm(x) = · → (7.2) − 2n 2n 3 1 k=1 Familiarizing Students with Definition of Lebesgue Integral... 373  n 2 = 1 ( + )( + ) Of course we could use the formula k=1 k 6 n n 1 2n 1 instead of the code in Listings 9 and 10 to get the results in formulae (7.1) and (7.2). Using formulae (7.1) and (7.2) and similar reasoning like in the previous example (Sect. 3) we get: 1 ( ) = 1 2 ( ) = 2 −1 f dm x −1 x dm x 3 directly from Definition 1 and   1 2 ( ) = 1 ( ) = 1 ( ) = = 2 −1 x dm x −1 f dm x limn→∞ −1 sn dm x limn→∞ an 3 directly from Definition 2.

 1 ( ) ( ) ( ) 8 Example: 0 f x dm x , where f x is Thomae’s function

Let us consider Thomae’s function ⎧ ⎨⎪1ifx = 0, f (x) = 1 if x = p ∈[0, 1]∩Q, p is in lowest terms, (8.1) ⎩⎪ q q q 0ifx ∈[0, 1]\Q.

 ( ) [ , ] 1 ( ) =  The Thomae’s function f x is Riemann integrable over 0 1 and R 0 f x dx 0. Let us calculate 1 ( ) ( ) 0 f x dm x directly from Definition 1. < 1 < 2 < ··· < 2n−1 < [ , ] ={ ∈[, ]: k−1 ≤ ( )< k }= Let 0 2n 2n 2n 1 be partition of 0 1 .LetAk x 0 1 2n f x 2n − k− k n− − n− 1([ 1 , )) = , ,..., n − n ={ ∈[ , ]: 2 1 ≤ ( ) ≤ }= 1([ 2 1 , ]) f 2n 2n for k 1 2 2 1 and A2 x 0 1 2n f x 1 f 2n 1 . n One can see that A1 =[0, 1]\B, where B ⊂ Q and Ak ⊂[0, 1]∩Q for k = 2, 3,...,2 . Hence m(A1) = n 1, m(Ak) = 0for k = 2, 3,...,2 , where m is the Lebesgue measure on R. Consider n 2 k − 1 sn(x) = χA (x), for x ∈[0, 1), n = 1, 2,... 2n k k=1 n 2 k and s¯n(x) = χA (x), for x ∈[0, 1), n = 1, 2,.... 2n k k=1

As in the previous examples it is clear that sn, s¯n are sequences of nonnegative simple measurable functions and that sn ≤ f and s¯n ≥ f on [0, 1) for all n = 1, 2,.... One can see that:

 n 1 2 k − 1 an = sn dm(x) = · m(Ak) = 0. (8.2) 2n 0 k=1

and

 n 1 2 k 1 a¯n = s¯n dm(x) = · m(Ak) = → 0. (8.3) 2n 2n 0 k=1

Using formulae (8.2) and (8.3) and similar reasoning like in the previous example (Sect. 3) we get: 1 ( ) = 0 f dm x 0 directly from Definition 1 and  1 ( ) = 1 ( ) = 0 f dm x limn→∞ 0 sn dm x 0 directly from Definition 2. 374 W. Wojas, J. Krupa

9 The Lebesgue Philosophy

The Lebesgue philosophy was well described in literature e.g. we will follow the description in [5, Chapter 3]. Lebesgue’s goal was to collect approximately equal values of f . He proceeded in the following way. Let f : [a, b] → R be a bounded Lebesgue measurable function, and consider the partition

Q : c = y0 < y1 < ···< yn = d

where c = inf{ f (x) : x ∈[a, b]} and d = sup{ f (x) : x ∈[a, b]} and the diameter of Q is

|Q|=max{|yk − yk−1|:k = 1,...,n − 1}.

If Ak ={x ∈[a, b]:yk−1 ≤ f (x)

 b Definition 3 A bounded Lebesgue measurable function f :[a; b] → R is Lebesgue integrable if L f dm(x) =  a b L f dm(x). In this case, the Lebesgue integral of f over [a; b] is a    b b b L f dm(x) = L f dm(x) = L f dm(x). a a a

 1 2 ( ) 9.1 The Lebesgue Philosophy for 0 x dm x  1 2 ( ) Let us calculate 0 x dm x directly from√ Definition 3. Let f (x) = x2 and g(x) = f −1(x) = x for x ∈[0, 1]. = / = , , ,..., : = < 1 < ···< n−1 < = Let yk k n, k 0 1 2 n so Qn c 0 n n 1 d.

n n n     k − 1 s = y − m(A ) = y − g(y ) − g(y − ) = g(y ) − g(y − ) Qn k 1 k k 1 k k 1 n k k 1 k=1 k=1 k=2 n n  1  1  = (ng(y ) − g(y ) − g(y )) = ng(1) − g(1/n) − g(k/n) n n 1 k n k=2 k=2 n  n 1    1 1  √ = n − 1/n − k/n = 1 − √ − √ k. (9.1) n n n n n k=2 k=2 Familiarizing Students with Definition of Lebesgue Integral... 375

Using Stolz theorem we calculate the limit:  √ √ √  n 3/2 3/2 = k n + 1 n + 1 (n + 1) + n lim k 2 = lim = lim n→∞ n3/2 n→∞ (n + 1)3/2 − n3/2 n→∞ (n + 1)3 − n3 √  √  n + 1 (n + 1)3/2 + n3/2 1 + 1/n (1 + 1/n)3/2 + 1 = lim = lim = 2/3. (9.2) n→∞ 3n2 + 3n + 1 n→∞ 3 + 3/n + 1/n2

= − − / = / So limn→∞ sQn 1 0 2 3 1 3. Hence from the basic properties of sQ, SQ and least upper bound we have

sup sQ ≥ 1/3 and SQ ≥ 1/3 for all partitions Q. (9.3) Q

Similarly

n n  n k  S = y m(A ) = y g(y ) − g(y − ) = g(y ) − g(y − ) Qn k k k k k 1 n k k 1 k=1 k=1 k=1 n−  n−  1 1 1 1 = ng(y ) − g(y ) − g(y ) = ng(1) − g(0) − g(k/n) n n 0 k n k=0 k=0 n−  n− 1 √ 1  1 1 √ = n − 0 − k/n = 1 − k. (9.4) n n3/2 k=0 k=1

Using Stolz theorem we calculate the limit:  √ √ √ n−1 3/2 3/2 = k n n((n + 1) + n ) lim k 1 = lim = lim →∞ 3/2 →∞ ( + )3/2 − 3/2 →∞ ( + )3 − 3 n n n n  1 n n n 1 n √ / / n (n + 1)3 2 + n3 2 (1 + 1/n)3/2 + 1 = lim = lim = 2/3. (9.5) n→∞ 3n2 + 3n + 1 n→∞ 3 + 3/n + 1/n2

= − / = / So limn→∞ SQn 1 2 3 1 3. Hence similarly we have inf SQ ≤ 1/3 and sQ ≤ 1/3 for all partitions Q. (9.6) Q

From 9.3 and 9.6 follows that:   1 1 2 2 L x dm(x) = sup sQ = 1/3 and L x dm(x) = inf SQ = 1/3. 0 Q 0 Q Hence directly from Definition 3 we have  1 1 L x2 dm(x) = . 0 3 We cannot get Wolfram Mathematica, wxMaxima and MuPAD to calculate the above limits. In Figs. 3 and 4 below 1 2 ( ) we present dynamic plots of Lebesgue lower and upper sums sQn and SQn for L 0 x dm x created using Wolfram Mathematica. We used Manipulate function.  1 2 The above calculation are much more difficult that the ones for Riemann integral 0 x dx. Similarly we can 1 3 ( ) 1 m ( ) ∈ N calculate 0 x dm x and 0 x dm x (m ). 376 W. Wojas, J. Krupa

 1 2 ( ) ∈{ , , , , , , } Fig. 3 Dynamic plots of Lebesgue lower sums sQn for L 0 x dm x and n 20 2 4 6 10 40 1000

 1 2 ( ) ∈{ , , , , , , } Fig. 4 Dynamic plots of Lebesgue upper sums SQn for L 0 x dm x and n 20 2 4 6 10 40 1000 Familiarizing Students with Definition of Lebesgue Integral... 377

The dynamic versions of the Figs. 3 and 4 can be found in Electronic supplementary material. y = k 2, k = , ,...,n Actually when we take the following range partition k n 0 1 the calculation for the considered 1 2 ( ) Lebesgue integral 0 x dm x are pretty the same like for the Riemann one (slightly different reasoning). Similarly when we take the following range partition y = sin k π , k = 0, 1,...,n the calculation for the considered  k 2n π/2 ( ) Lebesgue integral 0 sin x dm x are pretty the same like for the Riemann case. We can see graphical presentation of the Lebesgue philosophy done in [2,9]. But we could not find examples calculated directly from Definition 3 except for the Dirichlet like function.  b χ ( ) 9.2 The Lebesgue Philosophy for a [a,b]∩Q dm x

In [5] is proved that Dirichlet function χ[a,b]∩Q is not Riemann integrable but it is proved directly from Definition 3 that  b L χ[a,b]∩Q dm(x) = 0. a

 b χ ( ) 9.3 The Lebesgue Philosophy for a [a,b]\Q dm x

Let  1ifx ∈[a, b]\Q, f (x) = χ[a,b]\Q(x) = 0ifx ∈[a, b]∩Q.  b χ ( ) Let us calculate a [a,b]\Q dm x directly from Definition 3. Let Q : 0 = y0 < y1 < ···< yn = 1 be any partition of [0, 1]. One can see that A1 =[a, b]∩Q, A2 = A3 =···= An−1 =∅, An =[a, b]\Q. Thus sQ = yn−1(b − a), SQ = (b − a) for any partition Q. = − = − So supQ sQ b a and inf Q SQ b a. Hence  b L χ[a,b]\Q dm(x) = b − a directly from Definition 3. a

 1 ( ) ( ) ( ) 9.4 The Lebesgue Philosophy for 0 f x dm x , where f x is Thomae’s function

Let us consider Thomae’s function f (x) which is defined in formula 8.1 in Sect. 8. 1 ( ) ( ) Let us calculate 0 f x dm x directly from Definition 3. Let Q : 0 = y0 < y1 < ···< yn = 1 be any partition of [0, 1]. One can see that A1 =[0, 1]\B, where B ⊂ Q and A2 ⊂[0, 1]∩Q, A3 ⊂[0, 1]∩Q,..., An ⊂[0, 1]∩Q. Hence m(A1) = 1, m(A2) = m(A3) =···=m(An) = 0, where m is the Lebesgue measure on R. Thus sQ = 0, SQ = y1 for any partition Q. = = So supQ sQ 0 and inf Q SQ 0. Hence  1 L f (x) dm(x) = 0 directly from Definition 3. 0

 1 1/m ( ); ( ∈ N) 9.5 The Lebesgue Philosophy for 0 x dm x m  1 1/m ( ) ∈ N Let us calculate 0 x dm x ; m directly from Definition 3. 378 W. Wojas, J. Krupa

Let f (x) = x1/m and g(x) = f −1(x) = xm for x ∈[0, 1]. = / = , , ,..., : = < 1 < ···< n−1 < = Let yk k n, k 0 1 2 n so Qn c 0 n n 1 d.

n n n     k − 1 s = y − m(A ) = y − g(y ) − g(y − ) = g(y ) − g(y − ) Qn k 1 k k 1 k k 1 n k k 1 k=1 k=1 k=2 n n  1  1  = (ng(y ) − g(y ) − g(y )) = ng(1) − g(1/n) − g(k/n) n n 1 k n k=2 k=2 n  n 1 1  1 1  = n − − (k/n)m = 1 − − km. (9.7) n nm nm+1 nm+1 k=2 k=2

Similarly

n n  n k  S = y m(A ) = y g(y ) − g(y − ) = g(y ) − g(y − ) Qn k k k k k 1 n k k 1 k=1 k=1 k=1 n−  n−  1 1 1 1 = ng(y ) − g(y ) − g(y ) = ng(1) − g(0) − g(k/n) n n 0 k n k=0 k=0 n−  n− 1 1 1 1 = n − 0m − (k/n)m = 1 − km. (9.8) n nm+1 k=0 k=1

Using Wolfram Mathematica we get:

Listing 11 Mathematica code:

n  1  k m In[1]:= Limit , n →∞, Assumptions → m ∈ Integers &&m > 0 n n k=2 1 Out[1]= 1 + m

and Listing 12 Mathematica code:

n−1  1  k − 1 m In[2]:= Limit , n →∞, Assumptions → m ∈ Integers &&m > 0 n n k=1 1 Out[2]= 1 + m

From listings 11, 12 and we have

1 m 1 m lim sQ = 1 − = and lim SQ = 1 − = (9.9) n→∞ n m + 1 m + 1 n→∞ n m + 1 m + 1

Of course we could use the Stolz and binomial theorems instead of the code in Listings 11 and 12 to get the results in formulae (9.9). Familiarizing Students with Definition of Lebesgue Integral... 379

Similar reasoning like in the previous example gives:   1 1 1/m m 1/m m L x dm(x) = sup sQ = and L x dm(x) = inf SQ = . 0 Q m + 1 0 Q m + 1 Hence directly from Definition 3 we have  1 / m L x1 m dm(x) = . 0 m + 1

 e ( ) 9.6 The Lebesgue Philosophy for 1 ln x dm x  e ( ) Let us calculate 1 ln x dm x directly from Definition 3. Let f (x) = ln xx∈[1, e] and g(x) = f −1(x) = exp x for x ∈[0, 1]. = / = , , ,..., : = < 1 < ···< n−1 < = Let yk k n, k 0 1 2 n so Qn c 0 n n 1 d.

n n n      k − 1  s = y − m(A ) = y − g(y ) − g(y − ) = exp(k/n) − exp (k − 1)/n . (9.10) Qn k 1 k k 1 k k 1 n k=1 k=1 k=2

Similarly

n n n      k  S = y m(A ) = y g(y ) − g(y − ) = exp(k/n) − exp (k − 1)/n . (9.11) Qn k k k k k 1 n k=1 k=1 k=1

Using Wolfram Mathematica we get: Listing 13 Mathematica code:

n  1  k k − 1 In[1]:= Limit (k − 1) Exp − Exp , n →∞ n n n k=1 Out[1]= 1

and Listing 14 Mathematica code:

n  1  k k − 1 In[2]:= Limit k Exp − Exp , n →∞ n n n k=1 Out[2]= 1

Of course we could use the formula for sum of geometric instead of the code in Listings 13 and 14. From listings 13, 14 and similar reasoning like in the last section we have   e e L ln x dm(x) = sup sQ = 1 and L ln x dm(x) = inf SQ = 1. 1 Q 1 Q Hence directly from Definition 3 we have  e L ln x dm(x) = 1. 1 380 W. Wojas, J. Krupa

10 Comparing the Calculations in Mathematica with Calculations in Some Other CAS Programs

The authors tried to repeat calculations for examples of Lebesgue integrals using some other CAS programs such as: π/2 ( ) 1 x ( ) 1 2 ( ) wxMaxima, MuPAD and Sage. The following Lebesgue integrals: 0 sin x dm x , 0 e dm x , −1 x dm x were calculated in analogical way in these CAS programs. We used standard procedures in these programs to 1 m ( )( ∈ N) π ( − + calculate sums and limits. We could not calculate the integrals: 0 x dm x m  and 0 ln 1  2r cos x 2) ( )( > ) π/2 ( ) 1 x ( ) r dm x r 1 . The use of procedures which we have used before (for integrals 0 sin x dm x , 0 e dm x , 1 2 ( ) −1 x dm x ) for these two integrals had no effect. We used standard procedures: sum, limit, simplification, assume.

11 Conclusions

In this paper the authors present several examples of Lebesgue integral calculated directly from its definition using Mathematica. We also consider the calculation of integrals using “partition the range of f  Lebesgue-philosophy. Familiarizing students with definition of an integral by calculation integrals directly from its definition is a standard approach in the case of Riemann integral. Many examples of Riemann integral calculated using only its definition can be found in literature. We could not find any analogical examples in available literature for Lebesgue integral, so this paper is an attempt to fill this gap. Using Mathematica or other CAS programs for calculation Lebesgue integrals directly from its definitions, seems to be didactically useful for students because of the possibility of symbolic calculation of sums, limits and plot graphs—checking our hand calculations. Moreover we get students used not only to definition of Lebesgue integral but also to CAS applications generally. The principles of programming in Mathematica language are given in [14,16]. The six examples from Sects. 3–8 of our article could be used as a supplement to the textbooks [4,6,8,10,13] (when we use Definition 1) and also as a supplement to to the textbooks [1,11,15] (when we use Definition 2). And this is the main reason why we in our article included the Definitions 1 and 2 of Lebesgue integral and calculated the examples of integral directly from these definitions.

Acknowledgements The authors would like to express sincere gratitude to their referees for many valuable suggestions and helpful criticism of the earlier version of this work.

Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http:// creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

References

1. Aliprantis, C.D., Burkinshaw, O.: Principles of , 2nd edn. Academic Press, Cambridge (1991) 2. Antonov, A.: Mathematica presentation of Lebesgue integration. http://demonstrations.wolfram.com/LebesgueIntegration/ 3. Apostol, T.M.: Calculus, Volume 1, One-Variable Calculus with an Introduction to Linear Algebra, 2nd edn. Addison-Wesley Publishing Company, Boston (1991) 4. Bartle, R.G.: The Elements of Integration and Lebesgue Measure. Wiley, Hoboken (1995) 5. Benedetto, J.J., Czaja, W.: Integration and Modern Analysis. Birkhäuser, Boston, MA (2009) 6. Browder, A.: an Introduction, 2nd edn. Springer, Berlin (2001) 7. Fichtenholz, G.M.: Differential and Integral Calculus, 3rd edn. Fizmatgiz, Moscow (1958) 8. Folland, G.B.: Real Analysis Modern Technique, 2nd edn. Wiley, Hoboken (2007) 9. Freniche, F.J.: Mathematica demonstration of Riemann versus Lebesgue integration. http://demonstrations.wolfram.com/ RiemannVersusLebesgue/ 10. Jones, F.: Lebesgue Integration on Euclidean Space. Jones & Bartlett Learning, Burlington (2000) 11. Kołodziej, W.: Mathematical Analysis. Polish Scientific Publishers PWN, Warsaw (2012). (in Polish) 12. Larson, R.E., Hostetler, R.P., Edwards, B.H.: Calculus, 6th edn. Houghton Mifflin Company, Boston (1998) Familiarizing Students with Definition of Lebesgue Integral... 381

13. Rudin, W.: Principles of Mathematical Analysis, 3rd edn. McGraw-Hill Education, New York City (1973) 14. Ruskeepaa, H.: Mathematica Navigator: Graphics and Methods of applied Mathematics. Academic Press, Boston (2005) 15. Sikorski, R.: Differential and Integral Calculus. Functions of Several Variables, 2nd edn. Polish Scientific Publishers PWN, Warsaw (1977). (in Polish) 16. Wolfram, S.: The Mathematica Book. Wolfram Media Cambridge University Press, Champaign (1996)