0% found this document useful (0 votes)
68 views72 pages

Lecture No 1: Topics Covered Logic and Truth Tables

This document provides an overview and schedule for a discrete mathematics lecture course. Key topics covered include logic, truth tables, and discrete versus continuous approaches. The course will use specific textbooks and have assignments, projects, quizzes, and an exam for assessment. Applications of discrete mathematics discussed include sorting algorithms, network links, and encryption. The document also introduces concepts of logic including propositions, logical operators, and truth tables.

Uploaded by

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

Lecture No 1: Topics Covered Logic and Truth Tables

This document provides an overview and schedule for a discrete mathematics lecture course. Key topics covered include logic, truth tables, and discrete versus continuous approaches. The course will use specific textbooks and have assignments, projects, quizzes, and an exam for assessment. Applications of discrete mathematics discussed include sorting algorithms, network links, and encryption. The document also introduces concepts of logic including propositions, logical operators, and truth tables.

Uploaded by

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

LECTURE NO 1

Topics covered
Logic and Truth tables
TEXT BOOK:
DISCRETE MATHEMATICS AND ITS
APPLICATIONS
BY
KENNETH H ROSEN
6TH OR 7TH EDITION

REFERENCE BOOK:
DISCRETE MATHEMATICS WITH APPLICATIONS
BY
SUSANNA S. EPP
4TH EDITION
MARKS DIVISION
Total absolute score 100%

 Two OHTs 30 % (15 % each)


 Six Quizzes 15 %

Including double weightage


 One Assignment/Project 5 %

 One Three hour exam 50 %

Contact Email: [email protected]


Contact hours: Mon 1250-1600
Fri 1210-1300
DISCRETE VS CONTINUOUS APPROACH
  
Calculus, Differential equations, Graphs, Derivatives,
Integration.
 Continuous function

 Discrete function
A B
1 a
3 b
10 c

Why it is important to study discrete approach???...


DISCRETE MATHEMATICS AND
APPLICATIONS
 How many ways are there to choose a valid password on a computer
system?
 What is the probability of winning a lottery?

 Is there a link between two computers in a network?

 How can I identify spam e-mail messages?

 How can I encrypt a message so that no unintended recipient can read it?

 What is the shortest path between two cities using a transportation


system?
 How can a list of integers be sorted so that the integers are in increasing
order?
 How many steps are required to do such a sorting?

 How can it be proved that a sorting algorithm correctly sorts a list?

 How to develop a logic of a circuit that allow desired output?

 How many valid Internet addresses are there?


PROBLEMS SOLVED USING DISCRETE
MATHEMATICS
 What is the shortest path between two cities using a
transportation system?
 Find the shortest tour that visits each of a group of cities only
once and then ends in the starting city.
 How can we represent English sentences so that a computer
can reason with them?
 How can we judge the efficiency of algorithm?

 How can a list of integers be sorted so that the integers are in


increasing order?
 How many steps are required to do such a sorting?
A Proposition is a declarative sentence (that is, a sentence that declares a fact) that is
either true or false, but not both.

EXAMPLE 1
All the following declarative sentences are propositions.
1. Washington, D.C., is the capital of the United States of America.
2. Toronto is the capital of Canada.
3. 1 + 1 = 2.
4. 2 + 2 = 3.

Propositions 1 and 3 are true, whereas 2 and 4 are false.

Some sentences that are not propositions are given in Example 2.


EXAMPLE 2
Consider the following sentences.
1. What time is it?
2. Read this carefully.
3. x + 1 = 2.
4. x + y = z.
Propositional variables (or statement variables), variables that
represent propositions, just as letters are used to denote numerical
variables.
conventional letters used for propositional variables are p, q, r, s, .
...

The truth value of a proposition is denoted by T


False value is denoted by F.

Negation of p:
negation of p, denoted by ¬ p (also denoted by p), is the
statement
“It is not the case that p.”
 The truth value of the negation of p, ¬ p, is the opposite of the
