Sie sind auf Seite 1von 30

Discrete Mathematics for B.Sc.

Part-1 (Paper-A, Section-A)

Introduction to course
Discrete Math
Discrete Math" is not the name of a branch of mathematics, like number theory, algebra, calculus, etc. Rather,
it's a description of a set of branches of math that all have in common the feature that they are "discrete" rather
than "continuous".
So, in short, we can say that “Study of discrete elements is known as discrete mathematics”.
Mathematics can be broadly classified into two categories −

 Continuous Mathematics − It is based upon continuous number line or the real numbers. It is
characterized by the fact that between any two numbers, there are almost always an infinite set of
numbers.
 Discrete Mathematics − It involves distinct values; i.e. between any two points, there are a countable
number of points. So in discrete mathematics we study discrete elements.

Example of discrete and continuous elements:

 Number of students in your class. ………………….. Discrete (because there will be a


countable number of students in a class)
 Today is Friday ………………………….. Discrete (because the answer to this statement can
be yes or no , true or false, so it is discrete)
 All the real number that lies between 5 and 8………… Continuous (because there are infinite
real numbers between any two real numbers)
 Total Number of points in a circle……………. Continuous (because there are infinite points
between two points in a circle)
 Possible values a logic gate can have?........................ Discrete (because a logic gate can have
two possible values 0 or 1, ON or OFF, True or False, LOW or High)

By: Muhammad Fayaz | SST-IT 1


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
Chapter 1 Prepositional Calculus and Logic
What is a preposition?
A proposition is a declarative sentence (that is, a sentence that declares a fact) that is either true
or false, but not both.
All the following declarative sentences are propositions.
1) Islamabad, is the capital of Pakistan.
2) Today is Friday.
3) 1 + 1 = 2.
4) 2 + 2 = 3.
All above statements are prepositions because they are either true or false (not both).
Some sentences that are not propositions are given here.
Consider the following sentences.
1) What time is it?
2) Read this carefully.
3) x + 1 = 2.
The above sentences are not preposition as their result is not in form of true or false.

Logic
Logic is the study of the principles and methods that distinguish between a valid and an invalid argument.

Prepositional Calculus/ Logic


The area of logic that deals with propositions is called the propositional calculus or propositional logic. It was
first developed systematically by the Greek philosopher Aristotle more than 2300 years ago.

Prepositional Variable
A variable used to represent the preposition is called prepositional variable. For example:
 p: Today is Friday.
 q: 2+7<3
In above examples, letters such as p, q are called prepositional variables. Usually we use lower case letters for
prepositional variables.

Connectives
The logical operators that are used to form new propositions from two or more existing propositions. These
logical operators are also called connectives.

Examples: OR (∨), AND (∧), Negation/ NOT (¬), Implication / if-then (→), If and only if (⇔)

Negation of a Preposition
If p is a statement variable, then negation of p, “not p”, is denoted as “~p” or ¬p . It has opposite truth value
from p i.e., if p is true, then ~ p is false; if p is false, then ~ p is true.
OR

By: Muhammad Fayaz | SST-IT 2


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
Let p be a proposition. The negation of p, denoted by ¬p (also denoted by p), is the statement “It is not the case
that p.” The proposition ¬p is read “not p.” The truth value of the negation of p, ¬p, is the opposite
of the truth value of p.

Truth Table of Negation is:

p ¬p
F T
T F

Conjunction of Preposition
When two propositions are combined by connectives “AND” then it is called the conjunction of preposition.
It is represented by ⋀. Let p and q be 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.

The truth table of Conjunction of prepositions is:

p q p⋀q
F F F
F T F
T F F
T T T
Disjunction of Preposition
When two propositions are combined by connectives “OR” then it is called the Disjunction of preposition.

It is represented by ⋁. 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.

The truth table of Disjunction of prepositions is:

p q p∨q
F F F
F T T
T F T
T T T

By: Muhammad Fayaz | SST-IT 3


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
Implication (Conditional) / if-then (→) of Preposition
An implication or conditional of prepositions is denoted by p→q , “if p, then q”. It is false if p is true and q is
false. The rest cases are true.
We call p the hypothesis (or antecedent) of the conditional and q the conclusion (or consequent).
Truth table of Implication of prepositions is:

p q p→q 
F F T
F T T
T F F
T T T

Biconditional / If and only if (⇔) of Prepositions


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.
Truth table of Biconditional or Bi-implications is:

p q p⇔q
F F T
F T F
T F F
T T T
Easy way to remember Biconditional: It gives True for same value and False for different value of p and q.

Exclusive OR of Prepositions
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.
It is abbreviated as p ⊕ q or p XOR q.

Truth table of Exclusive OR is:

p q p⊕q
F F F
F T T
T F T
T T T
Easy way to remember Exclusive OR: It gives False for same value and True for different value of p and q.

By: Muhammad Fayaz | SST-IT 4


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
Note: Basically
p ⊕ q ≡ (p ∧ ∼ q) ∨ (~ p ∧ q)
≡ [p ∧ ~ q) ∨ ~ p] ∧ [(p ∧ ~ q) ∨ q]
≡ (p ∨ q) ∧ ∼ (p ∧ q)
p ⊕ q ≡ (p ∨ q) ∧ (∼ p ∨ ~ q)

