Discrete Mathematics: Sets, Sequences and Functions
1.1 Some Special Sets1.2 Set Operations
1.3 Functions
Discrete Mathematics
• http://www.cs.tufts.edu/research/dmw/what_is_dm.html
• http://en.wikipedia.org/wiki/Discrete_mathematics
Sets
• In the past few decades, it has become traditional to use set theory as the underlying basis for mathematics.
• Set – a collection of objects• Must be unambiguous
Sets
• Sets – A, B, S, X• Objects – a, b, s, x• a is a member of S (a∈S)• a is not an element of S (a∉S)
Some Special Sets
• Natural numbers ℕ = {0, 1, 2, 3, …}• Positive integers ℙ = {1, 2, 3, …}• (some texts do not include 0 in ℕ)• Integers (Zahl) ℤ = {0, ±1, ±2, ±3,
…}• Rational numbers (ratios of integers)
ℚ = {m/n: m∈ℤ, n∈ℤ}• Real numbers ℝ
Notation
• Positive even numbers less than 12: {2, 4, 6, 8, 10}
• Primes less than 20: {2, 3, 5, 7, 11, 13, 17, 19}
• { : }• The colon is read “such that”
Notation
• {n:n∈ℕ and n is even} = {0, 2, 4, 6, …}• {x:x∈ℝ and 1≤x<3}• {n∈ℕ: n is even}• {x∈ℝ: 1≤x<3}• {n2: n∈ℕ} = {m∈ℕ: m = n2 for some n∈ℕ} = {0, 1, 4, 9, 16, …}= {n2: n∈ℤ}
• {(-1)n: n∈ℕ} = {-1, 1}
Definitions
• Two sets are equal if they contain the same elements.
• Order is irrelevant• No advantage or harm in repeating• {2, 4, 6, 8, 10} = {10, 8, 6, 4, 2} =
{2, 8, 2, 6, 2, 10, 4, 2}
Definitions
• S is a subset of T (ST) if every element of S belongs to T
• Thus, S = T iff ST and TS
Examples
• ℙℕ, ℕℤ, ℤℚ, ℚℝ• ℙℕℤℚℝ• {n∈ℙ: n is prime and n≥3} {n∈ℙ: n is odd}
• SS ( instead of )
Notation
• TS means TS and T≠S• T is a proper subset of S
Interval Notation
• [a, b] = {x∈ℝ: a≤x≤b}• [a, b) = {x∈ℝ: a≤x<b}• (a, b] = {x∈ℝ: a<x≤b}• (a, b) = {x∈ℝ: a<x<b}• [a, b] = closed interval• (a, b) = open interval• Intervals can also be used with ±∞
Some Special Sets
• {n∈ℕ: 2<n<3}• {x∈ℝ: x2<0}• {r∈ℚ: r2=2}• {x∈ℝ: x2+1=0}• Empty sets are denoted by { } and ∅• Norwegian and Danish letter, not Greek Φ• ∅ is a subset of every set S, because x∈∅
implies x∈S
Inception
• Sets are objects, and can be members of other sets
• Ex.: {{1, 2}, {1, 3}, {2}, {3}} has 4 members
• Thus, {∅} has one member, and ∅ and {∅} are different.
• ∅∈{∅}, and ∅{∅}, but ∅∉∅
Power Sets
• The set of all subsets of a set S is called the power set of S
• P(∅) = {∅}• If S={a, b} and a≠b, then P(S)={∅, {a},
{b}, {a, b}} has 4 elements• If S = {a, b, c}, then P(S) = {∅, {a}, {b},
{c}, {a, b}, {b, c}, {a, c}, {a, b, c}} has 8 elements
• If S is a finite set with n elements, and if n≤3, then P(S) has 2n elements
Languages
• Alphabet = a finite nonempty set Σ whose members are symbols, or letters of Σ, and which is subject to some minor restrictions
• Word = a finite string of letters from Σ
• Σ* = the set of all words using letters from Σ
• Language = any subset of Σ*
Languages
• Let Σ={a, b, c, ..., z}• Any string of letters from Σ belongs to Σ*• Σ* contains math, is, fun, aint, lieblich, amour,
zzyzzoomph, etcetera, etc. (infinite)• We could define the American language L to be
the subset of Σ* consisting of words in Webster’s New World Dictionary of the American Language.
• Thus, L={a, aachen, aardvark, aardwolf, …, zymurgy} (finite)
Null
• The empty word, or null word, is the string with no letters at all, and is denoted by λ
Restrictions on Σ
• Σ cannot contain any letters that are themselves strings of letters in Σ
• Σ={a, b, c}
• Σ={a, b, c, ac}
• Σ={a, b, ca}
• Σ={a, b, Ab}
• Σ={a, b, ac}
Length
• length(w) is the number of letters from Σ in w
• length(aab); Σ={a, b}
• length(bab); Σ={a, b}
• length(abbAb); Σ={a, b, Ab}
• length(λ)
Set Operations
• Union - A B = {∪ x:x A or ∈ x B or both}∈• Intersection - A∩B = {x:x A and ∈ x B} ∈• Disjoint – no elements in common (A∩B=
∅)• Relative complement – set of objects
in A and not in B (A\B={x:x A and ∈x∉B} = {x A:∈ x∉B}
Set Operations
• Symmetric difference A⊕B={x:x A or ∈x B but not both}∈
• A⊕B=(A B)\(A∩B)=(A\B) (B\A)∪ ∪• Venn diagrams
Universe
• Set U is the universe or universal set• U can be ℕ, , or ℝ Σ*• Only consider elements in U and subsets of U• Absolute complement (or complement) of A,
Ac=AU• U is denoted by a box in Venn diagrams• Note that A\B=A∩Bc
• Ac∩Bc=(A B)∪ c
Commutative Laws
• A B = B A ∪ ∪• A∩B = B∩A
Associative Laws
• (A B) C = A (B C)∪ ∪ ∪ ∪• (A∩B)∩C = A∩(B∩C)
• (A B)∩C ∪ ≟ A (B∩C)∪• (A∩B) C ∪ ≟ A∩(B C)∪
Distributive Laws
• (A B)∩C = (A B)∩(A C)∪ ∪ ∪• (A∩B) C = (A∩B) (A∩C)∪ ∪
Idempotent Laws
• A A = A∪• A∩A = A
Identity Laws
• A∪∅ = A• A∩U = U
• A∩∅ = ∅• A U = A∪
Double Complementation
• (Ac)c = A
Other Laws
• A A∪ c = U
• A∩Ac = ∅
• Uc = ∅• ∅c = U
DeMorgan Laws
• (A B)∪ c = Ac∩Bc
• (A∩B)c = Ac B∪ c
Other Properties
• (A B)∩A∪ c B• (A⊕B)⊕C = A⊕(B⊕C)
Product
• Consider sets S and T, with s S and ∈ t T∈• (s, t) is an ordered pair (order is important)
• Product – the set of all ordered pairs (s, t)
• S x T = {(s, t): s S and ∈ t T}∈• If S = T, S x S can be written as S2
Notation
• For any finite set S, |S| indicates the number of elements in the set
• |S x T| = |S| ∙ |T|
• |P(S)| = 2|S|
• P(S) can be written as 2S
Product Set
• Product set S1 x S2 x ∙∙∙ x Sn consists of all ordered n-tuples (s1, s2, …, sn)
Functions
• A function f assigns to some element x in some set S a unique element in a set T.
• f is defined on S with values in T
• S – domain of f, Dom(f)
• The element assigned to x is written f(x)
Functions
• f is complete specified by Dom(f) and the formula or rule giving f(x) for each x Dom(f)∈
• f(x) is the image of x under f
• Im(f)T is the image of f, or the set of all images f(x)
Functions
• T is the codomain of f
• Any set containing Im(f) can be a codomain
• f:S→T means “f is a function with domain s and codomain T”
• Or: f maps S into T
Functions
• Graph(f) = {(x, y) S x T: ∈ y = f(x)}