truth value of p.
EXAMPLE 3
Find the negation of the proposition
“Michael’s PC runs Linux” and express this in simple English.
Solution: The negation is
“It is not the case that Michael’s PC runs Linux.”
This negation can be more simply expressed as
“Michael’s PC does not run Linux.”

EXAMPLE 4
Find the negation of the proposition
“Vandana’s smartphone has at least 32GB of memory”
and express this in simple English.
Solution: The negation is
“It is not the case that Vandana’s smartphone has at least 32GB of memory.”
This negation can also be expressed as
“Vandana’s smartphone does not have at least 32GB of memory”
or even more simply as
“Vandana’s smartphone has less than 32GB of memory.”
Conjunction of propositions:
The conjunction of p and q, denoted by p ∧ q, is the proposition “p
and q.”
The conjunction p ∧ q is true when both p and q are true and is
false otherwise.
EXAMPLE 5
Find the conjunction of the propositions p and q?
where p is the proposition “Rebecca’s PC has more than 16 GB
free hard disk space”
and q is the proposition “The processor in Rebecca’s
PC runs faster than 1 GHz.”

Solution: The conjunction of these propositions, p ∧ q, is the


proposition “Rebecca’s PC has more than 16 GB free hard disk
space, and the processor in Rebecca’s PC runs faster than 1 GHz.”
This conjunction can be expressed more simply as “Rebecca’s PC
has more than 16 GB free hard disk space, and its processor runs
faster than 1 GHz.”
For this conjunction to be true, both given conditions must be true.
It is false, when one or both of these conditions are false.
Disjunction of propositions:
Let p and q be propositions. The disjunction of p and q, denoted
by p ∨ q, is the proposition “p or q.”
The disjunction p ∨ q is false when both p and q are false and is
true otherwise.
EXAMPLE 6
What is the disjunction of the propositions p and q where p and q
are the same propositions as
in Example 5?
Solution: The disjunction of p and q, p ∨ q, is the proposition
“Rebecca’s PC has at least 16 GB free hard disk space, or the
processor in Rebecca’s PC runs faster than 1 GHz.”
Exclusive or of propositions:
Let p and q be propositions. The exclusive or of p and q, denoted by p ⊕ q, is
the proposition that is true when exactly one of p and q is true and is false
otherwise.

Conditional statement:
Let p and q be propositions. The conditional statement p → q is the
proposition “if p, then q.” The conditional statement
p → q is false when p is true and q is false, and true otherwise.
In the conditional statement p → q, p is called the hypothesis (or antecedent
or premise) and q is called the conclusion (or consequence).
Ways to express this conditional statement:
“if p, then q” “p implies q”
“if p, q” “p only if q”
“p is sufficient for q” “a sufficient condition for q is p”
“q if p” “q whenever p”
“q when p” “q is necessary for p”
“q follows from p” “q unless ¬ p”
“a necessary condition for p is q”

“If you get 100% on the final, then you will get an A.”

If you manage to get a 100% on the final, then you would expect to
receive an A. If you do not get 100% you may or may not receive an A
depending on other factors. However, if you do get
100%, but the professor does not give you an A, you will feel cheated.
EXAMPLE 7
Let p be the statement “Maria learns discrete mathematics” and q the
statement “Maria will find a good job.” Express the statement
p → q as a statement in English.
Solution:
p → q represents the statement
“If Maria learns discrete mathematics, then she will find a good job.”
There are many other ways to express this conditional statement in
English. Among the most natural of these are:
“Maria will find a good job when she learns discrete mathematics.”
“For Maria to get a good job, it is sufficient for her to learn discrete
mathematics.”
and
“Maria will find a good job unless she does not learn discrete
mathematics.”
EXAMPLE 8
What is the value of the variable x after the statement
if 2 + 2 = 4 then x := x + 1
if x = 0 before this statement is encountered? (The symbol :=
stands for assignment. The
statement x := x + 1 means the assignment of the value of x + 1 to
x.)

