0% found this document useful (0 votes)
41 views129 pages

Unit 4 Set Theory and Functions

This document provides an overview of discrete mathematics concepts including set theory, logic, functions, and relations. It defines key terms and concepts, provides examples, and lists course objectives and outcomes. The document is intended for a compulsory discrete mathematics course for undergraduate students.

Uploaded by

sharvarictamane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views129 pages

Unit 4 Set Theory and Functions

This document provides an overview of discrete mathematics concepts including set theory, logic, functions, and relations. It defines key terms and concepts, provides examples, and lists course objectives and outcomes. The document is intended for a compulsory discrete mathematics course for undergraduate students.

Uploaded by

sharvarictamane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 129

Discrete Mathematics

Course Code: 0UIT404D, Course Type: Compulsory


L – T – P: 3– 0 – 0
Stream: Core, Credits: 3

Prepared By: Dr S C Tamane


Course Objectives
This course will enable students to
1. Use standard notations to Write English sentences for logical
expressions and vice-versa.
2. To develop a foundation of set theory concepts, notation and
applications.
3. Understand logic, basic counting principles, function, relations and
probability.
Course Outcomes
After learning the course, the students should be able to
1. Verify the correctness of an argument using symbolic logic and truth
tables.
2. Construct mathematical arguments using logical connectives and
quantifiers.
3. Construct proofs using mathematical induction And Solve problems
involving recurrence relations and generating functions
4. Perform operations on discrete structures such as sets, functions,
relations
5. Solve problems using counting techniques on sets and also find
probability
Books
• Text Books:
1. Susanna S. Epp, “Discrete Mathematics with Applications” 4th
Edition.
2. K. H. Rosen, “Discrete Mathematics and Its Applications”, Tata
McGraw Hill Publication, 7 th Edition, 2012.
3. B. Kolman, R. Busby, S. Ross, “Discrete Mathematical Structures”,
Pearson Education, 6 th Edition, 2009.
4. R. K. Bisht, H. S. Dhami, “Discrete Mathematics”, Oxford University
Press, 2015.
Books
• Reference Books:
1. Kenneth H Rosen, “Discrete Mathematics and its Applications”.
2. C L Liu, “Elements of Discrete Mathematics”.
3. Norman L Biggs, “Discrete Mathematics”.
4. Kenneth Bogart and Robert L Drysdale, “Discrete Mathematics for
Computer Science”.
5. R Krishna Kumar, “Discrete Mathematics”.