Compound Prepositions
Many Prepositions are constructed by combining one or more propositions. Such propositions, are called
compound propositions. This type of Prepositions is formed from existing propositions using logical operators.
Compound preposition is also called well-formed formula.
Examples: ¬( p ⋀ q), ( p ⟶ ( p ⋁ q ⋁ r ))

Tautology
A compound proposition that is always true, no matter what the truth values of the propositional variables that
occur in it, is called a tautology.
A Tautology is a formula which is always true for every value of its propositional variables.
Tautology is represented by t.
Example: Prove [(A→B)∧A]→B is a tautology.
Proof:

A B A→B (A→B) ∧ A [(A→B) ∧ A]→B


F F T F T
F T T F T
T F F F T
T T T T T
Since in the last column in the truth table we have T in all the entries, so it is a tautology i.e.
[(A→B) ∧ A]→B ≡t

Contradictions
A compound proposition that is always false, no matter what the truth values of the propositional variables that
occur in it, is called a contradiction.
A contradiction is a formula which is always false for every value of its propositional variables.
Contradiction is represented by c.
Example: Prove that p⋀ ¬ p is a contradiction.
Proof:

p ¬p p⋀ ¬ p
F T F
T F F
Since in the last column in the truth table we have F in all the entries, so it is a contradiction i.e. p⋀ ¬ p≡c

By: Muhammad Fayaz | SST-IT 5


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
Contingency
A compound proposition that is neither a tautology nor a contradiction is called a contingency.

Example: Prove (A∨B)∧(¬A)a contingency


A B AVB ¬A (A∨B)∧(¬A)
F F F T F
F T T T T
T F T F F
T T T F F
Since in the last column in the truth table we have F and T (both) in the entries, so it is a contingency.

Logical Equivalence
Compound propositions that have the same truth values in all possible cases are called logically Equivalent.
Two statement forms are called logically equivalent if, and only if, they have identical truth values for each
possible substitution of statements for their statement variables. The logical equivalence of statement forms p
and q is denoted by writing p≡ q

Example: Show that ¬(p ∨ q) and ¬p ∧¬q are logically equivalent.

p q p∨q ¬(p ∨ q) ¬p ¬q ¬p ∧¬q


F F F T T T T
F T T F T F F

By: Muhammad Fayaz | SST-IT 6


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)

T F T F F T F
T T T F F F F

Here same truth values appear in the column of both compound expression so they are logically equivalent.

Showing Nonequivalence
Example: Show that the statement forms ∼ (p ∧ q) and ∼p ∧ ∼q are not logically equivalent.

p q p∧q ∼ (p ∧ q) ∼p ∼q ∼p ∧ ∼q
F F F T T T T
F T F T T F F
T F F T F T F
T T T F F F F

∼(p ∧ q) and ∼p ∧ ∼q have different truth values in rows 2 and 3, so they are not logically equivalent.

Exercise for students


1. Use truth tables to verify the following logical equivalences.
a. p →q ≡ ∼p ∨ q b. ∼(p →q) ≡ p ∧ ∼q.
2. Show that the following statement forms are all logically equivalent.
p →q ∨ r, p ∧ ∼q →r, and p ∧ ∼r →q
3. Determine whether the following statement forms are logically equivalent:
p → (q →r ) and (p →q) →r
4. Show that the following are tautology by using truth tables.
a) ¬p →(p →q)
b) [p∧(p →q)] →q
5. Show that p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are logically equivalent. This is the distributive law of
disjunction over conjunction.

6. Show that:

By: Muhammad Fayaz | SST-IT 7


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)

a)
b)
c)
d)
e)
f)
g)
h)
i)

Rules and Theorems of logical equivalences


Following are some rules and theorems of logical equivalences. “t” denotes tautology and “c” denoted
contradiction.

Logical Equivalences Involving Conditional Statements.

We can prove all of the theorems and rules by using truth tables. (do it yourself one is done for you.).

By: Muhammad Fayaz | SST-IT 8


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
DE Morgan’s Laws:
a) ¬(p ∧ q) ≡ ¬p ∨¬q

p q p∧q ¬(p ∧ q) ¬p ¬q ¬p ∨¬q


F F F T T T T
F T F T T F T
T F F T F T T
T T T F F F F

Here same truth values appear in the column of both compound expression so they are logically equivalent. i.e.
¬(p ∧ q) ≡ ¬p ∨¬q proved .
b) ¬ (p ∨q) ≡¬p ∧ ¬q

p q p∨q ¬ (p ∨ q) ¬p ¬q ¬p ∧ ¬q
F F F T T T T
F T T F T F F
T F T F F T F
T T T F F F F

Here same truth values appear in the column of both compound expression so they are logically equivalent. i.e.
¬ (p ∧ q) ≡¬p ∧ ¬q proved.

Proof of logical equivalences using theorems


We can prove logical equivalences without truth tables using theorems and principals of logical equivalences.
Example1: Show that ¬(p ∨ (¬p ∧ q)) and ¬p ∧¬q are logically equivalent without truth tables.

Ans: ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧¬(¬p ∧ q) ……………………. De Morgan’s law