Solution:
Because 2 + 2 = 4 is true, the assignment statement
x := x + 1 is executed. Hence,
x has the value 0 + 1 = 1 after this statement is encountered.
Converse:
The converse of p → q is q → p.

Contrapositive:
The contrapositive of p → q is the proposition ¬ q → ¬ p.

Inverse:
The inverse of p → q is ¬ p → ¬ q.
Equivalent:
When two compound propositions always have the same truth
value we call them equivalent, so that a conditional statement and
its contrapositive are equivalent. The converse and the inverse of
a conditional statement are also equivalent
EXAMPLE 9
What are the contrapositive, the converse, and the inverse of the
conditional statement
“The home team wins whenever it is raining?”
Solution:
p → q, the original statement can be rewritten as
“If it is raining, then the home team wins.”
Consequently, the contrapositive of this conditional statement is
“If the home team does not win, then it is not raining.”
The converse is
“If the home team wins, then it is raining.”
The inverse is
“If it is not raining, then the home team does not win.”
Only the contrapositive is equivalent to the original statement.
Biconditional :
Let p and q be propositions. The biconditional statement p ↔ q is
the proposition “p if and only if q.” The biconditional statement p
↔ q is true when p and q have the same truth values, and is false
otherwise. Biconditional statements are also called bi-
implications.
EXAMPLE 10
Let p be the statement “You can take the flight,” and let q be the
statement “You buy a ticket.”
Then p ↔ q is the statement
“You can take the flight if and only if you buy a ticket.”
This statement is true if p and q are either both true or both false,
that is, if you buy a ticket and can take the flight or if you do not
buy a ticket and you cannot take the flight.
It is false when
p and q have opposite truth values, that is, when you do not buy a
ticket, but you can take the flight (such as when you get a free
trip) and when you buy a ticket but you cannot take the flight
(such as when the airline bumps you).
EXAMPLE 11
Construct the truth table of the compound proposition
(p ∨ ¬ q) → (p ∧ q).
PRECEDENCE OF LOGICAL
OPERATORS
LOGIC AND BIT OPERATIONS
 A bit is a symbol with two possible values namely 0 and 1
corresponding to True and False in Logics.
 Variable is called a Boolean variable if its value is either true
or false.
 Computer bit operations correspond to the logical
connectives.
 Bit operators are OR, AND and XOR.

 Information is often represented using Bit strings.

 A bit string is a sequence of zero or more bits. The length of


this string is the number of bits in the string.
EXAMPLE 13 Find the bitwise OR, bitwise AND, and bitwise XOR of the bit
strings 01 1011 0110 and
11 0001 1101.
Solution:
01 1011 0110
11 0001 1101
11 1011 1111 bitwise OR
01 0001 0100 bitwise AND
10 1010 1011 bitwise XOR
APPLICATIONS OF PROPOSITIONAL
LOGICS
EXAMPLE
   1 How can this English sentence be translated into a