• E-sources:
NPTEL course on Discrete Mathematics.
Contents
• Unit 4: Set Theory & Function
• Set Theory: Definitions and the Element Method of Proof
Disproofs,
• Functions: Defined on General Sets, One-to-One and Onto,
Inverse Functions, Composition of Functions, Cardinality with
Applications to Computability
• (Chapter 6: Set Theory and Chapter 7: Functions from
Susanna S. Epp, “Discrete Mathematics with Applications”
4th Edition)
Set Theory Definitions
• The words set and element are undefined terms of set theory.
• According to Cantor’s notation, let S denote a set and a an
element of S.
• Then, a ∈ S means that a is an element of S,
• a ∉ S means that a is not an element of S.
• {1, 2, 3} refers to the set whose elements are 1, 2, and 3, and
• {1, 2, 3, . . .} refers to the set of all positive integers.
• If S is a set and P(x) is a property that elements of S may or may
not satisfy, then a set A may be defined as:
• A = {x ∈ S | P(x)},
• which is read “the set of all x in S such that P of x.”
Subsets: Proof and Disproof
• Consider a set A to be a subset of a set B as a formal universal
conditional statement:
• A ⊆ B ⇔ ∀x, if x ∈ A then x ∈ B.
• The negation is, therefore, existential:
• A⊄ B ⇔ ∃x such that x ∈ A and x ∉ B.
• A proper subset of a set is a subset that is not equal to its
containing set. Thus
• A is a proper subset of B ⇔
1) A⊆B, and
2) there is at least one element in B that is not in A.
Subsets: Proof and Disproof
• Testing Whether One Set Is a Subset of Another:
• Let A = {1} and B = {1, {1}}.
• a. Is A ⊆ B?
• b. If so, is A a proper subset of B?
• Solution
a. Because A = {1}, A has only one element, namely the symbol 1. This
element is also one of the elements in set B.
Hence every element in A is in B, and so A ⊆ B.
b. B has two distinct elements, the symbol 1 and the set {1} whose only
element is 1.
Since 1 = {1}, the set {1} is not an element of A, and so there is an element of
B that is not an element of A. Hence A is a proper subset of B.
Set Equality
• Given sets A and B, A equals B, written A = B, if, and only if,
every element of A is in B and every element of B is in A.
• Symbolically:
• A = B ⇔ A ⊆ B and B ⊆ A.
Ven Diagrams
• If sets A and B are represented as regions in the plane,
relationships between A and B can be represented by
pictures, called Venn diagrams.
• The relationship A ⊆ B can be pictured in one of two ways,
Ven Diagrams
• The relationship A ⊄ B can be represented in three different
ways with Venn diagrams, as shown
Relations among Sets of Numbers
• Since Z, Q, and R denote the sets of integers, rational
numbers, and real numbers, respectively,
• Z is a subset of Q because every integer is rational (any
integer n can be written in the form n/1 )
• Q is a subset of R because every rational number is real
• Z is a proper subset of Q because there are rational
numbers that are not integers (for example, 1/2)
• Q is a proper subset of R because there are real
numbers that are not rational (for example, √2).
Operations on Sets
• Definition
• Let A and B be subsets of a universal set U.
1. The union of A and B, denoted A ∪ B, is the set of all elements that are in at least
one of A or B.
2. The intersection of A and B, denoted A ∩ B, is the set of all elements that
are common to both A and B.
3. The difference of B minus A, denoted B − A, is the set of all elements that are in B
and not A.
4. The complement of A, denoted Ac, is the set of all elements in U that are not in A.
• Symbolically: A ∪ B = {x ∈ U | x ∈ A or x ∈ B},
• A ∩ B = {x ∈ U | x ∈ A and x ∈ B},
• B − A = {x ∈ U | x ∈ B and x ∉ A},
• Ac = {x ∈ U | x ∉ A}.
Operations on Sets
•Venn diagram representations for union, intersection, difference,
and complement are shown in Figure:
Unions, Intersections, Differences, and
Complements
•Let the universal set be the set U = {a, b, c, d, e, f, g} and
let A = {a, c, e, g} and B = {d, e, f, g}. Find A ∪ B, A ∩ B, B −
A, and Ac.
Solution
A ∪ B = {a, c, d, e, f, g}
A ∩ B = {e, g}
B − A = {d, f }
Ac = {b, d, f }
Unions, Intersections, Differences, and
Complements
Unions, Intersections, Differences, and
Complements
Unions, Intersections, Differences, and
Complements
The empty Set
• The empty set (or null set) is denoted as ∅.
• {1, 3} ∩ {2, 4} = ∅
• {x ∈ R| x2 = −1} = ∅.
• D = {x ∈ R| 3 < x < 2}.
• a < x < b means that a < x and x < b.
• So, D consists of all real numbers that are both greater
than 3 and less than 2.
• Since there are no such numbers, D has no elements and
so D = ∅.
Partitions of Sets
• Definition
• Two sets are called disjoint if, and only if, they have
no elements in common.
• Symbolically:
• A and B are disjoint ⇔ A ∩ B = ∅.
Disjoint Sets
• Disjoint Sets
• Let A = {1, 3, 5} and B = {2, 4, 6}. Are A and B disjoint?
• Solution Yes. By inspection A and B have no elements
in common, or, in other words,
• {1, 3, 5} ∩ {2, 4, 6} = ∅.
Mutually Disjoint Sets
• Definition
• Sets A1, A2, A3 . . . are mutually disjoint (or pairwise
disjoint or nonoverlapping) if, and only if, no two
sets Ai and Aj with distinct subscripts have any
elements in common.
• More precisely, for all i, j = 1, 2, 3, . . .
• Ai ∩ Aj = ∅ whenever i ≠ j.
Mutually Disjoint Sets
• a. Let A1 = {3, 5}, A2 = {1, 4, 6}, and A3 = {2}. Are A1, A2,
and A3 mutually disjoint?
• b. Let B1 = {2, 4, 6}, B2 = {3, 7}, and B3 = {4, 5}. Are B1, B2,
and B3 mutually disjoint?
• Solution
• a. Yes. A1 and A2 have no elements in common, A1 and
A3 have no elements in common, and A2 and A3 have no
elements in common.
• b. No. B1 and B3 both contain 4.
Mutually Disjoint Sets
• Suppose A, A1, A2, A3, and A4 are the sets of
points represented by the regions shown in
Figure 6.1.5.
• Then A1, A2, A3, and A4 are subsets of A, and
A = A1 ∪ A2 ∪ A3 ∪ A4.
• These sets are mutually disjoint. Then A is
called a union of mutually disjoint subsets,
and the collection of sets {A1, A2, A3, A4} is
said to be a partition of A.
Mutually Disjoint Sets
• Definition
• A finite or infinite collection of nonempty sets {A1,
A2, A3 . . .} is a partition of a set A if, and only if,
• 1. A is the union of all the Ai
• 2. The sets A1, A2, A3, . . . are mutually disjoint.
Partition of Sets
• a. Let A = {1, 2, 3, 4, 5, 6}, A1 = {1, 2}, A2 = {3, 4}, and
A3 = {5, 6}. Is {A1, A2, A3} a partition of A?
• b. Let Z be the set of all integers and let
• T0 = {n ∈ Z| n = 3k, for some integer k},
• T1 = {n ∈ Z| n = 3k + 1, for some integer k}, and
• T2 = {n ∈ Z| n = 3k + 2, for some integer k}.
• Is {T0, T1, T2} a partition of Z?
Partition of Sets
• a. Let A = {1, 2, 3, 4, 5, 6}, A1 = {1, 2}, A2 = {3, 4}, and
A3 = {5, 6}. Is {A1, A2, A3} a partition of A?
• Solution
• a. Yes. By inspection, A = A1 ∪ A2 ∪ A3 and the sets
A1, A2, and A3 are mutually disjoint.
Partition of Sets
• Solution
• b.
• Yes. By the quotient-remainder theorem, every integer n can
be represented in exactly one of the three forms
• n = 3k or n = 3k +1 or n = 3k + 2,
• for some integer k. This implies that no integer can be in any
two of the sets T0, T1, or T2.
• So T0, T1, and T2 are mutually disjoint.
• It also implies that every integer is in one of the sets T0, T1, or
T2.
• So Z = T0 ∪ T1 ∪ T2.
Power Sets
• There are various situations in which it is useful to
consider the set of all subsets of a particular set. The
power set axiom guarantees that this is a set.
• Definition
• Given a set A, the power set of A, denoted P (A), is
the set of all subsets of A.
Power Sets
• Power Set of a Set
• Find the power set of the set {x, y}.
• That is, find P({x, y}).
• Solution P({x, y}) is the set of all subsets of {x, y}.
• ∅ is a subset of every set, and so ∅ ∈ P({x, y}).
• Also any set is a subset of itself, so {x, y} ∈ P({x, y}).
The only other subsets of {x, y} are {x} and {y}, so
• P({x, y}) = {∅, {x}, {y}, {x, y}}.
Cartesian Product
• Definition
• Given sets A1, A2, . . . , An, the Cartesian product of A1,
A2, . . . , An denoted A1 × A2 × . . . × An, is the set of all
ordered n-tuples (a1, a2, . . . , an) where a1 ∈ A1, a2 ∈ A2, .
. . , an ∈ An.
• Symbolically:
• A1 × A2 ×· · ·× An = {(a1, a2, . . . , an) | a1 ∈ A1, a2 ∈ A2, . . .
, an ∈ An}.
• In particular,
• A1 × A2 = {(a1, a2) | a1 ∈ A1 and a2 ∈ A2}
• is the Cartesian product of A1 and A2.
Cartesian Product
• Let A1 = {x, y}, A2 = {1, 2, 3}, and A3 = {a, b}.
• a. Find A1 × A2.
• b. Find(A1 × A2) × A3.
• c. FindA1 × A2 × A3.
• Solution
• a. A1 × A2 = {(x, 1), (x, 2), (x, 3), (y, 1), (y, 2), (y, 3)}
Cartesian Product
• Let A1 = {x, y}, A2 = {1, 2, 3}, and A3 = {a, b}.
• b. Find (A1 × A2) × A3.
• Solution
• b.
• (A1 × A2) × A3 = {(u, v) | u ∈ A1 × A2 and v ∈ A3}
• = {((x, 1), a), ((x, 2), a), ((x, 3), a), ((y, 1), a),
• ((y, 2), a), ((y, 3), a), ((x, 1), b), ((x, 2), b), ((x, 3), b),
• ((y, 1), b), ((y, 2), b), ((y, 3), b)}
Cartesian Product
• Let A1 = {x, y}, A2 = {1, 2, 3}, and A3 = {a, b}.
• c. FindA1 × A2 × A3.
• Solution
• c.
• A1 × A2 × A3 = {(u, v, w) | u ∈ A1, v ∈ A2, and w ∈ A3}
• = {(x, 1, a), (x, 2, a), (x, 3, a), (y, 1, a), (y, 2, a),
• (y, 3, a), (x, 1, b), (x, 2, b), (x, 3, b), (y, 1, b),
• (y, 2, b), (y, 3, b)}.
Exercise 6.1
• 1, 10, 11, 14, 17

