Download Numbers - Department of Computer Sciences

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Law of large numbers wikipedia , lookup

Abuse of notation wikipedia , lookup

Location arithmetic wikipedia , lookup

History of logarithms wikipedia , lookup

Ethnomathematics wikipedia , lookup

Infinitesimal wikipedia , lookup

Positional notation wikipedia , lookup

Mathematics of radio engineering wikipedia , lookup

Foundations of mathematics wikipedia , lookup

Hyperreal number wikipedia , lookup

Infinity wikipedia , lookup

Georg Cantor's first set theory article wikipedia , lookup

Bernoulli number wikipedia , lookup

Surreal number wikipedia , lookup

Collatz conjecture wikipedia , lookup

Large numbers wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Real number wikipedia , lookup

Arithmetic wikipedia , lookup

P-adic number wikipedia , lookup

Addition wikipedia , lookup

Elementary mathematics wikipedia , lookup

Transcript
CSE 1400 Applied Discrete Mathematics
Numbers
Department of Computer Sciences
College of Engineering
Florida Tech
Fall 2011
Numbers
1
Natural Numbers
Integers
1
2
Integers Mod n
Rational Numbers
2
3
Floating Point Numbers
The Real Numbers
6
Complex Numbers
6
Problems on Numbers
5
7
Abstract
Numbers are used for many purposes, chiefly to count discrete things
Numbers
There are many types of numbers: whole numbers, positive and
negative numbers, fractional numbers, and continuous numbers.
Natural Numbers
To count things, the natural numbers are used.
N = {0, 1, 2, 3, . . .}
The natural numbers are unsigned, that is, no plus (+) or minus (−)
sign is placed in front of a natural number.
The natural numbers are closed under addition and multiplication.
Addition closure: If n and m are natural numbers, then n + m is a
natural number.
Multiplication closure: If n and m are natural numbers, then nm is a
natural number.
The symbol N is used to refer to the
set of natural numbers: zero, one, two,
three, . . . .
cse 1400 applied discrete mathematics
numbers 2
Subtraction and division can be computed on some pairs of natural
numbers, but the natural numbers are not closed under these operations.
8 − 9 6∈ N; 5 ÷ 2 6∈ N.
• If n is less than or equal to m, then the difference m − n is a natural
number.
• If m is a multiple of n, say m = nk for some natural number k, then
the quotient m/n = k is a natural number.
The natural numbers can be placed in order.
A relation < is strict if a < b, then
b 6< a. A relation < is total if for any a
and b, either a < b, b < a, or a = b.
0 < 1 < 2 < 3 < 4 < ···
Less than is a relation on the natural numbers. Less than is strict and
total.
Integers
Integers are used to increment and decrement counts of things .
The integers are the numbers in the set
Z = {0, ±1, ±2, ±3, . . .}
The integers are closed under addition, multiplication, and subtraction.
Subtraction closure: If n and m are integers, then m − n is an integer.
The symbol Z is commonly used to
refer to the set of integers: zero, plus or
minus one, plus or minus two, plus or
minus three, . . . .
The integers are signed numbers: They are stored in computer memory with an explicit plus (+) or minus (−) sign.
Surprisingly, the natural numbers and the integers can be put into
a one-to-one correspondence, which mathematicians understand to
mean the sets have an equal number of members. A function that
establishes this one-to-one correspondence maps the even natural
numbers to one-half their value and the odd natural numbers to the
negative of one-half times their value plus 1.