logical expression?
“You can access the Internet from campus only if you are a
computer science major or you are not a freshman.”
Solution:
let a, c, and f represent “You can access the Internet from
campus,”
“You are a computer science major,” and “You are a freshman,”
respectively. Noting that “only if” is one way a conditional
statement can be expressed, this sentence can be represented as
EXAMPLE 2
How can this English sentence be translated into a logical
expression?
“You cannot ride the roller coaster if you are under 4 feet tall
unless you are older than 16 years old.”
Solution:
Let q, r, and s represent “You can ride the roller coaster,” “You are
under 4 feet tall,” and
“You are older than 16 years old,” respectively.
Then the sentence can be translated to
(r ∧ ¬ s)→ ¬ q.
EXAMPLE 3
Express the specification “The automated reply cannot be sent
when the file system is full” using logical connectives.
Solution:
One way to translate this is to let p denote
“The automated reply can be sent” and q denote
“The file system is full.” Then ¬ p represents
“It is not the case that the automated reply can be sent,” which
can also be expressed as
“The automated reply cannot be sent.”
Consequently, our specification can be represented by the
conditional statement q → ¬ p.
EXAMPLE 4
Determine whether these system specifications are consistent:
“The diagnostic message is stored in the buffer or it is retransmitted.”
“The diagnostic message is not stored in the buffer.”
“If the diagnostic message is stored in the buffer, then it is
retransmitted.”
Solution:
p denote “The diagnostic message is stored in the buffer”
q denote “The diagnostic message is retransmitted.”
The specifications can then be written as p ∨ q, ¬ p, and p → q. An
assignment of truth values that makes all three specifications true
must have p false to make ¬p true. Because we want p ∨ q to be true
but p must be false, q must be true. Because p → q is true when p is
false and q is true, we conclude that these specifications are
consistent, because they are all true when p is false and q is true.
LOGIC GATES
LECTURE NO 2
Topics covered
Predicates and Quantifiers
Introduction to Proofs
Proofs Methodology
PREDICATES AND QUANTIFIERS
A statement
“Every computer connected to the university network is
functioning properly”
No rules of propositional logic allow us to conclude the truth of
the statement
“MATH3 is functioning properly”
Where MATH3 is one of the computers connected to the
university network.
“enable us to reason with statements that assert that a certain
property holds for all objects of a certain type and with
statements that declare the existence of an object with a particular
property”
PREDICATES
Statements involving variables, such as
“x > 3,” “x = y + 3,” “x + y = z,”
and
“computer x is under attack by an intruder,”
and
“computer x is functioning properly,”
are often found in mathematical assertions, in computer programs,
and in system specifications.
These statements are neither true nor false when the values of the
variables are not specified.
“x is greater than 3” has two parts
The variable x, is the subject of the statement.
The second part the predicate, “is greater than 3”
The statement P(x) is also said to be the value of the propositional
function P at x. Once a value has been assigned to the variable x,
the statement P(x) becomes a proposition and has a truth value.
EXAMPLE 1 Let P(x) denote the statement “x > 3.” What are the
truth values of P(4) and P(2)?
Solution:
We obtain the statement P(4) by setting x = 4 in the statement “x >
3.” Hence
P(4), which is the statement “4 > 3,” is true.
However, P(2), which is the statement “2 > 3,”
is false.
EXAMPLE 2 Let A(x) denote the statement “Computer x is
under attack by an intruder.” Suppose that of the
computers on campus, only CS2 and MATH1 are currently under
attack by intruders. What are
truth values of A(CS1), A(CS2), and A(MATH1)?

Solution:
We obtain the statement A(CS1) by setting x = CS1 in the
statement “Computer x is under attack by an intruder.” Because
CS1 is not on the list of computers currently under attack, we
conclude that A(CS1) is false. Similarly, because CS2 and
MATH1 are on the list of
computers under attack, we know that A(CS2) and A(MATH1)
are true.
EXAMPLE 3
Let Q(x, y) denote the statement “x = y + 3.” What are the truth
values of the propositions Q(1, 2) and Q(3, 0)?

Solution:
To obtain Q(1, 2), set x = 1 and y = 2 in the statement Q(x, y).
Hence,
Q(1, 2) is the statement “1 = 2 + 3,” which is false.
The statement Q(3, 0) is the proposition “3 = 0 + 3,”
which is true.
QUANTIFIERS
Quantification expresses the extent to which a predicate is true
over a range of elements. In English, the words all, some, many,
none, and few are used in quantifications.
The universal quantification of P(x) is the statement
“P(x) for all values of x in the domain.”
The notation ∀xP(x) denotes the universal quantification of P(x).
Here ∀ is called the universal quantifier.
We read ∀xP(x) as “for all xP(x)” or “for every xP(x).” An
element for which P(x) is false is called a counterexample of
∀xP(x).
EXAMPLE 8
Let P(x) be the statement “x + 1 > x.” What is the truth value of
the quantification ∀xP(x), where the domain consists of all real
numbers?
Solution:
Because P(x) is true for all real numbers x, the quantification
∀xP(x) is true.