• 19, 21, 27, 31, 34


Exercise 6.1
Exercise 6.1
Exercise 6.1
Exercise 6.1
Exercise 6.1
Exercise 6.1
Exercise 6.1
Properties of Sets
Procedural versions of the definitions
Set Identities
• An identity is an equation that is universally true for all elements in some
set.
• For example, the equation a + b = b + a is an identity for real numbers
because it is true for all real numbers a and b.
• Let all sets referred to below be subsets of a universal set U.
• 1. Commutative Laws: For all sets A and B,
• (a) A ∪ B = B ∪ A and (b) A ∩ B = B ∩ A.
• 2. Associative Laws: For all sets A, B, and C,
• (a) (A ∪ B) ∪ C = A ∪ (B ∪ C) and
• (b) (A ∩ B) ∩ C = A ∩ (B ∩ C).
• 3. Distributive Laws: For all sets, A, B, and C,
• (a) A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) and
• (b) A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C).
Set Identities
• 4. Identity Laws: For all sets A,
• (a) A ∪ ∅ = A and (b) A ∩ U = A.
• 5. Complement Laws:
• (a) A ∪ Ac = U and (b) A ∩ Ac = ∅.
• 6. Double Complement Law: For all sets A,
• (Ac)c = A.
• 7. Idempotent Laws: For all sets A,
• (a) A ∪ A = A and (b) A ∩ A = A.
• 8. Universal Bound Laws: For all sets A,
• (a) A ∪ U = U and (b) A ∩ ∅ = ∅.
Set Identities
• 9. De Morgan’s Laws: For all sets A and B,
• (a) (A ∪ B)c = Ac ∩ Bc and (b) (A ∩ B)c = Ac ∪ Bc.
• 10. Absorption Laws: For all sets A and B,
• (a) A ∪ (A ∩ B) = A and (b) A ∩ (A ∪ B) = A.
• 11. Complements of U and ∅:
• (a) Uc = ∅ and (b) ∅c = U.
• 12. Set Difference Law: For all sets A and B,
• A − B = A ∩ Bc.
The Empty Set
• A Set with No Elements Is a Subset of Every Set
• If E is a set with no elements and A is any set, then E ⊆ A.
The Empty Set
• For all sets A, B, and C, if A ⊆ B and B ⊆ Cc, then A ∩ C = ∅.
• Proof:
• Suppose A, B, and C are any sets such that A ⊆ B and B ⊆ Cc.
• We must show that A ∩ C = ∅. Suppose not. That is, suppose there is an
element x in A ∩ C.
• By definition of intersection, x ∈ A and x ∈ C. Then, since A ⊆ B, x ∈ B by
definition of subset.
• Also, since B ⊆ Cc, then x ∈ Cc by definition of subset again. It follows
• by definition of complement that x / ∈ C. Thus x ∈ C and x / ∈ C, which is a
contradiction.
• So the supposition that there is an element x in A ∩ C is false, and thus A ∩
C = ∅ [as was to be shown].
Disproofs
• Finding a Counterexample for a Set Identity
• Is the following set property true?
• For all sets A, B, and C, (A − B) ∪ (B − C) = A − C.
• Solution Observe that the property is true if, and only if,
the given equality holds for all sets A, B, and C.
So it is false if, and only if,
There are sets A, B, and C for which the equality does not hold.
Disproofs
• One way to solve this problem is to picture sets A, B, and C by drawing a
Venn diagram such as that shown in Figure 6.3.1.
Disproofs
• Another Way: Counterexample 1: Let A = {1, 2, 4, 5}, B = {2, 3, 5, 6},
and C = {4, 5, 6, 7}.
Then
A − B = {1, 4},
B − C = {2, 3},
A − C = {1, 2}.
Hence
(A − B) ∪ (B − C) = {1, 4} ∪ {2, 3} = {1, 2, 3, 4},
whereas A − C = {1, 2}.
Since {1, 2, 3, 4} ≠ {1, 2},
we have that (A − B) ∪ (B − C) ≠ A − C.
Disproofs
• Counterexample 2: Let A = ∅, B = {3}, and C = ∅.
• Then
• A − B = ∅,
• B − C = {3}, and
• A − C = ∅.
• Hence (A − B) ∪ (B − C) = ∅∪{3} = {3},
• whereas A − C = ∅.
• Since {3} ≠ ∅, we have that (A − B) ∪ (B − C) ≠ A − C.
Boolean Algebras
Boolean Algebras
Functions
Definition
• A function f from a set X to a set Y, denoted f : X → Y , is a relation from X, the domain,
to Y , the co-domain, that satisfies two properties:
1. every element in X is related to some element in Y , and
2. no element in X is related to more than one element in Y.
• Thus, given any element x in X, there is a unique element in Y that is related to x by f .
• If we call this element y, then we say that “ f sends x to y” or “ f maps x to y” and
write x f→ y or f : x → y.
• The unique element to which f sends x is denoted
• f (x) and is called f of x, or
• the output of f for the input x, or
• the value of f at x, or
• the image of x under f .k to add text
Functions
• The set of all values of f taken together is called the range of f or
the image of X under f.
• Symbolically, range of f = image of X under f ={y ∈ Y | y = f (x), for
some x in X}.
• Given an element y in Y , there may exist elements in X with y as
their image.
• If f (x) = y, then x is called a preimage of y or an inverse image of
y.
• The set of all inverse images of y is called the inverse image of y.
• Symbolically, the inverse image of y = {x ∈ X | f (x) = y}.
Arrow Diagrams
• If X and Y are finite sets, you can define a function f from X to Y
by drawing an arrow diagram.
• A list of elements in X and a list of elements in Y, and draw an
arrow from each element in X to the corresponding element in Y,
as shown in Figure 7.1.1.
• This arrow diagram does define a function because
1. Every element of X has an arrow coming out of it.
2. No element of X has two arrows coming out of it that point
to two different elements of Y .
Functions and Nonfunctions
•Which of the arrow diagrams in following figures define functions
from X = {a, b, c} to Y = {1, 2, 3, 4}?
Functions and Nonfunctions
• Solution Only (c) defines a function.
• In (a) there is an element of X, namely b, that is not sent to any
element of Y ; that is, there is no arrow coming out of b.
• And in (b) the element c is not sent to a unique element of Y ;
that is, there are two arrows coming out of c, one pointing to 2
and the other to 3.
A Function defined by an Arrow diagram
• Let X = {a, b, c} and Y = {1, 2, 3, 4}. Define a function f from X to Y
by the arrow diagram in following figure.
a. Write the domain and co-domain of f .
b. Find f (a), f (b), and f (c).
c. What is the range of f ?
d. Is c an inverse image of 2? Is b an inverse image of 3?
e. Find the inverse images of 2, 4, and 1.
f. Represent f as a set of ordered pairs.
A Function defined by an Arrow diagram
Solution
a. domain of f = {a, b, c}, co-domain of f = {1, 2, 3, 4}
b. f (a) = 2, f (b) = 4, f (c) = 2
c. range of f = {2, 4}
d. Yes, No
e. inverse image of 2 = {a, c}
inverse image of 4 = {b}
inverse image of 1 = ∅ (since no arrows point to 1)
a. {(a, 2), (b, 4), (c, 2)}
Exercise 7.1
• 1. Let X = {1, 3, 5} and Y = {s, t, u, v}. Define f :
X → Y by the following arrow diagram.
a. Write the domain of f and the co-domain of f.
b. Find f (1), f (3), and f (5).
c. What is the range of f ?
d. Is 3 an inverse image of s? Is 1 an inverse
image of u?
e. What is the inverse image of s? of u? of v?
f. Represent f as a set of ordered pairs.
Exercise 7.1
• 1. Let X = {1, 3, 5} and Y = {s, t, u, v}. Define f : X → Y by the following arrow diagram.
a. Write the domain of f and the co-domain of f.
X and Y
a. Find f (1), f (3), and f (5).
f (1)=v, f (3)=s, and f (5)=v.
a. What is the range of f ?
{s,v}
a. Is 3 an inverse image of s? Is 1 an inverse image of u?
Yes, No
a. What is the inverse image of s? of u? of v?
3, No, 1, 5
a. Represent f as a set of ordered pairs.
F={(1,v), (3,s), (5,v)}
Exercise 7.1
• 2. Let X = {1, 3, 5} and Y = {a, b, c, d}. Define g: X →
Y by the following arrow diagram
a. Write the domain of g and the co-domain of g.
b. Find g(1), g(3), and g(5).
c. What is the range of g?
d. Is 3 an inverse image of a? Is 1 an inverse image of b?
e. What is the inverse image of b? of c?
f. Represent g as a set of ordered pairs.
Exercise 7.1
• 2. Let X = {1, 3, 5} and Y = {a, b, c, d}. Define g: X → Y by the following arrow diagram
a. Write the domain of g and the co-domain of g.
X, Y
a. Find g(1), g(3), and g(5).
g(1)= b, g(3)=b, and g(5)=b.
a. What is the range of g?
{b}
a. Is 3 an inverse image of a? Is 1 an inverse image of b?
No, Yes
a. What is the inverse image of b? of c?
b= 1,3,5 No inverse image for c.
a. Represent g as a set of ordered pairs.
G= {(1,b),(3,b),(5,b)}
One to one Functions
• Let F be a function from a set X to a set Y.
• F is one-to-one (or injective) if, and only if, for all elements x1
and x2 in X,
if F(x1) = F(x2), then x1 = x2,
• or, if x1 = x2, then F(x1) = F(x2)
• Symbolically,
• F: X → Y is one-to-one ⇔ ∀x1, x2 ∈ X, if F(x1) = F(x2) then x1 = x2
One to one Functions
One to one Functions
Identifying One-to-One Functions Defined
on Finite Sets
•Do either of the arrow diagrams in following figures define
one-to-one functions?
Identifying One-to-One Functions Defined
on Finite Sets
Solution
• F is one-to-one but G is not.
• F is one-to-one because no two different elements of X are
sent by F to the same element of Y.
• G is not one-to-one because the elements a and c are both
sent by G to the same element of Y: G(a) = G(c) = w but a ≠ c.
Identifying One-to-One Functions Defined
on Finite Sets
• Let X = {1, 2, 3} and Y = {a, b, c, d}.
• Define H: X → Y as follows: H(1) = c, H(2) = a, and H(3) = d.
• Define K: X → Y as follows: K(1) = d, K(2) = b, and K(3) = d.
• Is either H or K one-to-one?
Identifying One-to-One Functions Defined
on Finite Sets
Solution
• H is one-to-one but K is not.
• H is one-to-one because each of the three elements of the
domain of H is sent by H to a different element of the co-
domain: H(1) ≠ H(2), H(1) ≠ H(3), and H(2) ≠ H(3).
• K, however, is not one-to-one because K(1) = K(3) = d but 1 ≠ 3.
One-to-One Functions on Infinite Sets