≡ ¬p ∧ [¬(¬p)∨¬q] ………………………De Morgan’s law
≡ ¬p ∧ (p ∨¬q) ……………………………. Double Negation law
≡ (¬p ∧ p) ∨ (¬p ∧¬q) ………………… Distributive law
≡ c ∨ (¬p ∧¬q) ……………………… Negation law
≡ (¬p ∧¬q) ∨ c ………………. Commentative law
≡ ¬p ∧¬q ……………………. Identity law
¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧¬q ………………. proved

By: Muhammad Fayaz | SST-IT 9


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
Example1: Show that ∼(p →q) ≡ p ∧ ∼q without truth tables.

Ans: ∼(p →q)


≡ ∼ (∼p∨q) ……………………….. as p →q≡∼p∨q
≡∼ (∼p) ∧∼q……………….. De Morgan’s Law
≡p∧ ∼q………………… Double Negation law
∼ (p →q) ≡p∧ ∼q……………. proved.
Example: Show that (p ∧ q) → (p ∨ q) is a tautology.
Proof: (p ∧ q) → (p ∨ q)

≡ (p ∧ q) → (p ∨ q)
≡ ¬ (p ∧ q) ∨ (p ∨ q) ………………. as p →q≡∼p∨q
≡ (¬p∨¬q) ∨ (p ∨ q) ……………… by De Morgan’s law
≡(¬p∨p) ∨ (¬q∨ q) ………………. By Associative and commutative law of disjunction
≡ t ∨ t……………. negation law
≡ t ………………. Domination law
So (p ∧ q) → (p ∨ q) ≡ t
Example: Show that ~(p→q) → p is a tautology without using truth tables.

Proof: ~(p→q) → p…………………… Given statement form


≡ ~[~(p ∧ ~q)] → p ………………..Implication law p→q ≡ ~(p ∧ ~q)
≡ (p ∧ ~q) → p ………………….Double negation law
≡ ~(p ∧ ~q) ∨ p…………….. Implication law p→q ≡ ~p ∨ q
≡ (~p ∨ q) ∨ p …………………De Morgan’s law
≡ (q ∨ ~p) ∨ p ……………….Commutative law of ∨
≡ q ∨ (~p ∨ p) …………….Associative law of ∨
≡ q ∨ t …………….Negation law
≡ t ………………..Domination law
So ~(p→q) → p≡ t …………. Proved.

Exercise for Students:


1. Prove without truth table. ~ (~ p ∧ q) ∧ (p ∨ q) ≡ p

Inverse, Converse, and Contra-positive


Implication / if-then (→) is also called a conditional statement. It has two parts −
Hypothesis, p
Conclusion, q
As mentioned earlier, it is denoted as p→q.

By: Muhammad Fayaz | SST-IT 10


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
Example of Conditional Statement − “If you do your homework, you will not be punished.” Here, "you do
your homework" is the hypothesis, p, and "you will not be punished" is the conclusion, q.
Inverse − An inverse of the conditional statement is the negation of both the hypothesis and the conclusion. If
the statement is “If p, then q”, the inverse will be “If not p, then not q”. Thus, the inverse of p→q is ¬p→¬q.
Example − The inverse of “If you do your homework, you will not be punished” is “If you do not do your
homework, you will be punished.”
Converse − The converse of the conditional statement is computed by interchanging the hypothesis and the
conclusion. If the statement is “If p, then q”, the converse will be “If q, then p”. The converse of p→q is q→p.
Example − The converse of "If you do your homework, you will not be punished" is "If you will not be
punished, you do your homework”.
Contra-positive − The contra-positive of the conditional is computed by interchanging the hypothesis and the
conclusion of the inverse statement. If the statement is “If p, then q”, the contra-positive will be “If not q, then
not p”. The contra-positive of p→q is ¬q→¬p.
Example − The Contra-positive of " If you do your homework, you will not be punished” is "If you are
punished, you did not do your homework”.

Translating English Sentences to Symbols


Let p and q be propositions:
p = “you get an A on the final exam”
q = “you do every exercise in this book”
r = “you get an A in this class”
Write the following propositions using p, q, and r and logical connectives.
1.To get an A in this class it is necessary for you to get an A on the final.
SOLUTION p → r
2.You do every exercise in this book; You get an A on the final, implies,
you get an A in the class.
SOLUTION p ∧ q → r
3. Getting an A on the final and doing every exercise in this book is sufficient
For getting an A in this class.
SOLUTION p ∧ q → r

Translating Symbolic Propositions to English


Let p, q, and r be the propositions:
p = “you have the flu”
q = “you miss the final exam”

By: Muhammad Fayaz | SST-IT 11


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
r = “you pass the course”
Express the following propositions as an English sentence.
1. p → q
If you have flu, then you will miss the final exam.
2. ~q → r
If you don’t miss the final exam, you will pass the course.
3. ~p ∧ ~q→ r
If you neither have flu nor miss the final exam, then you will pass the course.

More Exercise for Students