n/2
if n is even
∀n ∈ N, f (n) =
−(n + 1)/2 if n is odd
For instance,
0→0
2→1
4→2
6→3
8→4
..
.
1 → −1
3 → −2
5 → −3
7 → −4
9 → −5
..
.
Because of this one-to-one correspondence, the two natural numbers
N and the integers Z are said to have the same cardinality, meaning
they have the same ’number’ of elements.
A set X is finite if it contains n
members, where n is some natural
number. For instance, B = {0, 1},
containing n = 2 members, is finite.
The cardinality of a finite set is the
numbers of members it contains.
Two sets X and Y have identical cardinality if elements in X can be put
into a one-to-one correspondence
with the elements in Y.
cse 1400 applied discrete mathematics
numbers 3
Integers Mod n
The first n natural numbers: 0, 1, 2, . . . , ( n − 1 ) are called
the integers mod n. The set Z n is the symbol for the set of integers mod n,
Zn = {0, 1, 2, 3, . . . , (n − 1)}
Zn is pronounced “Z mod n.” For
instance,
Z2 = {0, 1}
In practical applications, the modulus n is most often a prime number p.
Z p = {0, 1, 2, 3, . . . , ( p − 1)} ,
and
Z7 = {0, 1, 2, 3, 4, 5, 6}
where p ∈ P = {2, 3, 5, 7, . . .}
When arithmetic operations are performed on modular numbers
the results can lie outside the set Zn . This overflow is prevented by
defining arithmetic to be cyclic. Modular numbers cycle back to 0, for
instance, 1 + 6 = 7 = 0 mod 7 and 4 + 5 = 9 = 2 mod 7 The integers
mod n is a cyclic number system. For instance, in mod 5 arithmetic,
counting starts at 0, goes to 4, and continues by cycling back to 0.
While in mod 7 arithmetic counting cycles every seven steps.
In this way every integer m can be identified with a mod n integer
0 ≤ r < n, by setting r equal to the non-negative remainder when m
is divided by n. In this sense the mod n integer r represents an entire
subset of the integers: The subset {r + nk : k ∈ Z}, sometimes called
the residue or equivalence class ‘r mod n’.
[0]5
..
.
−10
−5
0
5
10
..
.
Integers Mod 5
[1]5 [2]5 [3]5
..
.
−9
−4
1
6
11
..
.
..
.
−8
−3
2
7
12
..
.
..
.
−7
−2
3
8
13
..
.
[4]5
[0]7
[1]7
Integers Mod 7
[2]7 [3]7 [4]7
..
.
−6
−1
4
9
14
..
.
..
.
−14
−7
0
7
14
..
.
..
.
−13
−6
1
8
15
..
.
..
.
−12
−5
2
9
16
..
.
..
.
−11
−4
3
10
17
..
.
[5]7
[6]7
..
.
−9
−2
5
12
19
..
.
..
.
−8
−1
6
13
20
..
.
..
.
−10
−3
4
11
18
..
.
The key idea is: The integers mod n partition the integers into n
equivalence classes written [0]n , [1]n , through [n − 1]n and called
0 mod n, 1 mod n, through n − 1 mod n. Each class is a subset of the
integers: The integers with equal remainders when divided by n.
Rational Numbers
To measure fractional quantities, the rational numbers are used.
Q = { a/b : a, b ∈ Z, b 6= 0}
3+4
5+6
3·4
5·6
2−5
5−6
=
=
=
=
=
=
7
11
12
30
−3
−1
=
=
=
=
=
=
0+7
4+7
5+7
2+4·7
4−7
6−7
=
=
=
=
=
=
0
4
5
2
4
6
When the context demands it, you may
need to add syntatic sugar such as [r ]n
make it clear that the integer r mod n is
a set of residues.
cse 1400 applied discrete mathematics
numbers 4
The rational numbers are closed under addition, multiplication,
subtraction, and division.
Division closure: If r and s are rational numbers, then r ÷ s is an rational number.
It is counter-intuitive, but the natural numbers and the rational
numbers have identical cardinality. Consider the Stern-Brocot tree
where each node rs has two children: its left child r+r s and its right
child r+s s .
1
1
2
1
1
2
2
3
3
2
1
3
1
4
4
3
The mediant of rationals numbers rs
u
i
and uv is rs+
+v . An entry j in the SternBrocot tree it the mediant of the first left
ancestor and first right ancestor on the
path from ij to the root.
3
5
2
5
5
2
3
1
5
3
3
4
4
1
The following statements about the entries in the Stern-Brocot tree
are true with easy to understand proofs 1 .
1
1. All the entries are in reduced form, that is, the numerator and
denominator are relatively prime.
Proof. At the root vertex 11 , the greatest common divisor of the
numerator and denominator is 1, that is, they are relatively prime.
Similarly, observe at the next two levels
gcd(1, 2) = 1
and
gcd(2, 1) = 1
and
gcd(1, 3) = 1, gcd(2, 3) = 1, gcd(3, 2) = 1, and gcd(3, 1) = 1
Suppose, by way of contradiction, there is some fraction r/s on the
highest possible level and r and s are not relatively prime. That is,
some natural number larger that 1 evenly divides both.
If r/s is a left child, then its parent r/(s − r ), at a higher level,
is not a reduced fraction either, a contradiction that r/s was at the
highest level.
If r/s is a right child, then its parent (r − s)/s, at a higher level,
is not a reduced fraction either. Another contradiction.
2. Every positive rational number appears somewhere in this tree.
The left child of r/(s − r ) is
r/[(s − r ) + r ] = r/s
The right child of (r − s)/s is
[(r − s) + s]/s = r/s
cse 1400 applied discrete mathematics
numbers 5
Proof. The rational number 1 is at the root of the tree.
Suppose, by way of contradiction, there is a fraction r/s that is not
in the tree.
We may assume that among all fractions that are not in the tree,
r/s is the one with smallest denominator and smallest numerator.
If r > s, then (r − s)/s would not be in the tree either, but its
numerator (r − s) is smaller than r, a contradiction to the construction of r/s.
If r < s, then r/(s − r ) would not be in the tree either, but its
denominator (s − r ) is smaller than s, another contradiction.
3. No rational number appears twice in this tree.
Proof. Can you suggest a proof?
The rational numbers are discrete and can be enumerated like the
natural numbers, but the natural concept of the “next” or “successor”
is lost.
Floating Point Numbers
In computing, floating point numbers are a primitive data type. They
are a finite subset of the rational numbers. Floating point numbers
are used to approximate rational and real numbers. Normalized
floating point numbers are written in scientific notation.
Avogadro’s Number
Planck’s Constant
Gravitational Constant
Speed of light
6.0221417 × 1023 mol−1
6.626068 × 10−34 Nms
6.67428 × 10−11 N(m/kg)2
Number of atoms in 12 grams of carbon-12
The energy of a photon divided by its electromagnetic frequency
Relates attractive force to masses and distance
between two objects
2.99792458 × 108 m/s
In decimal scientific notation a floating point number is written as
±d. f × 10e
where d 6= 0 is a non-zero digit, f is a finite string of digits, and e is a
signed integer.
In binary scientific notation a floating point number is written as
±1. f × 2e
where f is a finite string of bits and e is a signed integer written in
biased notation.
cse 1400 applied discrete mathematics
numbers 6
Floating point numbers are defined by the IEEE Standard for
Floating Point Arithmetic (IEEE 754). A complete description of IEEE
754 is beyond the scope of this course, but two basic types it supports
are
float is a 32-bit (single precision) format. The diagram below show
the organization of a 32-bit word into a sign bit, 8 exponent bits,
and 23 fractional bits.
23
Sign
31
0
Exponent
Mantissa/Fraction
double is a 64-bit (double precision) format. Double precision or-
ganizes a 64-bit word into a sign bit, 11 exponent bits, and 52
fractional bits.
The Real Numbers
To measure continuous, instantaneous changes, the real numbers are
used. There are more real numbers than natural numbers. That is,
there is no one-to-one correspondence between the natural numbers
and the real numbers.
Proof. By way of contradiction, pretend there is a function f (n) = xn
that maps the natural numbers n ∈ N to real numbers xn ∈ [0, 1]
in such a way that every real number x between 0 and 1 appears
somewhere in the sequence
h x0 , x1 , x2 , x3 , . . . i
Consider writing a table of the numbers xk written as in decimal
point notation, with unbounded precision. For example, the mapping might be like that shown in the table below.
Index k
Expansion of xk
Value
0
1
2
3
4
5
6
7
8
9
0 0 0 0 0 0 0 0 0 0
5 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0
3 3 3 3 3 3 3 3 3 3
1 5 0 0 0 0 0 0 0 0
6 6 6 6 6 6 6 6 6 6
3 0 0 0 0 0 0 0 0 0
2 5 0 0 0 0 0 0 0 0
1 3 3 3 3 3 3 3 3 3
6 0 0 0 0 0 0 0 0 0
0.0
0.50
0.200
0.3333
0.15000
0.666666
0.3000000
0.25000000
0.133333333
0.6000000000
Diagonal
9
0.9996939969. . .
9
9
6
9
3
9
9
6
9
Similar to the way a graph may be
drawn in order to understand an idea,
the table is “made-up” to demonstrate
a possible list of all real numbers in the
interval [0, 1].
cse 1400 applied discrete mathematics
numbers 7
The diagonal number 0.9996939969 · · · is not in the table, a contradiction that all real numbers between 0 and 1 are listed.
Complex Numbers
The complex numbers
C=
n
a + bi : a, b ∈ R, i =
√
−1
o
Application of complex numbers in science and engineering are
numerous. One important application is transforming a signal caught
in the time-domain into its representation in the frequency-domain.
The complex numbers are closed under addition, multiplication,
subtraction, division, and exponentiation.
Exponentiation closure: If z and w are complex numbers, then zw is a
complex number.
Problems on Numbers
The notation x ∈ X means element x is
a member of set X.
1. Identify if the propositions are True or False.
(a) 5 ∈ N.
(c) 5 ∈ Q.
(b) −5 ∈ N.
(d) 5i ∈ Q.
2. Is the relation ≤ on the natural numbers N is strict? That is, is it True that if a ≤ b, then b 6≤ a?
3. Place the sets N, Z, Q, R and C in order given by set inclusion.
4. What is the smallest positive rational number?
5. What is (−3)−3 ?
6. What is 43 mod 7?
7. What is −43 mod 7?
8. Describe the residue (equivalence) classes for the modular numbers.
(a) Integers mod 4.
(b) Integers mod 5.
9. Construct an addition table for the modular numbers.
(a) Integers mod 4.
(b) Integers mod 5.
10. Construct a multiplication table for the modular numbers.
(a) Integers mod 4.
(b) Integers mod 5.
11. The default size of a computer’s main memory is governed by the number of bits n in a computer
word. How large must n be to support a memory of the given sizes.
cse 1400 applied discrete mathematics
numbers 8
(a) A byte
(e) A teraobyte
(b) A kilobyte
(f) A petabyte
(c) A megaobyte
(g) A exabyte
(d) A gigaobyte
(h) A zettabyte
The machine naturals are the values in the set
Nn = {0, 1, 2, 3, . . . , 2n − 1}
where n is the computer’s word length.
12. ℵ0 is the symbol for the cardinality of N, the count of elements in the set of natural numbers. ℵ0 is
pronouced aleph-naught. Cantor called ℵ0 a “transfinite” number. Cantor called the cardinality of R,
the set of real numbers, ℵ1 and he proved ℵ0 6= ℵ1 .
(a) Why is transfinite a good word to use?
(b) Are there transfinite numbers between ℵ0 and ℵ1 ?
(c) Read the Wikipedia page on natural numbers. The last time I checked, it provided a good summary
of useful ideas.