• Now suppose f is a function defined on an infinite set X.


• By definition, f is one-to-one if, and only if, the following
universal statement is true:
• ∀x1, x2 ∈ X, if f (x1) = f (x2) then x1 = x2.
Proving or Disproving that functions are
One-to-One
• Define f : R → R and g: Z → Z by the rules
• f (x) = 4x − 1 for all x ∈ R
• g(n) = n2 for all n ∈ Z.
a. Is f one-to-one? Prove or give a counterexample.
b. Is g one-to-one? Prove or give a counterexample.
Proving or Disproving that functions are
One-to-One
Solution a.
• To prove that f is one-to-one, you need to prove that
• ∀ real numbers x1 and x2, if f (x1) = f (x2) then x1 = x2.

• Suppose x1 and x2 are real numbers such that f (x1) = f (x2).


• By definition of f , 4x1 − 1 = 4x2 − 1.
• Adding 1 to both sides gives
• 4x1 = 4x2,
• and dividing both sides by 4 gives
• x1 = x2, proved
Proving or Disproving that functions are
One-to-One
Solution b.
• If the function g: Z → Z is defined by the rule g(n) = n 2, for all n
∈ Z, then g is not one-to-one.
• Counterexample:
• Let n1 = 2 and n2 = −2. Then by definition of g,
• g(n1) = g(2) = 22 = 4
• g(n2) = g(−2) = (−2)2 = 4.
• Hence g(n1) = g(n2) but n1 ≠ n2,
• and so g is not one-to-one.
Onto Functions
• Let F be a function from a set X to a set Y.
• F is onto (or surjective) if, and only if, given any element y in Y, it
is possible to find an element x in X with the property that y =
F(x).
• Symbolically:
• F: X → Y is onto ⇔ ∀y ∈ Y, ∃x ∈ X such that F(x) = y.
Onto Functions
• A function is onto if each element of the co-domain has an arrow
pointing to it from some element of the domain.
• A function is not onto if at least one element in its co-domain does not
have an arrow pointing to it.
Onto Functions
Identifying Onto Functions Defined on Finite
Sets
Do either of the arrow diagrams in following figures define
onto functions?
Identifying Onto Functions Defined on Finite
Sets
Solution
• F is not onto because b ≠ F(x) for any x in X.
• G is onto because each element of Y equals G(x) for some x in
X: a = G(3), b = G(1), c = G(2) = G(4), and d = G(5).
Identifying Onto Functions Defined on Finite
Sets
• Let X = {1, 2, 3, 4} and Y = {a, b, c}.
• Define H: X → Y as follows: H(1) = c, H(2) = a, H(3) = c,
and H(4) = b.
• Define K: X → Y as follows: K(1) = c, K(2) = b, K(3) = b and K(4)
= c.
• Is either H or K onto?
Identifying Onto Functions Defined on Finite
Sets
Solution
• H is onto but K is not.
• H is onto because each of the three elements of the co-domain
of H is the image of some element of the domain of H: a = H(2),
b = H(4), and c = H(1) = H(3).
• K, however, is not onto because a = K(x) for any x in {1, 2, 3, 4}.
Onto Functions on Infinite Sets