Note: Besides “for all” and “for every,” universal quantification


can be expressed in many other ways, including “all of,” “for
each,” “given any,” “for arbitrary,” “for each,” and “for any.”
  
EXAMPLE 10
Suppose that P(x) is “ > 0.” To show that the statement ∀xP(x) is
false where the universe of discourse consists of all integers,
We give a counterexample. We see that x = 0 is a counterexample
because = 0 when x = 0, so that is not greater than 0 when x = 0.

The existential quantification of P(x) is the proposition


“There exists an element x in the domain such that P(x).”
We use the notation ∃xP(x) for the existential quantification of
P(x). Here ∃ is called the
existential quantifier.
EXAMPLE 14
Let P(x) denote the statement “x > 3.” What is the truth value of
the quantification ∃xP(x), where the domain consists of all real
numbers?
Solution:
Because “x > 3” is sometimes true for instance, when
x = 4, the existential quantification of P(x), which is ∃xP(x), is
true.

Observe that the statement ∃xP(x) is false if and only if there is


no element x in the domain for which P(x) is true. That is,
∃xP(x) is false if and only if P(x) is false for every element of
the domain.
EXAMPLE 23
Express the statement “Every student in this class has studied
calculus” using predicates and quantifiers.

Solution:
First, we rewrite the statement so that we can clearly identify the
appropriate quantifiers
to use. Doing so, we obtain:
“For every student in this class, that student has studied calculus.”
Next, we introduce a variable x so that our statement becomes
“For every student x in this class, x has studied calculus.”
EXAMPLE 24
Express the statements “Some student in this class has visited
Mexico” and “Every student in this class has visited either
Canada or Mexico” using predicates and quantifiers.

Solution:
The statement “Some student in this class has visited Mexico”
means that
“There is a student in this class with the property that the student
has visited Mexico.”
We can introduce a variable x, so that our statement becomes
“There is a student x in this class having the property that x has
visited Mexico.”
INTRODUCTION TO PROOFS
Theorem is a statement that can be shown to be true. In
mathematical writing, the term theorem is usually reserved for a
statement that is considered at least somewhat important. Less
important theorems sometimes are called propositions.

A proof is a valid argument that establishes the truth of a


theorem. The statements used in a proof can include axioms (or
postulates)

A less important theorem that is helpful in the proof of other


results is called a lemma (plural lemmas or lemmata).
A  corollary
 is a theorem that can be established directly from a
theorem that has been proved.
A conjecture is a statement that is being proposed to be a true
statement, usually on the basis of some partial
evidence, a heuristic argument, or the intuition of an expert.
When a proof of a conjecture is found, the conjecture becomes a
theorem.
“If x > y, where x and y are positive real numbers, then .”
really means
“For all positive real numbers x and y, if x > y, then .”
Furthermore, when theorems of this type are proved, the first step
of the proof usually involves selecting a general element of the
domain. Subsequent steps show that this element has the property
in question. Finally, universal generalization implies that the
theorem holds for all members of the domain.
METHODS OF PROVING THEOREMS
A direct proof of a conditional statement p → q is constructed
when the first step is the assumption that p is true; subsequent
steps are constructed using rules of inference, with the final step
showing that q must also be true. A direct proof shows that a
conditional statement
p → q is true by showing that if p is true, then q must also be true,
so that the combination p true and q false never occurs.
Definition:
The integer n is even if there exists an integer k such that
n = 2k, and n is odd if there exists an integer k such that
n = 2k + 1. (Note that every integer is either even or odd, and no
integer is both even and odd.)
EXAMPLE
   1
