Download - ch2. Language of Mathematics
-
7/29/2019 ch2. Language of Mathematics
1/62
R. Johnsonbaugh,Discrete Mathematics
5th edition, 2001
Chapter 2
The Language of Mathematics
-
7/29/2019 ch2. Language of Mathematics
2/62
2.1 Sets
Set =a collection of distinct unorderedobjects
Members of a set are called elements How to determine a set
Listing:
Example: A = {1,3,5,7}
Description
Example: B = {x | x = 2k + 1, 0 < k < 3}
-
7/29/2019 ch2. Language of Mathematics
3/62
Finite and infinite sets
Finitesets
Examples:
A = {1, 2, 3, 4}
B = {x | x is an integer, 1 < x < 4}
Infinitesets
Examples:
Z = {integers} = {, -3, -2, -1, 0, 1, 2, 3,} S={x| x is a real number and 1 < x < 4} = [0, 4]
-
7/29/2019 ch2. Language of Mathematics
4/62
Some important sets
The emptyset has no elements.
Also called null setorvoid set.
Universalset: the set of all elements aboutwhich we make assertions.
Examples:
U = {all natural numbers} U = {all real numbers}
U = {x| x is a natural number and 1< x
-
7/29/2019 ch2. Language of Mathematics
5/62
Cardinality
Cardinality of a set A (in symbols |A|) is the
number of elements in A
Examples:
If A = {1, 2, 3} then |A| = 3
If B = {x | x is a natural number and 1< x< 9}
then |B| = 9
Infinite cardinality Countable (e.g., natural numbers, integers)
Uncountable (e.g., real numbers)
-
7/29/2019 ch2. Language of Mathematics
6/62
Subsets
X is a subsetof Y if every element ofX is also contained in Y
(in symbols X Y) Equality: X = Y if X Y and Y X
X is a proper subsetof Y if X Y butY X Observation: is a subset of every set
-
7/29/2019 ch2. Language of Mathematics
7/62
Power set
The power setof X is the set of all subsets of X,in symbolsP(X),
i.e.P(X)= {A | A X}
Example: if X = {1, 2, 3},
thenP(X) = {, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}}
Theorem 2.1.4: If |X| = n, then |P(X)| = 2n
.
-
7/29/2019 ch2. Language of Mathematics
8/62
Set operations:
Union and Intersection
Given two sets X and Y
The unionof X and Y is defined as the set
X Y = { x | x X or x Y}
The intersectionof X and Y is defined as the set
X Y = { x | x X and x Y}
Two sets X and Y are disjointif X Y =
-
7/29/2019 ch2. Language of Mathematics
9/62
Complement and Difference
The differenceof two sets
X Y = { x | x X and x Y}
The difference is also called the relative complement
of Y in X
Symmetric difference
X Y = (X Y) (Y X)
The complementof a set A contained in auniversal set U is the set Ac = U A
In symbols Ac = U - A
-
7/29/2019 ch2. Language of Mathematics
10/62
Venn diagrams
A Venn diagram provides a graphic view ofsets
Set union, intersection, difference,
symmetric difference and complements canbe identified
-
7/29/2019 ch2. Language of Mathematics
11/62
Properties of set operations (1)
Theorem 2.1.10: Let U be a universal set, and
A, B and C subsets of U. The followingproperties hold:
a) Associativity: (A B) C = A (B C)
(A B) C = A (B C)
b) Commutativity: A B = B A
A B = B A
-
7/29/2019 ch2. Language of Mathematics
12/62
Properties of set operations (2)
c) Distributive laws:
A(BC) = (AB)(AC)A(BC) = (AB)(AC)
d) Identity laws:
AU=A A = Ae) Complement laws:
AAc = U AAc =
-
7/29/2019 ch2. Language of Mathematics
13/62
Properties of set operations (3)
f) Idempotent laws:
AA = A AA = Ag) Bound laws:
AU = U A =
h) Absorption laws:A(AB) = A A(AB) = A
-
7/29/2019 ch2. Language of Mathematics
14/62
Properties of set operations (4)
i) Involution law: (Ac)c = A
j) 0/1 laws: c = U Uc =
k) De Morgans laws for sets:
(AB)c
= Ac
Bc
(AB)c = AcBc
-
7/29/2019 ch2. Language of Mathematics
15/62
2.2 Sequences and strings
A sequenceis an ordered list of numbers,usually defined according to a formula: sn = a
function of n = 1, 2, 3,...
If s is a sequence {sn| n = 1, 2, 3,}, s1 denotes the first element,
s2the second element,
snthe nth element
{n} is called the indexing setof the sequence.Usually the indexing set is N (natural numbers)
or an infinite subset of N.
-
7/29/2019 ch2. Language of Mathematics
16/62
Examples of sequences
Examples:
1. Let s = {sn} be the sequence defined by
sn= 1/n , for n = 1, 2, 3,
The first few elements of the sequence are: 1, , 1/3, ,
1/5,1/6,
2. Let s = {sn} be the sequence defined bysn = n
2+ 1, for n = 1, 2, 3,
The first few elements of s are: 2, 5, 10, 17, 26, 37, 50,
-
7/29/2019 ch2. Language of Mathematics
17/62
Increasing and decreasing
A sequence s = {sn} is said to be
increasingif sn < sn+1
decreasingis sn > sn+1,
for every n = 1, 2, 3,Examples:
Sn = 42n, n = 1, 2, 3, is decreasing:
2, 0, -2, -4, -6,
Sn = 2n -1, n = 1, 2, 3, is increasing:
1, 3, 5, 7, 9,
-
7/29/2019 ch2. Language of Mathematics
18/62
Subsequences
A subsequenceof a sequence s = {sn} is asequence t = {tn} that consists of certain
elements of s retained in the original orderthey had in s
Example: let s = {sn= n | n = 1, 2, 3,}
1, 2, 3, 4, 5, 6, 7, 8,
Let t = {tn= 2n | n = 1, 2, 3,} 2, 4, 6, 8, 10, 12, 14, 16,
t is a subsequence of s
-
7/29/2019 ch2. Language of Mathematics
19/62
Sigma notation
If {an} is a sequence, then the sum
m
ak = a1 + a2+ + amk= 1
This is called the sigma notation, where the
Greek letter indicates a sum of termsfrom the sequence
-
7/29/2019 ch2. Language of Mathematics
20/62
Pi notation
If {an} is a sequence, then the product
m
ak = a1a2amk=1
This is called the pi notation, where theGreek letterindicates a product of termsof the sequence
-
7/29/2019 ch2. Language of Mathematics
21/62
Strings
Let X be a nonempty set. A string over Xis afinite sequence of elements from X.
Example: if X = {a, b, c}
Then = bbaccc is a string over X
Notation: bbaccc = b2ac3
The length of a string is the number of elements of and is denoted by ||. If = b2ac3 then || = 6.
The null stringis the string with no elements andis denoted by the Greek letter (lambda). It haslength zero.
-
7/29/2019 ch2. Language of Mathematics
22/62
More on strings
Let X* = {all strings over X including }
Let X+ = X* - {}, the set of all non-null strings
Concatenationof two strings and is theoperation on strings consisting of writing followed by to produce a new string Example: = bbaccc and = caaba,
then = bbaccccaaba = b2ac4a2baClearly, || = | | + ||
-
7/29/2019 ch2. Language of Mathematics
23/62
2.3 Number systems
Binarydigits: 0 and 1, called bits.
In this section we study: binary, hexadecimaland octalnumber systems.
Review ofdecimalsystem: Example: 45,238 is equal to
8 ones 8 x 1 = 8
3 tens 3 x 10 = 30
2 hundreds 2 x 100 = 200
5 thousands 5 x 1000 = 5000
4 ten thousands 4 x 10000 = 40000
-
7/29/2019 ch2. Language of Mathematics
24/62
Binary number system
From binary to decimal:
The number 1101011 is equivalent to 1 one 1 x20 = 1
1 two 1x21
= 2 0 four 0x22 = 0
1 eight 1x23 = 8
0 sixteen 0x24 = 0
1 thirty-two 1x25
= 32 1 sixty-four 1x26 = 64
107 in decimal base
-
7/29/2019 ch2. Language of Mathematics
25/62
From decimal to binary
The number 7310 is equivalent to 73 = 2 x 36 + remainder 1
36 = 2 x 18 + remainder 0
18 = 2 x 9 + remainder 0
9 = 2 x 4 + remainder 1
4 = 2 x 2 + remainder 0
2 = 2 x 1 + remainder 0
7310 = 10010012(write the remainders in reverse order preceded by
the quotient)
-
7/29/2019 ch2. Language of Mathematics
26/62
Binary addition table
0 1
0 0 1
1 1 10
-
7/29/2019 ch2. Language of Mathematics
27/62
Adding binary numbers
Example: add 1001012 + 1100112
1 1 1 carry ones
1001012
1100112
10110002
-
7/29/2019 ch2. Language of Mathematics
28/62
Hexadecimal number system
Decimal system
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 A B C D E F
Hexadecimal system
-
7/29/2019 ch2. Language of Mathematics
29/62
Hexadecimal to decimal
The hexadecimal number 3A0B16 is
11 x 160 = 11
0 x 161 = 0
10 x 162 = 2560
3 x 163 = 12288
1485910
-
7/29/2019 ch2. Language of Mathematics
30/62
Decimal to hexadecimal
Given the number 234510
2345 = 146x16 + remainder 9146 = 9x16 + remainder 2
234510
is equivalent to the hexadecimal number 92916
-
7/29/2019 ch2. Language of Mathematics
31/62
Hexadecimal addition
Add 23A16 + 8F16
23A16
+ 8F16
2C916
-
7/29/2019 ch2. Language of Mathematics
32/62
2.4 Relations
Given two sets X and B, its Cartesian productXxY is the set of all ordered pairs (x,y) where
xX and yY
In symbols XxY = {(x, y) | xX and yY}
A binary relationRfrom a set X to a set Y is asubset of the Cartesian product XxY
Example: X = {1, 2, 3} and Y = {a, b}
R= {(1,a), (1,b), (2,b), (3,a)} is a relation between Xand Y
-
7/29/2019 ch2. Language of Mathematics
33/62
Domain and range
Given a relation Rfrom X to Y,
The domainofRis the set
Dom(R) = { xX | (x, y) Rfor some yY}
The rangeofRis the set Rng(R) = { yY | (x, y) Rfor some x X}
Example:
if X = {1, 2, 3} and Y = {a, b}
R= {(1,a), (1,b), (2,b)}
Then: Dom(R)= {1, 2}, Rng(R) = (a, b}
-
7/29/2019 ch2. Language of Mathematics
34/62
Example of a relation
Let X = {1, 2, 3} and Y = {a, b, c, d}.
Define R= {(1,a), (1,d), (2,a), (2,b), (2,c)}
The relation can be pictured by a graph:
-
7/29/2019 ch2. Language of Mathematics
35/62
Properties of relations
Let Rbe a relation on a set X
i.e. Ris a subset of the Cartesian product XxX
Ris reflexiveif (x,x) Rfor every xX
Ris symmetricif for all x, y X such that (x,y)Rthen (y,x) R
Ris transitiveif (x,y) Rand (y,z) Rimply
(x,z) R Ris antisymmetricif for all x,yX such that
xy, if (x,y) Rthen (y,x) R
-
7/29/2019 ch2. Language of Mathematics
36/62
Order relations
Let X be a set and Ra relation on X
Ris a partial orderon X if R is reflexive,antisymmetric and transitive.
Let x,yX If (x,y) or (y,x) are in R, then x and y are
comparable
If (x,y) Rand (y,x) Rthen x and y areincomparable
If every pair of elements in X are
comparable, then Ris atotal orderon X
-
7/29/2019 ch2. Language of Mathematics
37/62
Inverse of a relation
Given a relation Rfrom X to Y, its inverse R-1is the relation from Y to X defined by
R-1 = { (y,x) | (x,y) R}
Example: ifR= {(1,a), (1,d), (2,a), (2,b), (2,c)}then R-1= {(a,1), (d,1), (a,2), (b,2), (c,2)}
-
7/29/2019 ch2. Language of Mathematics
38/62
2.5 Equivalence relations
Let X be a set and Ra relation on X
Ris an equivalence relationon X Ris
reflexive, symmetric and transitive. Example: Let X = {integers} and Rbe the
relation on X defined by: xRy x - y = 5. Itis easy to show that Ris an equivalence
relation on the set of integers.
-
7/29/2019 ch2. Language of Mathematics
39/62
Partitions
A partitionSon a set X is a family{A1, A2,, An} of subsets of X, such
thatA1A2A3An = XAj Ak = for every j, k with j k,
1 < j, k < n.Example: if X = {integers}, E = {even
integers) and O = {odd integers}, thenS= {E, O} is a partition of X.
-
7/29/2019 ch2. Language of Mathematics
40/62
Partitions and equivalence relations
Theorem 2.5.1: Let Sbea partition on a set X.
Define a relation Ron X by xRy if x, y are in thesame set T for T S. Then Ris an equivalencerelationon X.
i.e. an equivalence relation on a set X corresponds to a
partition of X and conversely.
-
7/29/2019 ch2. Language of Mathematics
41/62
Equivalence classes
Let X be a set and let Rbe an equivalencerelation on X. Let a X.
Define [a] ={ xX | xRa }
Let S = { [a] | a X }
Theorem 2.5.9: S is a partition on X.
The sets [a] are called equivalence classes
of X induced by the relation R. Given a, b X, then [a] = [b] or [a][b] =
-
7/29/2019 ch2. Language of Mathematics
42/62
Set of equivalence classes
IfRis an equivalence relation on a set X, defineX/R= {[a] | a X }.
Theorem 2.5.16: If each equivalence class on a
finite set X has k elements, then X/Rhas |X|/kelements, i.e. |X/R| = |X|/ k.
-
7/29/2019 ch2. Language of Mathematics
43/62
2.6 Matrices of relations
Let X, Y be sets and Ra relation from X to Y
Write the matrix A = (aij) of the relation as
follows:
Rows of A = elements of X Columns of A = elements of Y
Element ai,j = 0 if the element of X in row i and
the element of Y in column j are not related
Element ai,j = 1 if the element of X in row i andthe element of Y in column j are related
-
7/29/2019 ch2. Language of Mathematics
44/62
The matrix of a relation (1)
Example:
Let X = {1, 2, 3}, Y = {a, b, c, d}
Let R= {(1,a), (1,d), (2,a), (2,b), (2,c)}
The matrix A of the relation Ris
A =
a b c d
1 1 0 0 1
2 1 1 1 0
3 0 0 0 0
-
7/29/2019 ch2. Language of Mathematics
45/62
The matrix of a relation (2)
IfRis a relation from a set X to itself and A is thematrix ofRthen A is a square matrix.
Example: Let X = {a, b, c, d} and R= {(a,a),
(b,b), (c,c), (d,d), b,c), (c,b)}. Then
A =
a b c d
a 1 0 0 0
b 0 1 1 0c 0 1 1 0
d 0 0 0 1
-
7/29/2019 ch2. Language of Mathematics
46/62
The matrix of a relation on a set X
Let A be the square matrix of a relation Rfrom X to itself. Let A2 = the matrix product
AA.
Ris reflexive All terms aii in the maindiagonal of A are 1.
Ris symmetric aij = aji for all i and j, i.e. R is a symmetric relation on X if A is a
symmetric matrix
Ris transitive whenever cij in C = A2 isnonzero then entry aij in A is also nonzero.
-
7/29/2019 ch2. Language of Mathematics
47/62
2.7 Relational databases
A binaryrelation Ris a relation among twosets X and Y, already defined as R X x Y.
An n-aryrelation Ris a relation among nsets X1, X2,, Xn, i.e. a subset of the
Cartesian product, R X1 x X2 xx Xn. Thus, Ris a set of n-tuples (x1, x2,, xn) where
xk Xk, 1 < k < n.
-
7/29/2019 ch2. Language of Mathematics
48/62
Databases
A databaseis a collection of records that are
manipulated by a computer. They can beconsidered as n sets X1 through Xn, each of
which contains a list of items with information.
Database management systemsare
programs that help access and manipulateinformation stored in databases.
-
7/29/2019 ch2. Language of Mathematics
49/62
Relational database model
Columns of an n-ary relation are called attributes
Anattribute is a keyif no two entries have the
same value e.g. social security number
A queryis a request for information from thedatabase
-
7/29/2019 ch2. Language of Mathematics
50/62
Operators
The selection operatorchooses n-tuplesfrom a relation by giving conditions on the
attributes
The projection operatorchooses two ormore columns and eliminates duplicates
Thejoin operatormanipulates tworelations
-
7/29/2019 ch2. Language of Mathematics
51/62
2.8 Functions
A functionf from X to Y (insymbols f : X Y) is arelation from X to Y such that
Dom(f) = X and if two pairs(x,y) and (x,y) f, then y = y
Example:
Dom(f) = X = {a, b, c, d},
Rng(f) = {1, 3, 5}
f(a) = f(b) = 3, f(c) = 5, f(d) = 1.
-
7/29/2019 ch2. Language of Mathematics
52/62
Domain and Range
Domainof f = X
Rangeof f =
{ y | y = f(x) for some x X}
A function f : X Y assigns toeach x in Dom(f) = X a unique
element y in Rng(f) Y.
Therefore, no two pairs in f havethe same first coordinate.
-
7/29/2019 ch2. Language of Mathematics
53/62
Modulus operator
Let x be a nonnegative integer and y a positive
integer
r = x mod y is the remainder when x is divided
by yExamples:
1 = 13 mod 3
6 = 234 mod 19
4 = 2002 mod 111
mod is called the modulus operator
-
7/29/2019 ch2. Language of Mathematics
54/62
One-to-one functions
A function f : X Y is one-to-one for each y Y there exists at most one x Xwith f(x) = y.
Alternative definition: f : X Y is one-to-one for each pair of distinct elements x1, x2 X thereexist two distinct elements y1, y2 Y such thatf(x1) = y1 and f(x2) = y2.Examples:
1. The function f(x) = 2x from the set of real numbers to itself isone-to-one
2. The function f : RRdefined by f(x) = x2 is not one-to-one,since for every real number x, f(x) = f(-x).
-
7/29/2019 ch2. Language of Mathematics
55/62
Onto functions
A function f : X Y is onto
for each y Y there exists at least one x Xwith f(x) = y, i.e. Rng(f) = Y. Example: The function f(x) = ex from the set of real
numbers to itself is not onto Y = the set of all real
numbers. However, if Y is restricted to Rng(f) = R +,
the set of positive real numbers, then f(x) is onto.
-
7/29/2019 ch2. Language of Mathematics
56/62
Bijective functions
A function f : X Y is bijective
f is one-to-one and onto
Examples: 1. A linear function f(x) = ax + b is a bijective function from
the set of real numbers to itself
2. The function f(x) = x3 is bijective from the set of real
numbers to itself.
-
7/29/2019 ch2. Language of Mathematics
57/62
Inverse function
Given a function y = f(x), the inverse f-1 is the
set {(y, x) | y = f(x)}.
The inverse f-1 of f is not necessarily a
function. Example: if f(x) = x2, then f-1 (4) = 4 = 2, not a
unique value and therefore f is not a function.
However, if f is a bijective function, it can be
shown that f-1 is a function.
Exponential and
-
7/29/2019 ch2. Language of Mathematics
58/62
Exponential and
logarithmic functions
Let f(x) = 2x and g(x) = log 2 x = lg x
f g(x) = f(g(x)) = f(lg x) = 2 lg x = x g f(x) = g(f(x)) = g(2x) = lg 2x = x
Therefore, the exponential and logarithmic
functions are inverses of each other.
-
7/29/2019 ch2. Language of Mathematics
59/62
Composition of functions
Given two functions g : X Y and f : Y Z,the composition f g is defined as follows:
f g (x) = f(g(x)) for every x X.
Example: g(x) = x2 -1, f(x) = 3x + 5. Thenf g(x) = f(g(x)) = f(3x + 5) = (3x + 5)2 - 1
Composition of functions is associative:
f (g h) = (f g) h,
But, in general, it is not commutative:
f g g f.
-
7/29/2019 ch2. Language of Mathematics
60/62
Binary operators
A binary operatoron a set X is a function f thatassociates a single element of X to every pair of
elements in X, i.e. f : X x X X and f(x1, x2) Xfor every pair of elements x1, x2.
Examples of binary operators are addition,
subtraction and multiplication of real numbers, takingunions or intersections of sets, concatenation of two
strings over a set X, etc.
-
7/29/2019 ch2. Language of Mathematics
61/62
Unary operators
A unary operatoron a set X associates toeach single element of X one element of X.
Examples:
1. Let X = U be a universal set and P(U) the powerset of U. Define f : P(U) P(U) the functiondefined by f (A) = A', the set complement of A in U,
for every A U. Then f defines a unary operatoron P(U).
-
7/29/2019 ch2. Language of Mathematics
62/62
String inverse
Let X be any set, X* the set of all strings over X.
If = x1x2xn X*, let f() = -1 = xnxn-1x2x1,the string written in reverse order.
Then f :X* X* is a function that defines a unaryoperator on X*.
Observe that -1 = -1 =