• Now suppose F is a function from a set X to a set Y, and


suppose Y is infinite.
• By definition, F is onto if, and only if, the following universal
statement is true:
• ∀y ∈ Y, ∃x ∈ X such that F(x) = y.
One-to-One Correspondences
• Consider a function F: X → Y that is both one-to-one and onto.
• Given any element x in X, there is a unique corresponding element y =
F(x) in Y (since F is a function).
• Also given any element y in Y , there is an element x in X such that F(x) =
y (since F is onto) and there is only one such x (since F is one-to-one).
• Thus, a function that is one-to-one and onto sets up a pairing between
the elements of X and the elements of Y that matches each element of X
with exactly one element of Y and each element of Y with exactly
one element of X.
• Such a pairing is called a one-to-one correspondence or bijection
One-to-One Correspondences

Definition
A one-to-one correspondence (or bijection) from a set X to a set Y is a
function F: X → Y that is both one-to-one and onto.
Inverse Functions
• If F is a one-to-one correspondence from a set X to a set Y, then there
is a function from Y to X that “undoes” the action of F; that is, it sends
each element of Y back to the element of X that it came from.
• This function is called the inverse function for F.

• Suppose F: X → Y is a one-to-one correspondence; that is, suppose F is


one-to-one and onto.
• Then there is a function F−1: Y → X that is defined as follows:
• Given any element y in Y,
• F−1(y) = that unique element x in X such that F(x) equals y.
• In other words,
• F−1(y) = x ⇔ y = F(x).
Finding an Inverse Function for a Function
Given by an Arrow Diagram
• Define the inverse function for the one-to-one correspondence h given
in Example 7.2.8.