Give a direct proof of the theorem “If n is an odd integer, then is
odd.”
Solution:
Note that this theorem states ∀nP ((n) → Q(n)), where P(n) is “n
is an odd integer” and Q(n) is “ is odd.”
By the definition of an odd integer, it follows that
n = 2k + 1, where k is some integer. We want to show that is also
odd. We can square both sides of the equation n = 2k + 1 to
obtain a new equation that expresses . When we do this, we find
that
. By the definition of an odd integer, we can conclude that is an
odd integer (it is one more than twice an integer).Consequently,
we have proved that if n is an odd integer, then is an odd integer.
PROOF BY CONTRADICTION
Suppose we want to prove that a statement p is true. Furthermore,
suppose that we can find a contradiction q such that ¬ p → q is
true. Because q is false, but ¬ p → q is true, we can conclude
that ¬ p is false, which means that p is true. How can we find a
contradiction q that
might help us prove that p is true.
EXAMPLE 11
Give a proof by contradiction of the theorem “If 3n + 2 is odd,
then n is odd.”
Solution:
Let p be “3n + 2 is odd” and q be “n is odd.” To construct a proof
by contradiction, assume that both p and ¬ q are true. That is,
assume that 3n + 2 is odd and that n is not odd.
Because n is not odd, we know that it is even. Because n is even,
there is an integer k such that n = 2k. This implies that 3n + 2 =
3(2k) + 2 = 6k + 2 = 2(3k + 1). Because 3n + 2 is 2t , where t = 3k
+ 1, 3n + 2 is even. Note that the statement “3n + 2 is even” is
equivalent to the statement ¬ p, because an integer is even if
and only if it is not odd. Because both p and
¬ p are true, we have a contradiction. This completes the proof
by contradiction, proving that if 3n + 2 is odd, then n is odd.
LECTURE NO 3
Basic Set Theory
Functions
A set is an unordered collection of objects, called elements or
members of the set. A set is said to contain its elements. We write
a ∈ A to denote that a is an element of the set A. The notation a
∈ A denotes that a is not an element of the set A.

O = {1, 3, 5, 7, 9}.
V = {a, e, i, o, u}.
L = {1, 2, 3, . . . , 99}.
P = {x | x is an odd positive integer less than 10},
O = {x ∈ Z+ | x is odd and x < 10}.
R, the set of real numbers
R+, the set of positive real numbers
C, the set of complex numbers.
[a, b] = {x | a ≤ x ≤ b}
[a, b) = {x | a ≤ x < b}
(a, b] = {x |a < x ≤ b}
(a, b) = {x |a < x < b}
Note that [a, b] is called the closed interval from a to b and (a,
b) is called the open interval from a to b.

Two sets are equal if and only if they have the same elements.
Therefore, if A and B are sets, then A and B are equal if and only
if ∀x(x ∈ A ↔ x ∈ B).We write A = B if A and B are equal sets.

The sets {1, 3, 5} and {3, 5, 1} are equal, because they have the
same elements
The set A is a subset of B if and only if every element of A is also an
element of B. We use the notation A ⊆ B to indicate that A is a subset of the
set B.
The quantification of A ⊆ B is ∀x(x ∈ A → x ∈ B).

Let S be a set. If there are exactly n distinct elements in S where n is a


nonnegative integer, we say that S is a finite set and that n is the cardinality
of S. The cardinality of S is denoted by |S|.

EXAMPLE 10
Let A be the set of odd positive integers less than 10. Then |A| = 5.

EXAMPLE 11
Let S be the set of letters in the English alphabet. Then |S| = 26.

EXAMPLE 12
Because the null set has no elements, it follows that | ∅| = 0.
Given
   a set S, the power set of S is the set of all subsets of the set
S. The power set of S is denoted by P(S).

EXAMPLE 14
What is the power set of the set {0, 1, 2}?

Solution:
The power set P({0, 1, 2}) is the set of all subsets of {0, 1, 2}.
Hence,
P({0, 1, 2}) = {∅, {0}, {1}, {2}, {0, 1}, {0, 2}, {1, 2}, {0, 1, 2}}.

The ordered n-tuple is the ordered collection that has as its first
element, as its second element, . . . , and as its nth element.
= if and only if ,
for i = 1, 2, . . . , n.
Let A and B be sets. The Cartesian product of A and B, denoted
by A × B, is the set of all ordered pairs (a, b), where a ∈ A and b
∈ B. Hence,
A × B = {(a, b) | a ∈ A ∧ b ∈ B}.

