mathematical notions and terminology lecture 2 section 0.2 fri, aug 24, 2007
TRANSCRIPT
Mathematical Notions and Terminology
Lecture 2Section 0.2
Fri, Aug 24, 2007
Functions and Relations
• A function associates every element of its domain with exactly one element of its range, or codomain.
Functions and Relations
• Let f : A B be a function.• f is one-to-one if
f(x) = f(y) x = y.• Equivalently,
x y f(x) f(y).
Functions and Relations
• f is onto if for every y B, there is x A such that f(x) = y.
A One-to-one Correspondence
• A hallway has 100 lockers, numbered 1 through 100.
• All 100 lockers are closed.• There are 100 students, numbered
1 through 100.
A One-to-one Correspondence
• For each k, student k’s instructions are to reverse the state of every k-th locker door, starting with locker k.
• If all 100 students do this, which lockers will be left open?
A One-to-one Correspondence• Which students should be sent down the
hall so that exactly the prime-numbered lockers are left open?
• Is it possible to leave any specified set of lockers open?
• Is it possible for two different sets of students to leave the same lockers open?
A One-to-one Correspondence
• Let L be the set of all lockers and let S be the set of all students.
• Let f :(S) (L) be defined as• f(A) is the set of locker doors left open
after the students in A have gone down the hall.
A One-to-one Correspondence
• Show that f is a one-to-one correspondence.
Functions and Relations
• A subset of A A is called a (binary) relation on A.
Functions and Relations
• A binary relation R is an equivalence relation if it is • Reflexive: (x, x) R.• Symmetric: (x, y) R (y, x) R.• Transitive: (x, y) R and (y, z) R
(x, z) R.
for all x, y, z R.
Equivalence Relations
• We may define two computer programs to be equivalent if they always produce the same output for the same input.
• Show that this is an equivalence relation.
• Describe an equivalence class under this relation.
Graphs
• A graph consists of a finite set of vertices and a finite set of edges.
• In a directed graph, each edge has a direction from one vertex to another.
Graphs and Relations
• A graph may be used to represent a relation.• Draw a vertex for every element in A.• If a has the relation to b, then draw
an edge from a to b.
Graphs and Relations
• If the relation is reflexive, we may choose not to draw the loops.
• If the relation is symmetric, we do not need to show the arrowheads.
• If the relation is transitive, we may show only a minimal set of egdes.
Strings and Languages
• An alphabet is a finite set of symbols, typically letters, digits, and punctuation.
• A string is a finite sequence of symbols from the alphabet.
• The empty string is the unique string of length 0.
Strings and Languages
• Let the alphabet be = {a, b}.• Some strings:
• aaa• abb• abbababbabbbababab
Lexicographical Order
• Assume that the symbols themselves are ordered.
• Group the strings according to their length.
• Then, within each group, order the strings “alphabetically” according to the ordering of the symbols.
Lexicographical Order
• Let the alphabet be = {a, b}.• The set of all strings in
lexicographical order is{, a, b, aa, ab, ba, bb, aaa, …,
bbb, aaaa, …, bbbb, …}
Computer Programs
• Can the set of all possible computer programs be arranged in lexicographical order?