• Solution The arrow diagram for h−1 is obtained by tracing the h-arrows
back from S to P({a, b}) as shown below.
One to one, onto Function examples
One to one, onto Function examples
One to one, onto Function examples
Functions
Functions
Functions
Functions
Functions
Functions
Functions
Functions
Functions
Functions
Functions
• Figure is not a function,
because it sends an element
to two different elements.
Exercise set 7.2
6. Let X = {1, 5, 9} and Y = {3, 4, 7}.
a. Define f : X → Y by specifying that
f (1) = 4, f (5) = 7, f (9) = 4.
Is f one-to-one? Is f onto? Explain your answers.
b. Define g: X → Y by specifying that
g(1) = 7, g(5) = 3, g(9) = 4.
Is g one-to-one? Is g onto? Explain your answers.
Answers:
a. Not one to one and not onto
b. one to one and onto
Exercise set 7.2
7. Let X = {a, b, c, d} and Y = {e, f, g}. Define functions F and G by
the arrow diagrams below.

a. Is F one-to-one? Why or why not? Is it onto? Why or why not?


b. Is G one-to-one? Why or why not? Is it onto? Why or why not?
Answers: a. onto, b. not one to one and not onto.
Exercise set 7.2
8. Let X = {a, b, c} and Y = {w, x, y, z}. Define functions H
and K by the arrow diagrams below.