EXAMPLE 17
What is the Cartesian product of A = {1, 2} and
B = {a, b, c}?

Solution:
The Cartesian product A × B is
A × B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}.
EXAMPLE 19
What is the Cartesian product A × B × C, where
A = {0, 1}, B = {1, 2}, and C = {0, 1, 2} ?

Solution:
The Cartesian product A × B × C consists of all ordered triples (a,
b, c), where a ∈ A, b ∈ B, and c ∈ C. Hence,
A × B × C = {(0, 1, 0), (0, 1, 1), (0, 1, 2), (0, 2, 0), (0, 2, 1),
(0, 2, 2),(1, 1, 0), (1, 1, 1), (1, 1, 2), (1, 2, 0), (1, 2, 1),
(1, 2, 2)}.

Is it possible to calculate A × A??


Question no: 4 Ex 2.1

For each of these pairs of sets, determine whether the first is a


subset of the second, the second is a subset of the first, or neither
is a subset of the other.
a) the set of people who speak English, the set of people
who speak English with an Australian accent
b) the set of fruits, the set of citrus fruits
c) the set of students studying discrete mathematics, the
set of students studying data structures
Question no: 10 Ex 2.1

Determine whether these statements are true or false.

a) ∅ ∈ {∅} b) ∅ ∈ {∅, {∅}}


c) {∅} ∈ {∅} d) {∅} ∈ {{∅}}
e) {∅} ⊂ {∅, {∅}} f ) {{∅}} ⊂ {∅, {∅}}
g) {{∅}} ⊂ {{∅}, {∅}}
Question no. 20. Ex 2.1

What is the cardinality of each of these sets?

a) ∅ b) {∅}
c) {∅, {∅}} d) {∅, {∅}, {∅, {∅}}}
  

Question no 41. Ex: 2.1

Translate each of these quantifications into English and


determine its truth value.

a) ∀x∈R () b) ∃x∈Z ( = 2)
c) ∀x∈Z (> 0) d) ∃x∈R ( = x)
OPERATIONS ON SETS

 A ∪ B = {x | x ∈ A ∨ x ∈ B}. Union of two sets


 A ∩ B = {x | x ∈ A ∧ x ∈ B}.Intersection of two sets

 |A ∪ B| = |A| + |B| − |A ∩ B|. Cardinality of union


of two sets
 A − B = {x | x ∈ A ∧x /∈ B}. Difference of two sets

 A = {x ∈ U | x /∈ A}. Complement of a set


EXAMPLE
   18
Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, and the ordering of elements
of U has the elements in increasing order; that is, . What bit
strings represent the subset of all odd integers in U, the subset of
all even integers in U, and the subset of integers not exceeding 5
in U?
Solution:
Subset of odd integers in U, namely, {1, 3, 5, 7, 9}.
10 1010 1010.
Subset of even integers {2, 4, 6, 8, 10}, by the string
01 0101 0101.
{1, 2, 3, 4, 5}, is represented by the string
11 1110 0000.
What is the bit string for the complement of these set?
Let A and B be nonempty sets. A function f from A to B is an
assignment of exactly one element of B to each element of A.
f (a) = b; f : A → B.

If f is a function from A to B, we say that A is the domain of f and


B is the codomain of f.
b is the image of a and a is a preimage of b.
The range of f is the set of all images of elements of A.
f(a) is the image
of a and a is pre-
image of f(a)

EXAMPLE 5
The domain and codomain of functions are often specified in
programming languages. For instance, the Java statement
int floor(float real){. . .}
and
the C++ function statement
int function (float x){. . .}
both tell us that the domain of the floor function is the set of real
numbers (represented by floating point numbers) and its
codomain is the set of integers.?
A function f is said to be one-to-one, or an injunction, if and only if f
(a) = f (b) implies that a = b for all a and b in the domain of f. A
function is said to be injective if it is one-to-one. f(a) is the image of a
in the range.
Or If every element of domain has unique image in Range.