Construct the truth table for the following:
1. ( p →q ) ↔ ( ¬ q →¬ p )
2. ¬ p ⊕ ¬ q
Use truth table to verify the following:
1. p ⋀ T ⟺ p
2. p ⋁ q ⟺ q ⋁ p
3. ¬( p ⋀ q) ⟺ ¬ p ⋁ ¬ q

********************************* THE END OF CHAPTER#1*********************************

Chapter # 2 Sets, Relations and Functions


Concept of Set
German mathematician G. Cantor introduced the concept of sets.
The well-defined collection of distinct objects is called a set.
 The objects are called the elements or members of the set.
By: Muhammad Fayaz | SST-IT 12
Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
 Sets are denoted by capital letters A, B, C …, X, Y, Z.
 The elements of a set are represented by lower case letters a, b, c, … , x, y, z.
 If an object x is a member of a set A, we write x∈A, which reads “x belongs to A” or “x is in A” or “x is
an element of A”, otherwise we write x∉A, which reads “x does not belong to A” or “x is not in A” or
“x is not an element of A”.

Different ways of representing Set


Tabular form
In this method of representing a set we list all the elements of a set, separated by commas and enclosed within
braces or curly brackets{}.
EXAMPLES
In the following examples we write the sets in Tabular Form.
A = {1, 2, 3, 4, 5} is the set of first five Natural Numbers.
B = {2, 4, 6, 8, …, 50} is the set of Even numbers up to 50.
C = {1, 3, 5, 7, 9, …} is the set of positive odd numbers.
NOTE : The symbol “…” is called an ellipsis. It is a short for “and so forth.”
Descriptive form:
In this method of representing a set we state the elements of a set in words.
EXAMPLES
Now we will write the above examples in the Descriptive Form.
A = set of first five Natural Numbers. ( Descriptive Form )
B = set of positive even integers less or equal to fifty. ( Descriptive Form )
C = set of positive odd integers. ( Descriptive Form )
Set builder form:
We write the common characteristics in symbolic form, shared by all the
elements of the set.
EXAMPLES:
Now we will write the same examples which we write in Tabular as well as Descriptive
Form ,in Set Builder Form .
A = { x|x∈N⋀ x ≤ 5} ( Set Builder Form)
B = { x|x∈E ⋀ 0 < x≤50} ( Set Builder Form)
C = { x|x∈O ⋀ x>0} ( Set Builder Form)

By: Muhammad Fayaz | SST-IT 13


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
Sets of numbers
1. Set of Natural Numbers N = {1, 2, 3, … }
2. Set of Whole Numbers W = {0, 1, 2, 3, … }
3. Set of Integers Z = {…, -3, -2, -1, 0, +1, +2, +3, …} = {0, ±1, ±2, ±3, …}
{“Z” stands for the first letter of the German word for integer: Zahlen.}
4. Set of Even Integers E = {0, ± 2, ± 4, ± 6, …}
5. Set of Odd Integers O = {± 1, ± 3, ± 5, …}
6. Set of Prime Numbers P = {2, 3, 5, 7, 11, 13, 17, 19, …}
7. Set of Rational Numbers (or Quotient of Integers)
8. Set of Irrational Numbers
For example √ 2, π, e, etc.
9. Set of Real Numbers R = Q ∪Q'
10. Set of Complex Numbers
C = {z | z = x + iy; x, y∈R} Here, i = √ −1

What is cardinality of a Set?


The number of elements that belong to a set is known as cardinality of the set and is denoted as |S| and the
number is referred as the cardinal number. The cardinal number for the set with infinite number of elements is
∞.
Example – |A|=|{1,4,3,5}|=4, |B|=|{1,2,3,4,5,…}| =∞

What are the different types of Sets?


There are different types of sets such as finite, infinite, subset, universal, proper, singleton set, etc.
Finite Set
In a finite set, there are a definite number of elements.
Example − S={x|x∈N and 70>x>50} Example- A={1, 2, 3, 5}
Infinite Set
In an infinite set, there are a infinite number of elements
Example − S={x|x∈NS and x>10} Example- {0, 2, 4, 6, … }
Subset
If every element of X is an element of Y, then a set X is a subset of set Y which is written as X⊆Y.
Example 1 − Let, X={1,2,3,4,5,6} and Y={1,2}. Here set Y is a subset of set X as all the elements of set Y is in
set X. Hence, it is written as Y⊆X.