a. Is H one-to-one? Why or why not? Is it onto? Why or why not?


b. Is K one-to-one? Why or why not? Is it onto? Why or why not?
Answers: a. not one to one and not onto. B. one to one but not onto
Exercise set 7.2
9. Let X = {1, 2, 3}, Y = {1, 2, 3, 4}, and Z = {1, 2}.
a. Define a function f : X → Y that is one-to-one but not onto.
b. Define a function g: X → Z that is onto but not oneto-one.
c. Define a function h: X → X that is neither one-to-one nor onto.
d. Define a function k: X → X that is one-to-one and onto but is
not the identity function on X.
Exercise set 7.2
9. Answers
Composition of Functions
•Consider two functions, the successor function and the squaring function,
defined from Z to Z, and imagine that each is represented by a machine.
•The output from the successor function is used as input to the squaring
function.
•An integer n is first increased by 1 to obtain n + 1; then the quantity n + 1
is squared to obtain (n + 1)2.
Composition of Functions
•Let f : X → Y’ and g: Y → Z be functions with the property that
the range of f is a subset of the domain of g.
•Define a new function g ◦ f : X → Z as follows:
• (g ◦ f )(x) = g( f (x)) for all x ∈ X,
•where g ◦ f is read “g circle f ” and g( f (x)) is read “g of f of x.”
The function g ◦ f is called the composition of f and g.
Composition of Functions
This definition is shown schematically below.
Composition of Functions Defined by
Formulas
•Let f : Z → Z be the successor function and let g: Z → Z be the
squaring function.
•Then f (n)=n + 1 for all n ∈ Z and g(n) = n2 for all n ∈ Z.
•a. Find the compositions g ◦ f and f ◦g.
•b. Is g ◦ f = f ◦g? Explain.
•Solution
•a. The functions g ◦ f and f ◦ g are defined as follows:
•(g ◦ f )(n) = g(f (n)) = g(n + 1) = (n + 1)2 for all n ∈ Z,
•and
•( f ◦ g)(n) = f (g(n)) = f (n2) = n2 + 1 for all n ∈ Z.
Composition of Functions Defined by
Formulas
•b. Two functions from one set to another are equal if, and only
if, they always take the same values.
•In this case, (g ◦ f )(1) = (1 + 1)2 = 4, whereas ( f ◦ g)(1) = 12 + 1 = 2.
•Thus the two functions g ◦ f and f ◦ g are not equal:
•g ◦ f ≠ f ◦ g.
Composition of Functions Defined on Finite
Sets
Let X = {1, 2, 3}, Y' = {a, b, c, d}, Y = {a, b, c, d, e}, and Z = {x, y, z}.
Define functions f : X → Y' and g: Y → Z by the arrow diagrams
below.
Composition of Functions Defined on Finite
Sets
•Solution To find the arrow diagram for g ◦ f, just trace the arrows
all the way across from X to Z through Y.
•The result is shown below.