A function f from A to B is called onto, or a surjection, if and only if


for every element b ∈ B there is an element a ∈ A with f (a) = b. A
function f is called surjective if it is onto.
The function f is a one-to-one correspondence, or a bijection, if it
is both one-to-one and onto. We also say that such a function is
bijective.
Suppose that f : A → B.

 To show that f is injective Show that if f (x) = f (y) for arbitrary


x, y ∈ A with x = y, then x = y.

 To show that f is not injective Find particular elements x, y ∈ A


such that x = y and f (x) = f (y).

 To show that f is surjective Consider an arbitrary element y ∈ B


and find an element x ∈ A such that f (x) = y.

 To show that f is not surjective Find a particular y ∈ B such that


f (x) = y for all x ∈ A.
EXAMPLE
   12 Let f be the function from {a, b, c, d} to
{1, 2, 3} defined by f (a) = 3, f (b) = 2, f (c) = 1, and f (d) = 3. Is f an onto
function?
Solution:
Because all three elements of the codomain are images of elements in the
domain, we see that f is onto.
EXAMPLE 13 Is the function f (x) = from the set of integers to the set
of integers onto?
Solution:
The function f is not onto because there is no integer x with = −1, for
instance.
EXAMPLE 14 Is the function f (x) = x + 1 from the set of integers to the
set of integers onto?
Solution:
This function is onto, because for every integer y there is an integer x
such that f (x) = y. To see this, note that f (x) = y if and only if x + 1 = y,
which holds if and only if x = y − 1.
Let 
 f be a one-to-one correspondence from the set A to the set B.
The inverse function of f is the function that assigns to an element
b belonging to B the unique element a in A such that f (a) = b. The
inverse function of f is denoted by . Hence, (b) = a when f (a) = b.
EXAMPLE
   18 Let f be the function from {a, b, c} to {1, 2, 3}
such that f (a) = 2, f (b) = 3, and f (c) = 1. Is f invertible, and if it is,
what is its inverse?
Solution:
The function f is invertible because it is a one-to-one
correspondence. The inverse function f −1 reverses the
correspondence given by f , so , (2) = a, and
(3) = b.
EXAMPLE 19 Let f : Z → Z be such that f (x) = x + 1. Is f
invertible, and if it is, what is its inverse?
Solution: The function f has an inverse because it is a one-to-one
correspondence, as follows from Examples 10 and 14. To reverse
the correspondence, suppose that y is the image of x, so that y = x +
1. Then x = y − 1. This means that y − 1 is the unique element of Z
that is sent to y by f . Consequently, (y) = y − 1.
EXAMPLE
   20 Let f be the function from R to R with
. Is f invertible?
Solution: Because f (−2) = f (2) = 4, f is not one-to-one. If an
inverse function were defined, it would have to assign two
elements to 4. Hence, f is not invertible. (Note we can also show
that f is not invertible because it is not onto.)

Let g be a function from the set A to the set B and let f be a


function from the set B to the set C. The composition of the
functions f and g, denoted for all a ∈ A by f ◦ g, is defined by (f ◦
g)(a) = f (g(a)).

The range of g function is the domain of f function


EXAMPLE 22 Let g be the function from the set {a, b, c} to itself
such that g(a) = b, g(b) = c, and g(c) = a. Let f be the function from
the set {a, b, c} to the set {1, 2, 3} such that f (a) = 3, f (b) = 2, and
f (c) = 1. What is the composition of f and g, and what is the
composition of g and f ?
Solution:
The composition f ◦ g is defined by
(f ◦ g)(a) = f (g(a)) = f (b) = 2,
(f ◦ g) (b) = f (g(b)) = f (c) = 1,
and
(f ◦ g)(c) = f (g(c)) = f (a) = 3.
Note that g ◦ f is not defined, because the range of f is not a subset
of the domain of g.

You might also like