By: Muhammad Fayaz | SST-IT 14


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
Example 2 − Let, X={1,2,3} and Y={1,2,3}. Here set Y is a subset (Not a proper subset) of set X as all the
elements of set Y is in set X. Hence, it is represented as Y⊆X.
Proper Subset
The subset which is not equal to is known as a proper subset. A Set X is a proper subset of set Y (Written as
X⊂Y) if every element of X is an element of set Y and |X|<|Y|.
Example − Let, X={1,2,3,4,5,6} and Y={1,2}. Here set Y⊂X as all elements in Y are contained in X too and X
has at least one element is more than set Y.
Universal Set
A collection of elements in a particular context or application is known as Universal Set. The sets in that context
or application are considered as the subsets of the universal sets. U is used for representing Universal Set.
Example – The set of all the animals on the earth can be defined as U. Set of mammals is considered as subset
of U, set of fishes is also subset of U, etc.
Empty Set or Null Set
If the set does not have any elements, then such a set is known as Empty set, which is represented by ∅. The
cardinality of the null set or empty set is considered as zero, as there are no elements.
Example − S={x|x∈N and 7<x<8}=∅
Singleton Set or Unit Set
When a set has only one element then such a set is known as Singleton set and is denoted by {s}.
Example − S={x|x∈N, 7<x<9} = {8}
Equal Set
When two sets have the same number of elements, then they are said to be equal sets.
Example − If A={1,2,6} and B={6,1,2}, they are equal as every element of set A is an element of set B and
every element of set B is an element of set A.
Equivalent Set
Equivalent sets have same cardinalities.
Example − If A={1,2,6} and B={16,17,22} they are equivalent as cardinality of A is equal to the cardinality of
B. i.e. |A|=|B|=3
Overlapping Set
When there is at least one common element in two sets, they are called as overlapping sets.
Example − Let, A={1,2,6} and B={6,12,42}. Here the common element is 6 and hence the two sets are known
to be overlapping.
Disjoint Set
If not even one element is common among both the sets, then the sets are known to be disjoint sets. The
properties of disjoint sets are as follows:
By: Muhammad Fayaz | SST-IT 15
Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
Example − Let, A={1,2,6} and B={7,9,14}, the two sets are disjoint sets as they do not have any common
single element.

Operations on Set
Union:
Let A and B be subsets of a universal set U. The union of sets A and B is the set
of all elements in U that belong to A or to B or to both, and is denoted A ∪ B.
Symbolically:
A ∪ B = {x ∈U | x ∈A or x ∈ B}
Example:
Let U = {a, b, c, d, e, f, g}
A = {a, c, e, g}, B = {d, e, f, g}
Then A ∪ B = {x ∈U | x ∈A or x ∈ B}
={a, c, d, e, f, g}
Intersection:
Let A and B subsets of a universal set U. The intersection of sets A and B is the
set of all elements in U that belong to both A and B and is denoted A ∩ B.
Symbolically:
A ∩ B = {x ∈U | x ∈ A and x ∈B}
EXMAPLE:
Let U = {a, b, c, d, e, f, g} A = {a, c, e, g}, B = {d, e, f, g}
Then A ∩ B = {e, g}
Difference:
Let A and B be subsets of a universal set U. The difference of “A and B” (or
relative complement of B in A) is the set of all elements in U that belong to A but
not to B, and is denoted A – B or A \ B.
Symbolically:
A – B = {x ∈U | x ∈ A and x∉B}
EXAMPLE:
Let U = {a, b, c, d, e, f, g} A = {a, c, e, g}, B = {d, e, f, g}
Then A – B = {a, c}
Complement:
Let A be a subset of universal set U. The complement of A is the set of all
element in U that do not belong to A, and is denoted Á or Ac .
Symbolically:
Ac = {x ∈U | x ∉A}
EXAMPLE:
Let U = {a, b, c, d, e, f, g]
A = {a, c, e, g}
Then Ac = {b, d, f}

Power Set
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-What is the power set of the set {0, 1, 2}?
Solution: let A={0,1,2} The power set P(A) is the set of all subsets of {0, 1, 2}. Hence,

By: Muhammad Fayaz | SST-IT 16


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
P(A) = {∅, {0}, {1}, {2}, {0, 1}, {0, 2}, {1, 2}, {0, 1, 2}}.
Note that the empty set and the set itself are members of this set of subsets.
Symmetric Difference
The symmetric difference of two sets A and B is a set which contains the elements which belongs to set A or B
but not both. The symmetric difference is also called “Exclusive disjunction of set”.
It is denoted by A ⊕ B orA △ B.
A ⊕ B={x : x ∈ A Vx ∈ B but not both}
Example- Find the symmetric difference of {1,3,5} and {1,2,3}.
Solution: let A= {1,3,5} and B= {1,2,3}.
The set of elements which are not common(present) in both A and B will make the symmetric difference.
We note that 1 and 3 are in both sets so they are not belonging to symmetric difference of set A and B. the rest
of the elements 2 and 5 are belong to either A or B (but not both) so symmetric difference of A and B is:
A ⊕ B= {2,5 }
Cartesian Product of sets
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 − If we take two sets A={a,b} and B={1,2}
The Cartesian product of A and B is written as − A×B={(a,1),(a,2),(b,1),(b,2)}
The Cartesian product of B and A is written as − B×A={(1,a),(1,b),(2,a),(2,b)}
Example-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)}.

Computer Representation of Sets


In Computer sets are represented

Partitioning of a Set
Partition of a set, say S, is a collection of n disjoint subsets, say P1,P2,…Pn that satisfies the following three
conditions −
 Pi does not contain the empty set. [Pi≠{∅} for all 0<i≤n]
 The union of the subsets must equal the entire original set. [P1∪P2∪⋯∪Pn=S]
 The intersection of any two distinct sets is empty. [Pa∩Pb={∅}, for a≠b]

By: Muhammad Fayaz | SST-IT 17


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)

Partition of a Set
Example-
Let S={a,b,c,d,e,f,g,h}
One probable partitioning is {a},{b,c,d},{e,f,g,h}
Another probable partitioning is {a,b},{c,d},{e,f,g,h}

