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

In this paper we present some examples of calculation the Lebesgue outer measure of some subsets of R2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathbb {R}^2$$\end{document} directly from definition 1. We will consider the following subsets of R2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathbb {R}^2$$\end{document}: {(x,y)∈R2:0≤y≤x2,x∈[0,1]}\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\displaystyle \{(x, y)\in \mathbb {R}^2: 0\le y \le x^2, x\in [0, 1]\}$$\end{document}, {(x,y)∈R2:0≤y≤exp(-x),x≥0}\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\displaystyle \{(x, y)\in \mathbb {R}^2: 0\le y \le \exp (-x), x\ge 0\}$$\end{document}, {(x,y)∈R2:lnx≤y≤0,x∈(0,1]}\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\big \{ (x,y) \in \mathbb {R}^2: \ln x \le y \le 0, x\in (0, 1]\big \}$$\end{document}, {(x,y)∈R2:0≤y≤1/x,x≥1}\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\big \{ (x,y) \in \mathbb {R}^2: 0\le y \le 1/x, x\ge 1\big \}$$\end{document}, {(x,y)∈R2:0≤y≤sinx,x∈[0,π/2]}\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\displaystyle \{(x, y)\in \mathbb {R}^2: 0\le y \le \sin x, x\in [0, \pi /2]\}$$\end{document}, {(x,y)∈R2:0≤y≤exp(x),x∈[0,1]}\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\displaystyle \{(x, y)\in \mathbb {R}^2: 0\le y \le \exp (x), x\in [0, 1]\}$$\end{document}, {(x,y)∈R2:0≤y≤ln(1-2rcosx+r2),x∈[0,π]}\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\displaystyle \{(x, y)\in \mathbb {R}^2: 0\le y \le \ln (1-2r \cos x+r^2), x \in [0, \pi ]\}$$\end{document}, r>1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$r>1$$\end{document} and some others. We could not find any analogical examples in available literature (except for rectangle and countable sets), so this paper is an attempt to fill this gap. We calculate sums, limits and plot graphs and dynamic plots of needed sets and unions of rectangles sums of which volumes approximate Lebesgue outer measure of the sets, using Mathematica. We also show how to calculate the needed sums and limits by hand (without CAS). The title of this paper is very similar to the title of author’s article (Wojas and Krupa in Math Comput Sci 11:363–381, 2017) which deals with definition of Lebesgue integral but this paper deals with definition of Lebesgue outer measure instead.

"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

Introduction
The following definitions and lemmas we will use in our paper (compare [2,9]): Rectangles. A closed rectangle R in R d is given by the product of d one-dimensional closed and bounded intervals: where a j ≤ b j are real numbers, j = 1, 2, . . . , d. In other words, we have R = {(x 1 , . . . , x d ) ∈ R d : a j ≤ x j ≤ b j for all j = 1, 2, . . . , d}. We remark that in our definition, a rectangle is closed and has sides parallel to the coordinate axis. In R, the rectangles are precisely the closed and bounded intervals, while in R 2 they are the usual four-sided rectangles. In R 3 they are the closed rectangular parallelepipeds.
An open rectangle is the product of open intervals, and the interior of the rectangle R is then We say that the lengths of the sides of the rectangle R (open or closed) are b 1 − a 1 , . . . , b d − a d . The volume of the rectangle R (open or closed) is denoted by vol (R), and is defined to be vol (R) = (b 1 − a 1 ) · · · (b d − a d ).
A union of rectangles is said to be almost disjoint if the interiors of the rectangles are disjoint. In this paper, coverings by rectangles play a major role, so we isolate here five important lemmas. Proof of the Lemmas 1.1, 1.2 can be found in [5,9,10]. The proof of 1.3 can be found in [5]. The ideas of the presented below proofs of lemmas are well known but we could not find the sources of the proofs.

Lemma 1.1 If a closed rectangle is the almost disjoint union of finitely many other closed rectangles, say R =
By Lemma 1.2 we have: We see that for each j = 1, 2, . . . M the set {R i ∩ Q j : i = 1, 2, . . . n} is collection of almost disjoint rectangles so by Lemma 1.3 we have: Finally from Eqs. 1.1 and 1.2 we have: In the last proof instead of Lemma 1.3 we could use simpler lemma: If a closed rectangle R contains the almost disjoint union of finitely many other closed rectangles, say N k=1 R k ⊂ R, then N k=1 vol(R k ) ≤ vol (R) which can be proved by modifying the proof of the Lemma 1.1 from [9] or its proof can be found in [10]. The Lemma 1.4 could also be proved directly by modifying the proof of the Lemma 1.3 from [5].
Applying the previous Lemma 1. 4 we can prove (see [9]): For a fixed ε > 0 we choose for each k an open rectangle P k which contains Q k (Q k ⊂ P k ), and such that vol(P k ) ≤ (1 + ε) vol(Q k ). From the open covering ∞ k=1 P k of the compact set A, we may select a finite subcovering which, after possibly renumbering the rectangles, we may write as A ⊂ M k=1 P k . Taking the closure of the rectangles P k , we may apply Lemma 1.4 to conclude that for any ε we have: Since ε is arbitrary, we find that N k=1 vol(R k ) ≤ ∞ k=1 vol(Q k ). Definition 1 (Lebesgue outer measure) (see [1,2,4,6,8,9]) The outer measure m * for any A ⊂ R d is defined by the following formula: Definition 2 (Lebesgue measure) (see [1,2,4,6,8,9]) Let (R d , M, m) be measure space, where M is σ -algebra of Lebesgue measurable subsets in R d , and m-Lebesgue measure on R d . The measure m for any A ∈ M is defined by the formula 1.3 (m(A) = m * (A)).