(g ◦ f )(1) = g( f (1)) = g(c) = z


(g ◦ f )(2) = g( f (2)) = g(b) = y
(g ◦ f )(3) = g( f (3)) = g(a) = y
The range of g ◦ f is {y, z}.
Identity Function
•The identity function on a set X, IX , is the function from X to X
defined by the formula IX (x) = x for all x ∈ X.
•That is, the identity function on X sends each element of X to
itself.
•What happens when an identity function is composed with
another function?
Composition with the Identity Function
Let X = {a, b, c, d} and Y = {u, v, w}, and suppose f : X → Y is given
by the arrow diagram.
Composition with the Identity Function
•Find f ◦ IX and IY ◦ f.
•Solution The values of f ◦ IX are obtained by tracing through the
arrow diagram shown below.

( f ◦ IX )(a) = f (IX (a)) = f (a) = u


( f ◦ IX )(b) = f (IX (b)) = f (b) = v
( f ◦ IX )(c) = f (IX (c)) = f (c) = v
( f ◦ IX )(d) = f (IX (d)) = f (d) = u
for all elements x in X,
( f ◦ IX )(x) = f (x)
Composition with the Identity Function
•By definition of equality of functions, this means that f ◦ IX = f.
•Similarly, the equality IY ◦ f = f can be verified by tracing through
the arrow diagram below for each x in X and noting that in each
case, (IY ◦ f )(x) = f (x).
Composition with the Identity Function
•Composition with an Identity Function If f is a function from a
set X to a set Y, and IX is the identity function on X, and IY is the
identity function on Y, then
•(a) f ◦ IX = f and (b) IY ◦ f = f.
Composing a Function with its Inverse
•Let f be a function from a set X to a set Y, and suppose f has an
inverse function f−1.
•Recall that f−1 is the function from Y to X with the property that
•f−1(y) = x ⇔ f (x) = y.
Composing a Function with its Inverse
Let X = {a, b, c} and Y = {x, y, z}. Define f : X → Y by the following arrow
diagram.

Then f is one-to-one and onto. Thus f−1 exists and is found by tracing the
arrows backwards.
Composing a Function with its Inverse
•Now f−1 ◦ f is found by following the arrows from
X to Y by f and back to X by f −1.
•( f−1 ◦ f )(a) = f−1( f (a)) = f−1(z) = a
•( f−1 ◦ f )(b) = f−1( f (b)) = f−1(x) = b
•( f−1 ◦ f )(c) = f−1( f (c)) = f−1(y) = c.
•Thus, the composition of f and f−1 sends each
element to itself.
•So by definition of the identity function,
•f−1 ◦ f = IX .
•In a similar way,
•f ◦ f−1 = IY .
Cardinality with Applications to
Computability
•Let A and B be any sets. A has the same cardinality as B if, and only if,
there is a one-to-one correspondence from A to B.
•In other words, A has the same cardinality as B if, and only if, there is
a function f from A to B that is one-to-one and onto.
•For all sets A, B, and C:
a. Reflexive property of cardinality: A has the same cardinality as A.
b. Symmetric property of cardinality: If A has the same cardinality as
B, then B has the same cardinality as A.
c. Transitive property of cardinality: If A has the same cardinality as B
and B has the same cardinality as C, then A has the same
cardinality as C.
Cardinality with Applications to
Computability
Proof:
• Part (a), Reflexivity: Suppose A is any set.
• Consider the identity function IA from A to A. This function is one-
to-one because if x1 and x2 are any elements in A with I A(x1) =
IA(x2), then, by definition of IA, x1 = x2.
• The identity function is also onto because if y is any element of A,
then y = IA(y) by definition of IA.
• Hence IA is a one-to-one correspondence from A to A.
Cardinality with Applications to
Computability
Proof:
•Part (b), Symmetry: Suppose A and B are any sets and A has the same
cardinality as B.
•Since A has the same cardinality as B, there is a function f from A to B
that is one-to-one and onto.
•But then, by Theorems there is a function f−1 from B to A that is also
one-to-one and onto.
•Hence B has the same cardinality as A.
Cardinality with Applications to
Computability
Proof:
•Part (c), Transitivity: Suppose A, B, and C are any sets and A has the
same cardinality as B and B has the same cardinality as C.
•Since A has the same cardinality as B, there is a function f from A to B
that is one-to-one and onto, and since B has the same cardinality as C,
there is a function g from B to C that is one-to-one and onto.
•But then, by Theorems g ◦ f is a function from A to C that is one-to-
one and onto.
•Hence A has the same cardinality as C.
Cardinality with Applications to
Computability
Definition
A and B have the same cardinality if, and only if, A has the same
cardinality as B or B has the same cardinality as A.

You might also like