Bell Numbers
Bell numbers give the count of the number of ways to partition a set. They are denoted by BnBn where n is the
cardinality of the set.
Example −
Let S={1,2,3}S={1,2,3}, n=|S|=3n=|S|=3
The alternate partitions are −
1. ∅,{1,2,3}∅,{1,2,3}
2. {1},{2,3}{1},{2,3}
3. {1,2},{3}{1,2},{3}
4. {1,3},{2}{1,3},{2}
5. {1},{2},{3}{1},{2},{3}
Hence B3=5

Computer Representation of sets


Set can be represented in many ways inside computer. One technique is to use a string of bits to represent the
set.
Let U is a universal set having a finite number of elements “n” and all elements of set U are stored in some
proper order that is a1, a2, a3,… an. Let a set A ⊆ U then to give computer representation to set A, use bit string
of “n” elements such that ith bit in set A will be “1” if ai ∈A and is 0 if ai∉A.

By: Muhammad Fayaz | SST-IT 18


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
Example: Let U= {1,2,3,4,5,6,7,8,9,10}, and A= {2,4,6,8,10}
Show how A is represented in computer?
Ans: Computer Representation of Set A is:
{0101010101}.
Explanation:
U= 1 2 3 4 5 6 7 8 9 10
∉A ∈A ∉A ∈A ∉A ∈A ∉A ∈A ∉A ∈A
A= 2 4 6 8 10
Computer Representation of A= 0 1 0 1 0 1 0 1 0 1

Exercise for students:


1. If A={a, b, c, d, e} and B={c, d, e, f, g, h} then find the symmetric difference of A and B.
2. If U={1, 2, 3, 4, 5, 6, 7, 8, 9, 10}.Give the following sets computer representations.
i. A={3, 4, 5}
ii. B={1, 3, 6, 10}
iii. If Computer representation of set C is 0001110000 find set C.
3. Find AxB and BxA where A={a, b, c} and B= {1,2}

Proof of some important rules and theorems


1. Prove the DeMorgan’s Law: (A ∪ B)c = Ac ∩ Bc
PROOF
Conversely
Let x ∈(A∪B)c
let y ∈ Ac ∩ Bc
⇒ x ∉ A∪B
⇒ y ∈Ac and y ∈ Bc
x ∉A and x ∉ B
⇒ y ∉A and y ∉ B
⇒ x ∈Ac and x ∈ Bc
⇒ y ∉A ∪ B
⇒ x ∈Ac ∩ Bc
⇒ y ∈(A ∪ B)c
∴ (A ∪ B)c ⊆ Ac ∩ Bc ………(1)
∴ Ac ∩ Bc ⊆ (A ∪ B)c ………………(2)

From (1) and (2) we have


(A ∪ B)c = Ac ∩ Bc
Which is the DeMorgan`s Law.
2. Prove the DeMorgan’s Law: (A ∩ B)c = Ac U Bc
PROOF
Conversely
Let x ∈(A∩B)c
let y ∈ Ac ∪ Bc
⇒ x ∉ A∩B
⇒ y ∈Ac and y ∈ Bc
x ∉A and x ∉ B
⇒ y ∉A and y ∉ B
⇒ x ∈Ac and x ∈ Bc
⇒ y ∉A ∩ B
⇒ x ∈Ac ∪ Bc
⇒ y ∈(A∩B)c
∴ (A ∩ B)c ⊆ Ac ∪ Bc ………(1)
∴ Ac U Bc ⊆ (A ∩ B)c ………………(2)

By: Muhammad Fayaz | SST-IT 19


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
From (1) and (2) we have
(A ∩ B)c = Ac U Bc
Which is the DeMorgan`s Law.

2nd Method to Prove De-Morgan’s Law


´ B)= Á ∪ B́
(A∩
We can prove this identity with the following steps.
´ B) = {x | x ∉ A ∩ B} ……………. by definition of complement
(A∩
= {x | ¬(x ∈ (A ∩ B))}……….. by definition of does not belong symbol
= {x | ¬(x ∈ A ∧ x ∈ B)} ……..by definition of intersection
= {x | ¬(x ∈ A)∨¬(x ∈ B)}………. by the first De Morgan law for logical equivalences
= {x | x ∉ A ∨x ∉ B}………. by definition of does not belong symbol
= {x | x ∈ Á ∨ x ∈ B́}…………. by definition of complement
= {x | x ∈ Á ∪ B́} ……….. by definition of union
= Á ∪ B́ ………….. by meaning of set builder notation
´ B)= Á ∪ B́ …….. Proved.
(A∩

By: Muhammad Fayaz | SST-IT 20


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)

By: Muhammad Fayaz | SST-IT 21


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)

By: Muhammad Fayaz | SST-IT 22


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)