Example 1:
Let A be the set in R 2 bounded by curves: y = x 2 , y = 0, x = 1, which means that A = (x, y) ∈ R 2 : 0 ≤ y ≤ x 2 , 0 ≤ x ≤ 1 . Let us calculate Lebesgue outer measure of A using only formula (1.3) from Definition 1 and Lemma 1.5.
We can check our hand calculation using Wolfram Mathematica (see [7,12] (2.1) Step 2. Note that: We can check our hand calculation using Wolfram Mathematica:  We consider an arbitrary countable covering A ⊂ ∞ j=1 R j by closed rectangles. Hence because n j=1 R n j ⊂ A ⊂ ∞ j=1 R j from Lemma 1.5 we have that for any n: Applying the formula 2.2 we have:

Example 2:
Let A be the set in R 2 bounded by curves:

In[7]:= Simplify
We get that: Of course, we could use the following formulae: We consider an arbitrary countable covering A ⊂ ∞ j=1 R j by closed rectangles.
Hence because R j from Lemma 1.5 we have that for any n:

Example 3:
Let A be the set in R 2 bounded by curves: We can see that Step 2. We get that: We consider an arbitrary covering A ⊂ ∞ j=1 R j by closed rectangles.
Hence, because R j from Lemma 1.5 we have that for any n: Of course, we could use almost the sameR n jk and R n j like in example 2 in Sect. 3.

Example 5:
One can see that for n ∈ N we have: Similarly we can calculate Lebesgue outer measure of A = (x, y) ∈ R 2 : 0 ≤ y ≤ g(x), 0 ≤ x ≤ 1}, where g(x) is function defined in (6.4), using only formula (1.3) from Definition 1.
is function defined in (7.1). Let us calculate Lebesgue outer measure of A using only formula (1.3) from Definition 1.

Suppose there exist rectangles
For a fixed ε > 0 we choose for each i = 1, 2, . . . a rectangle P i such that t i ∈ P i and that vol(P i ) = ε 2 i+1 . One can see that The set B is Lebesgue measurable because B is Borel set, so m(B) = 1.

Example 8:
Let A be the set in R 2 bounded by curves: y = sin x, y = 0 for x ∈ [0, π/2], which means that we get: Hence, because A ⊂ 2 n −1 j=0R n j , we have: Step 2. Using Wolfram Mathematica: We get that: Of course, we could use the following formulae: We consider an arbitrary covering A ⊂ ∞ j=1 R j by closed rectangles. Hence, because 2 n −1 j=0 R n j ⊂ A ⊂ ∞ j=1 R j from Lemma 1.5 we have that for any n: . Applying the formula 9.3 we have: ∞ j=1 vol(R j ) ≥ lim n→∞   we get: Hence, because A ⊂ 2 n −1 j=0R n j , we have:   Let A be the set in R 2 bounded by curves: y = ln(1 − 2r cos x + r 2 ), y = 0 for x ∈ [0, π], which means that we get: 2 n π → 2π ln(r ). (11.1) Hence, because A ⊂ 2 n −1 j=0R n j , we have: vol(R n j ) : n ∈ N ≤ 2π ln(r ).

(11.2)
Step 2. Using Wolfram Mathematica: We get that: In Listings 9, 10 we used the substitution rule (n → 2 n ) because when we used directly 2 n instead n, Mathematica 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.
Of course, we could use the following formulae (see [3]: 1 − 2z cos(kπ/n) + z 2 instead of the code in Listings 9 and 10 to get the results in formulae (11.1) and (11.3). We consider an arbitrary covering A ⊂ ∞ j=1 R j by closed rectangles. Hence, because 2 n −1 j=0 R n j ⊂ A ⊂ ∞ j=1 R j from Lemma 1.5 we have that for any n: . Applying the formula 11.3 we have: ∞ j=1 vol(R j ) ≥ lim n→∞ Hence, because A ⊂ 2 n −1 j=0R n j , we have: vol(R n j ) : n ∈ N ≤ 1 m + 1 . (12.1) Step 2. Using Wolfram Mathematica: 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 (12.1) and (12.2). We consider an arbitrary covering A ⊂ ∞ j=1 R j by closed rectangles. Hence, because 2 n −1 j=0 R n j ⊂ A ⊂ ∞ j=1 R j from Lemma 1.5 we have that for any n:

Conclusions
In this paper the authors presented several examples of Lebesgue outer measure calculated directly from its definition using Mathematica. We could not find any analogical examples in available literature, so this paper is an attempt to fill this gap. Using Mathematica or other CAS programs for calculation Lebesgue outer measure 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 outer measure but also to CAS applications generally.
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.