By: Muhammad Fayaz | SST-IT 23


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
Relations
Cartesian product of two sets
Let A and B be sets. The Cartesian product of A and B, denoted by A × B (read as “A cross B”) is the set of all
ordered pairs (a, b), where a is in A and b is in B.
Symbolically:
A × B = {(a, b)| a ∈ A and b ∈ B}
NOTE: If set A has m elements and set B has n elements then A ×B has m × n elements.
Example:
Let A = {1, 2}, B = {a, b, c} then
A × B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}
B × A = {(a, 1), (a, 2), (b, 1), (b, 2), (c, 1), (c, 2)}
A × A = {(1, 1), (1,2), (2, 1), (2, 2)}
B × B = {(a, a), (a, b), (a, c), (b, a), (b, b), (b, c), (c, a), (c, b),(c, c)}
Remark:
1. A × B ≠ B × A for non-empty and unequal sets A and B.
2. A × φ = φ × A = φ
3. | A × B| = |A| × |B|

Binary relation
Let A and B be sets. The binary relation R from A to B is a subset of A × B. When (a, b) ∈R, we say ‘a’ is related to
‘b’ by R, written aRb. Otherwise, if (a, b) ∉R, we write a R b.
EXAMPLE:
Let A = {1, 2}, B = {1, 2, 3}
Then A × B = {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3)}
Let
R1={(1,1), (1, 3), (2, 2)}
R2={(1, 2), (2, 1), (2, 2), (2, 3)}
R3={(1, 1)}
R4= {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3)}
R5= ∅
All being subsets of A × B are relations from A to B.

Domain of a relation
The domain of a relation R from A to B is the set of all first elements of the ordered pairs which belong to R
denoted by Dom(R). Symbolically,
Dom (R) = {a ∈A | (a, b) ∈R}
Range of a relation
The range of a relation R from A to B is the set of all second elements of the ordered pairs which belong to R
denoted Ran(R).
Symbolically,
Ran(R) = {b ∈B | (a, b) ∈ R}

Properties /Types of binary relations


There are several properties that are used to classify relations on a set. We will introduce the most important of
these here.
1. Reflexive Relation
A relation R on a set A is called reflexive if (a, a) ∈ R for every element a ∈ A. (each element is related to itself)

By: Muhammad Fayaz | SST-IT 24


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
Example- Consider the following relations on A= {1, 2, 3}
R1 = {(1, 1), (1, 2), (2, 2), (3, 3)}
R2 = {(1, 1), (1, 2), (3, 3)}
Which of them are reflexive?
Ans: R1 is Reflexive as (1,1), (2,2), (3,3) ∈ R1
R2 is not reflexive because (2,2) ∉ R2
2. Symmetric Relation
A relation R on a set A is called symmetric if (b, a) ∈ R whenever (a, b) ∈ R, for all a, b ∈ A.
Example- Let A= {1,2,3} and R= {(1,1), (1,2), (2,1), (2,3), (3,2)}
The given relation R is a symmetric relation in A as for each (a,b)∈ R there is (b,a)∈ R .
3. Anti-Symmetric Relation
A relation R on a set A such that for all a, b ∈ A, if (a, b) ∈ R and (b, a) ∉ R unless a = b, is called
antisymmetric.
Example- Let A={1,2,3} and R1={(1,1), (2,1), (2,3)} , R2= {(2,3), (3,2), (2,2), (3,3)}
Which them is anti-symmetric?
Ans: R1 is anti-symmetric because for all (a, b) ∈ R 1, a=b.
R2 is not anti-symmetric because for (2,3)∈ R 2 there exists (3,2) ∈ R 2.
4. Transitive Relation
A relation R on a set A is called transitive if whenever (a, b) ∈ R and (b, c) ∈ R, then (a, c) ∈ R, for all a, b, c ∈
A.
Example- Let A= {1,2,3} and R= {(1,1), (1,2), (2,3), (1,3), (3,3).
R is Transitive because (1,2) ∈ R and (2,3) ∈ R also (1,3) ∈ R

Combining Relations
Because relations from A to B are subsets of A × B, two relations from A to B can be combined in any way two
sets can be combined.
Example - Let A = {1, 2, 3} and B = {1, 2, 3, 4}. The relations R1 = {(1, 1), (2, 2), (3, 3)} and
R2 = {(1, 1), (1, 2), (1, 3), (1, 4)} can be combined to obtain
R1 ∪ R2 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (3, 3)},
R1 ∩ R2 = {(1, 1)},
R1 − R2 = {(2, 2), (3, 3)},
R2 − R1 = {(1, 2), (1, 3), (1, 4)}.

By: Muhammad Fayaz | SST-IT 25


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
Partitioning And Covering of a Set
Partitioning of a Set
Partition of a set, say S, is a collection of n disjoint subsets, say P1,P2,…Pn that satisfies the following three
conditions −
 Pi does not contain the empty set. [Pi≠{∅} for all 0<i≤n]
 The union of the subsets must equal the entire original set. [P1∪P2∪⋯∪Pn=S]
 The intersection of any two distinct sets is empty. [Pa∩Pb={∅}, for a≠b]

Partition of a Set
Covering of Set
Covering of a set, say S, is a collection of n subsets, say P1,P2,…Pn that satisfies the following two conditions:
 Pi does not contain the empty set. [Pi≠ {∅} for all 0<i≤n]
 The union of the subsets must equal the entire original set. [P1∪P2∪⋯∪Pn=S]
Example- Let S= {a, b, c}, A= {{a, b}, {b, c}}and F={{a}, {b, c}}
Set A is a covering set of S since {a, b}∪{b, c} =S and Set F is a partition of S since it satisfies all three
conditions.

Equivalence Relation
A relation R in a set A is called equivalence relation if:
 It is reflexive
 It is symmetric
 It is transitive
Example- let X={1,2,3} and a relation R on X is R={(1,1), (1,2), (1,3), (2,1), (2,2), (2,3), (3,1), (3,2), (3,3)}
then determine R is an equivalence relation.
Ans: Yes! R is an equivalence relation because
 R is reflexive as for all “a” (a, a)∈ R
 R is symmetric as for (a, b) ∈ R there exist (b, a) ∈ R .
 R is transitive as (a, b) ∈ R and (b, c) ∈ R there exist (a, c ) ∈ R .

Partial order relation (partial ordering)


A relation R in a set A is called partial order relation if:
 It is reflexive

By: Muhammad Fayaz | SST-IT 26


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
 It is anti-symmetric
 It is transitive
Example- let X={1,2,3} and a relation R on X is R={(1,1), (2,2), (3,3)} then determine R is an partial order
relation.
Ans: Yes! R is a partial order relation because
 R is reflexive as for all “a” (a, a)∈ R
 R is anti-symmetric as for (a, b) ∈ R there exist (b, a) ∈ R such that a=b.
 R is transitive ………………………… (Ask your teacher why???????)

Posets or Partially ordered sets


A set S together with a partial ordering R is called a partially ordered set, or poset, and is denoted by (S,R).
Members of S are called elements of the poset.
Example-The relation ≥ is a partial order relation on the set of integer Z, then (Z, ≥) is called Poset.
Because the relation ≥ is partial order relation on Z as:
 It is reflexive because for all a∈Z , a≥a
 It is asymmetric since for all a,b ∈Z if a≥ b and b≥ a then a=b
 It is transitive for all a,b,c ∈Z, if a≥ b and b≥ c then there will be a≥c.
So, the relation ≥ is a partially ordered relation on Z. Z together with ≥, (Z, ≥) is called partially ordered set.

Representation of relations
Matrix representation of a relation

A relation between finite sets can be represented using a zero–one matrix.


Suppose that R is a relation from A = {a1, a2, . . . , am} to B = {b1, b2, . . . , bn}. The relation R can be
represented by the matrix MR = [mij ], where

In other words, the zero–one matrix representing R has a 1 as its (i, j ) entry when ai is related
to bj, and a 0 in this position if ai is not related to bj .

Example- Suppose that A = {1, 2, 3} and B = {1, 2}. Let R be the relation from A to B such that R = {(2, 1),
(3, 1), (3, 2)} then represent R in matrix form.

Ans:

B 1 2

By: Muhammad Fayaz | SST-IT 27


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
A 1 0 0
2 1 0
3 1 1
So Matrix form of R is:

Digraph
There is another important way of representing a relation using a pictorial representation. Each element of the
set is represented by a point, and each ordered pair is represented using an arc with its direction indicated by an
arrow. We use such pictorial representations when we think of relations on a finite set as directed graphs, or
digraphs.

Example- The directed graph of the relation R = {(1, 1), (1, 3), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2), (4, 1)} on the
set {1, 2, 3, 4} is:

Function’s topic was provided to students in hand written form.

Elementary Counting Techniques


Counting Techniques are used to count something quickly. There are different counting techniques, we will
discuss some of them here:

By: Muhammad Fayaz | SST-IT 28


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)
Sum Rule
The sum rule states that if first task can be performed in “m” ways and second task can be performed in “n”
ways (if these tasks can’t be done at the same time) then there are “m+n” ways to do both tasks.
Example: If 3 female and 2 male teachers teaching computer science then students can choose teacher in 3+2=5
ways.

Product Rule
Suppose that a procedure can be broken down into a sequence of two tasks. If there are m ways to do the first
task and for each of these ways of doing the first task, there are n ways to do the second task, then there are m.n
ways to do the procedure.
Example:
In a class there are 3 boys and 2 girls, then if a boy and girl have to be chosen for monitor, the students can
choose class monitor in 3x2=6 ways.

Difference Rule
If a task can be done in either n1 ways or n2 ways, then the number of ways to do the task is n1 + n2 minus the
number of ways to do the task that are common to the two different ways. The subtraction rule is also known as
the principle of inclusion–exclusion.
|A1 ∪ A2| = |A1| + |A2| − |A1 ∩ A2|.
Example- How many bit strings of length eight either start with a 1 bit or end with the two bits 00?

128 + 64 − 32 = 160

Pigeon hole Principal


Pigeon hole principal states that if there are more pigeons than pigeonholes, then there must be at least one
pigeonhole with at least two pigeons in it.
If k is a positive integer and k + 1 or more objects are placed into k boxes, then there is at least one box
containing two or more of the objects.
In any group of 27 English words, there must be at least two that begin with the same letter, because there are
26 letters in the English alphabet.

By: Muhammad Fayaz | SST-IT 29


Discrete Mathematics for B.Sc. Part-1 (Paper-A, Section-A)

(In Progress…………………..)

By: Muhammad Fayaz | SST-IT 30

Das könnte Ihnen auch gefallen