You are on page 1of 536

DISCRETE STRUCTURES

Prof. Dipanwita Roychowdhury


Computer Science and Engineering
IIT Kharagpur
INDEX

S.NO TOPICS PAGE.NO

Week 1
1 Lecture 01: Introduction to Propositional Logic 4
2 Lecture 02: Introduction to Propositional Logic (Contd.) 17
3 Lecture 03 : Introduction to Propositional Logic (Contd.) 26
4 Lecture 04: Introduction to Propositional Logic (Contd.) 34
5 Lecture 05: Introduction to Propositional Logic (Contd.) 45
6 Lecture 06: Introduction to Propositional Logic (Contd.) 53
Week 2
7 Lecture 07: Predicate Logic 62
8 Lecture 08: Predicate Logic (Contd.) 71

9 Lecture 09 : Predicate Logic (Contd.) 78


Week 3
10 Lecture 10 : Predicate Logic (Contd.) 87
11 Lecture 11 : Proof Techniques 95
12 Lecture 12 : Proof Techniques (Contd.) 102
13 Lecture 13 : Proof Techniques (Contd.) 109
14 Lecture 14 : Proof Techniques (Contd.) 117
Week 4
15 Lecture 15 : Proof Techniques (Contd.) 126
16 Lecture 16 : Sets and Functions 134
17 Lecture 17 : Sets and Functions (Contd.) 144
18 Lecture 18 : Sets and Functions (Contd.) 151
19 Lecture 19 : Sets and Functions (Contd.) 157
20 Lecture 20 : Sets and Functions (Contd.) 168
Week 5

1
21 Lecture 21 : Relations and their Properties 178
22 Lecture 22 : Relations and their Properties (Contd.) 188
23 Lecture 23 : Relations and their Properties (Contd.) 197
24 Lecture 24 : Relations and their Properties (Contd.) 207
Week 6
25 Lecture 25 : Relations and their Properties (Contd.) 216
26 Lecture 26 : Recursion 226
27 Lecture 27 : Recursion (Contd.) 233
28 Lecture 28 : Recursion (Contd.) 242
29 Lecture 29 : Recursion (Contd.) 250
Week 7
30 Lecture 30 : Recursion (Contd.) 259
31 Lecture 31: Recurrence relations 269
32 Lecture 32: Recurrence relations (Contd.) 278
33 Lecture 33: Recurrence relations (Contd.) 287
34 Lecture 34: Recurrence relations (Contd.) 295
35 Lecture 35: Recurrence relations (Contd.) 302
Week 8
36 Lecture 36: Counting Techniques and Pigeonhole Principle 309
37 Lecture 37: Counting Techniques and Pigeonhole Principle (Contd.) 317
38 Lecture 38: Counting Techniques and Pigeonhole Principle (Contd.) 325
39 Lecture 39: Counting Techniques and Pigeonhole Principle (Contd.) 333
40 Lecture 40: Counting Techniques and Pigeonhole Principle (Contd.) 341
Week 9
41 Lecture 41 : Combinatorics 350
42 Lecture 42 : Combinatorics (Contd.) 359
43 Lecture 43 : Combinatorics (Contd.) 369
44 Lecture 44 : Combinatorics (Contd.) 378
45 Lecture 45 : Combinatorics (Contd.) 388

2
Week 10
46 Lecture 46 : Algebraic Structures 399
47 Lecture 47 : Algebraic Structures (Contd.) 408
48 Lecture 48 : Algebraic Structures (Contd.) 417
49 Lecture 49 : Algebraic Structures (Contd.) 427
Week 11
50 Lecture 50 : Algebraic Structures (Contd.) 434
51 Lecture 51: Ring and Modular Arithmetic 443
52 Lecture 52: Ring and Modular Arithmetic (Contd.) 451
53 Lecture 53: Ring and Modular Arithmetic (Contd.) 462
54 Lecture 54: Ring and Modular Arithmetic (Contd.) 470
55 Lecture 55: Ring and Modular Arithmetic (Contd.) 480
Week 12
56 Lecture 56 : Finite Field and Applications 489
57 Lecture 57 : Finite Field and Applications (Contd.) 497
58 Lecture 58 : Finite Field and Applications (Contd.) 509
59 Lecture 59 : Finite Field and Applications (Contd.) 518
60 Lecture 60 : Finite Field and Applications (Contd.) 526

3
Discrete Structures
Prof. Dipanwita Roy Chowdhury
Department of Computer science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 01
Introduction to Propositional Logic

We start our Discrete Structure class with the fundamentals of logic. Today, we will read
the Propositional Logic.

(Refer Slide Time: 00:36)

So, first, we give that what you mean by propositional logic. What is logic? So, logic is
the study of reasoning. We write logic is the study of reasoning.

It is specifically concerned about the reasoning of two statements so, or whether the
reasoning is correct or not. It is concerned with whether the reasoning is correct. Mainly
logic concerns the relationship between two statements, but logic does not concern about
the correctness of the statement. Logic concerns the relationship between the statements,
particularly whether it is correct or not. But it has not concerned the correctness of a
particular statement. We take one example first.

4
(Refer Slide Time: 03:38)

One simple example we see. See, I write, all professors drink tea. The second statement I
write that anyone who drinks tea is a scientist. So, the third statement gives a relationship
between 1 and 2, and we can tell if we think that 1 and 2 are correct, then I can write
that, therefore, all professors are scientists.

So, we explained this simple example. See, statement–1 tells all professors drink tea;
statement –2 tells anyone who drinks tea is a scientist. So, the third statement says;
therefore, all professors are scientists. See, statements 1 and 2, we do not check, or we
are not concerned whether the statement is correct or not. But, if 1 and 2 are correct, if
statements 1 and 2 are correct, then three is correct. Then statement 3 is correct. So, this
means the logic. So, this is logic. So, what is the advantage of logic or why it is so
important, or why we will read logic? So, first, we see that thing.

5
(Refer Slide Time: 06:36)

So, why logic is important? Why will we study? A very simple way I can tell that logic is
useful in clarifying ordinary writing; whatever I am writing can be literature or that can
be some science topic or our academic content. So, that must be logical, and there must
be some relation between the sentences that I am writing or the statements I am writing.

If I considered our technical things why logic is important, then logic methods are used
to prove the mathematical theorem. In mathematics, we can tell that in mathematics,
mainly logic, is used are to prove the mathematical theorems. In computer science, it is
used to write the correct program or to prove the correctness of the program. In computer
science, logic is used to prove the correctness of the program.

What do you mean by the correctness of the program? See, we have to show, or we have
to prove that the programming is doing what it is supposed to do or what it is ablest to
do. So, with this small introduction, now we start the propositional logic.

6
(Refer Slide Time: 10:37)

First, we define propositions. What do you mean by propositions? Simply this is a


sentence or statement, but either it is true, or it is false since just now what we read that
logic will see the relationship between the statements or the correctness, but not the
correctness of a particular statement. So, we define that a sentence, or we can tell a
statement that is either true or false, but not both, is called a proposition.

We see some very simple examples so that our concept of the proposition is clear. I give
some simple statements, or I write those statements. First, I give the only positive integer
that divides 7, which are 1 and 7 itself. The second statement I give that Rabindranath
Tagore won the Nobel Prize for writing Sesher Kabita. The third statement I write,
Rabindranath Tagore, won the Nobel Prize for writing, or better I tell, for translating
Gitanjali in English. We see some more examples.

7
(Refer Slide Time: 15:42)

Fourth statements I give for every positive integer ‘n’, there is a prime number greater
than ‘n’. In the fifth sentence I write, the earth is the only planet where there exists life,
or that contains life. I gave you a different type of sentence, attend all the lecture classes.

Now with these six sentences, I try to explain that what do we mean by the proposition.
We see that first one; I told the only positive integer that divided 7, are 1 and 7 itself. So,
it is true because 7 is a prime number. Then the second statement, Rabindranath Tagore,
won Nobel Prize for writing Sesher Kabita, which is not correct; which is false. So now,
we start writing that our first statement is true, the second statement is false, third
statement Rabindranath Tagore won Nobel Prize for translating Gitanjali in English that
is true, which is we know that is a true statement.

Now, next sentence that for every positive integer ‘n’, there is a prime number greater
than ‘n’ which tells us that the prime numbers or number of prime numbers are infinite,
which is true. So, this is also true. The fifth sentence, or say the fifth statement tells earth
is the only planet that contains life. See, it may be true or false, but at a time, either it is
true or false, not both. So, I can write the fifth sentence that may be true or false in that
we know that it is true, but it may be false. So, it is true or false, but at the same time, it
cannot be true or false.

In the sixth sentence, I was told to attend all the lecture classes. See, I cannot say
anything about the correctness, true or false. This is actually a command. So, I cannot tell

8
about this, and this is actually a command type of sentence or statement that is neither
true nor false. So, what I got? Previous three, I got one true statement–1 true, statement–
3 true, says statement–2 false, statement–4 true, statement–5 true or false, and for
statement–6, I cannot tell true or false it is actually a different type of thing.

So, I can now conclude, or I can write from these examples what I can tell that
statements 1 to 5 are propositions. But, statement 6 is not a proposition. So, a statement
or a declarative statement that is either true or false, but not both at a time, is a
proposition, but the command or advice this type of sentence or statements cannot be a
proposition. So, we define the proposition with these examples.

Normally we denote propositions by this; say ‘p’, I can tell that this is a ‘p’ is the
proposition. I can write ‘p’, ‘q’, ‘r’, and that can be that denotes one particular statement
that which is either true or false that can be a proposition. So, normally we call these are
also propositions or primitive statements. What are primitive statements? That primitive
statements cannot be broken into some simpler sentence. So, this is a primitive statement
or proposition.

(Refer Slide Time: 22:59)

Now, we define some operations on this proposition. See, these operations can be either
unary or binary. What is unary? That means this operation only operates only one single
proposition. Say, we consider ‘p’ is a proposition. Then the first operation we define is a

9
negation. Normally, we denote as by ‘˜’ or ‘¬’. That means, if I write ‘p’ is a proposition,
and if I write negation ‘¬ p’, then it is written that ‘not p’.

Example: if I give an example, say, ‘p’ is a proposition

And, p: It is raining

First thing, it is a declarative statement, either true or false. So, what will be ‘¬ p’?

‘¬ p’ is it is not raining.

This is a unary operator. Since it needs only one proposition or one variable, I can take
that one propositional variable ‘p’. It works on that.

Now, some complex propositions can be obtained from the primitive statement or from
that primitive proposition. We define that primitive statements cannot be broken into
simpler statements or simpler propositions. There is a basic thing. So, some complex
proposition of how we can get from there, we have two operations for this.

(Refer Slide Time: 26:23)

Now, these are binary operations. They are ‘Conjunctions’ and ‘Disjunctions’. So, these
are two binary operations. So, for this operation, I need two propositions. I take the
example; ‘p’ is one proposition.

p: it is raining,

10
And, ‘q’ is another one proposition,

q : it is cold

Now, 'Conjunction', we defined like that, normally we denote this thing as ‘∧’. We write
‘p ∧ q’, and it tells us that

p ∧ q : It is raining and it is cold

What is Disjunction? We denote by this symbol ‘∨’, normally called ‘OR’ and

p ∨ q : It is raining or it is cold

So, these are the three operations that ‘¬’, ‘∧’ and ‘∨’. These are the basic three
operations on the proposition. So, these are also propositions. These are some compound
propositions obtained from there.

(Refer Slide Time: 29:30)

So, they are either true or false since they are propositions. So, ‘¬ p’ or ‘p ∧ q’ or ‘p ∨ q’,
they are also either true or false since they are also a proposition.

11
(Refer Slide Time: 30:01)

Now, another we can tell that normally, ‘Conjunction’ is ‘and’. ‘Disjunction’ is of two
types. Normally, we call ‘or’, it is of either ‘inclusive or’ what is our normal ‘or’, another
is called the ‘exclusive or’. Now, when the disjunction is operated on two, or at least two
propositions since it is binary, then it will be either ‘inclusive or’ it will be ‘exclusive or’.

Now, we will define some truth tables with respect to this operation. So, what is the truth
table? The truth table will give the truth values of the propositions, which are either true
or false. We denote this ‘True’ by ‘T’ or ‘1’, and ‘False’ by ‘F’ or ‘0’.

(Refer Slide Time: 32:16)

12
So, that means, with the example that we have given, ‘p ∧ q’; so, if p is true and q is also
true:
p : True
q : True

Then what will be the truth value of ‘p ∧ q’? So, that gives you the one particular truth
value of that truth table.

So, then if ‘p’, ‘q’ are true, then ‘p ∧ q’ is true:

p ∧ q : True

We can write in this way,


p : True
q : False.
So, they can give, p ∧ q : False
Since it is ‘and’. Since ‘p’ and ‘q’ this gives you actually ‘and’. So, now, I can quickly
write that
p : False, q : True,  p ∧ q : False
p : True, q : False,  p ∧ q : False

So, in a table, if we give the truth values for all the assignments of the propositions, that
will give us the truth table. So, now we see what are the truth tables of these three basic
operation.

(Refer Slide Time: 34:13)

First, what we have seen the negation, negation is denoted as ‘¬'. Suppose ‘p’ and ‘q’ are
two propositions. So, the truth table gives or presents the truth value of the proposition

13
obtained for all the assignments. Here assignment means either ‘True’ (T) or ‘False’ (F)
of the proposition or primitive proposition, in this case, ‘p’ and ‘q’.

The truth table for negation


p ¬p
T F
F T

See, ‘p’ can take only two values, either ‘T’ or ‘F’. So, I write ‘p’ is true, then ‘¬ p’ is
false. Then if ‘p’ is false, ‘¬ p’ is true.

Or, I can also write in this way by using 0 or 1:

The truth table for negation


p ¬p
1 0
0 1

(Refer Slide Time: 36:55)

Now, we see the ‘Conjunction’ and ‘Disjunction’. Again, if ‘p’ and ‘q’ be the
propositions, then I can write:

The truth table for Conjunction


p q p∧q
T T T
T F F
F T F
F F F

14
I can write ‘p’, ‘q’, and ‘p ∧ q’. So, now ‘p’, ‘q’ can take four values. It can be both true
then ‘p ∧ q’ true because ‘and’. So, ‘p’ true, ‘q’ true; then ‘p ∧ q’ be true. Now, ‘p’ is
true and ‘q’ is false, and since it is ‘and’, so, the composition or the conjunction of ‘p ∧
q’ is false. Then if ‘p’ is false and ‘q’ is true, then ‘p ∧ q’ is false; if ‘p’ and ‘q’ are both
false, then ‘p ∧ q’ is false.

Now I can write the truth table of ‘OR’. I can write the truth table of ‘or’, which is
‘inclusive OR’.
The truth table for OR
p q p∨ q
T T T
T F F
F T F
F F F

So, I can draw the truth table ‘p’, ‘q’ ‘p ∨ q’. Both if ‘p’ is true, if ‘q’ is true, then ‘p ∨ q’
is true. If ‘p’ is true, ‘q’ is false since it is ‘OR’, so ‘p ∨ q’ can be true. If ‘p’ is false, ‘q’
is true, or if any one is true, then ‘p ∨ q’ is true. Only if both ‘p’ and ‘q’ are false, then
only ‘p ∨ q’ will be false. So, this is ‘inclusive OR’, ok. Now, there is something called
‘exclusive OR’. This is we normally denoted by ‘⊻’, and we can write if ‘p’ and ‘q’ both
are true, then ‘p ⊻ q’ is false, if both ‘p’ and ‘q’ are false, then ‘p ⊻ q’ is false. If anyone
of 'p' and 'q' is true, then only ‘p ⊻ q’ is true.

The truth table for OR


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

So, I can write that this is my ‘inclusive OR’; this is my ‘exclusive OR’. So, the truth
table is very important for propositional logic because it gives the truth values of a
complex proposition, for all the truth values of the basic proposition or the primitive
proposition.

So, what we have read? We read the three operations; one is a unary operation - the
‘negation’, the truth table of that, then we read the ‘conjunction’ and ‘disjunction’ to
binary operations and the truth table of the ‘p’ and ‘q’, the conjunction and the truth table

15
of disjunction. Now, there are two type of disjunction, one is ‘inclusive OR’ one is
‘exclusive OR’, and we can write the truth table of this thing, ok.

So, now, we finish this class with these truth values and the truth tables, and next class,
we will see the other operations.

16
Discrete Structures
Prof. Dipanwita Roy Chowdhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 02
Introduction to Propositional Logic (Contd.)

Last class, we have read the truth tables of the three operations; negation, conjunction,
and disjunction. So, today we will start the class with another two operations, which are
very important and they come under the conditional proposition.

(Refer Slide Time: 00:46)

Now, there are two types of a conditional proposition; one is ‘Implication’. How do we
define it? See, if we have two propositions ‘p’ and ‘q’. Let ‘p’ and ‘q’ are two
propositions, then ‘p implies q’ this is the conditional proposition, we write ‘p → q’.
What is the meaning? The meaning is that simple ‘if p then q’. Meaning is ‘if p then q’.
So, this is our first type of conditional proposition; that means ‘q’ depends or the truth
value of ‘q’ depends on ‘p’.

Another one is ‘Biconditional’. The other conditional proposition is, or the operation is
‘biconditional’, normally we denote by ‘↔’. If ‘p’ and ‘q’ are two propositions, then ‘p
↔ q’ means that ‘q if and only if p’ or since it is biconditional, I can write ‘p if and only
if q’. Or, I can write, this is the same as ‘p is necessary and sufficient for q’.

17
So, these are the two conditional proposition or the two operations that normally it
operates on the basic propositions.

(Refer Slide Time: 04:36)

Now, another thing is very important since now we have three basic operations. So, what
is the precedence? So, operator precedence; so, when we evaluate or when we will
evaluate the truth value of some complex proposition, then the ordering will be the first
is ‘negation’ (¬), second is ‘conjunction’ (∧), the third is ‘disjunction’ (∨). So, this is the
ordering precedence or operator precedence.

Now, we have three basic operations and two conditional propositions. So, we see how
we can evaluate the compound proposition, ok. We take some examples. Before giving
an example, another two terms we defined. Whenever we are considering conditional
propositions like ‘p implies q’, then we tell these ‘p’ is normally called the hypothesis,
and ‘q’ is called the conclusion.

Now what we will see that when we evaluate the compound proposition consisting of
three basic operations and the two conditional operations, the implication and the
biconditional operator, then we will see that for truth values, all possible truth values of
the proposition that are the compound proposition takes the value, ok.

18
(Refer Slide Time: 08:13)

So, we take this example to think much. One compound proposition we take ‘p and q
implies r’:
p∧q→r
Now, when we try to evaluate, so all possible truth values of ‘p’ and ‘q’ we have to take,
and here ‘r’ is also there; ‘p’, ‘q’ and ‘r’. So, I explained first. So, if ‘p’, let we take the
‘p’ is ‘true’, ‘q’ is ‘false’, ‘r’ is ‘true’.
p – true
q – false
r – true
So, if ‘p’ is true, ‘q' is false, then what 'p ∧ q’? ‘p ∧ q’ is ‘false’. ‘p ∧ q’ is false because
‘p’ is true and ‘q’ is false.
p ∧ q – false
Now, if ‘r’ is true, then ‘p ∧ q’ implies ‘r’;
that means, ‘p ∧ q → r’;
that means, false → true
So, we have to know the truth value of implication; that means if my ‘p ∧ q’ this
becomes ‘false’, then what will be the resultant proposition? So, what will be the truth
table? First, we have to see the truth table of ‘p → q’.

The truth table of p → q


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

19
So, they can take both are ‘true’. Now, if ‘p’, ‘q’ both are ‘true’; that means truth true
implies true. So, ‘p → q’ is ‘T’. Better first, I tell the last two conditions that if ‘p’ is ‘F’
and ‘q’ is ‘T’ then ‘F’ implies ‘T’; that means, ‘p → q’ is F and T then ‘p → q’ becomes
‘T’. ‘F → F’, ‘p → q’ this is also true. Only ‘T’ implies ‘F’ we make it ‘F’; that means,
accept ‘p’ is ‘true’ and ‘q’ is ‘false’ all other truth-values will give or will result in it
‘true’ value of the proposition.

So, why is this the thing? That means, here, the condition is that we do not want to
believe that some ‘true’ value of the proposition implies some ‘false’ value of the result.
So, this is the implication that we do not want this is very important we do not want; I
write in this way, we do not want a true statement to lead us into believing something
that is false. So, these give us that ‘T → F’ is ‘F’, ‘p’ is ‘T’, ‘q’ is ‘F’, and ‘T → F’ is
‘F’. So, we remember this condition; only this is the condition that if ‘p’ is true and ‘q’ is
false, so, ‘p → q’ is ‘false’. And this is our truth table of implication.

So, now if we come back to our original example


p – true
q – false
p∧q→r
false → true
Then, these ‘p’, ‘q’; ‘p ∧ q’ is ‘false’, and this is ‘false → true’. So, ‘false → true’ is, this
is ‘true’. ‘false → true’ gives you a ‘true’ value. This gives us a true value; this is my
result. So, how to evaluate? This is one example I give that how to evaluate the
compound proposition using the three basic operations and the conditional operator, that
is implication; here we have taken implication, ok.

20
(Refer Slide Time: 15:34)

I take another example. I give:

p∨q→¬r

Unless otherwise stated, ‘r’ is always ‘inclusive r’ or normal, not the exclusive one, ok.
So, we have values. Again if we remember, I have taken the values ‘p – true’, ‘q – false’,
and ‘r – true’.

p – true
q – false
r – true

We try to evaluate these assignments, ok. So, what is ‘p ∨ q’? ‘p – true’, ‘q – false’; this
gives ‘p ∨ q – true’ p or q true because ‘OR’. Now, ‘p ∨ q – true’, and ‘r’ is true: ‘r –
true’, so, ‘¬ r’ is ‘false’. So, if we take ‘p ∨ q → ¬ r’. Since now we know the truth table
of implication. So, ‘p ∨ q’ is ‘true’, so; that means, ‘true’ implies ‘false’, which is the
only one ‘false’ condition of the implication, just now we have seen. So, these will give
you the ‘false’ because that ‘true → false’ we do not believe in this philosophy. So, this
is the result which is ‘false’.

I take another example; I take another example say ‘p ∧ (q → r)’. ‘p – true’, and ‘q → r’.
Since our ‘q – false’, ‘r – true’. So, first, we see what it gets ‘false → true’, ‘q → r’ is
‘true’. Now ‘true ∧ true’, so, ‘p ∧ (q → r)’ is ‘true’. So, this is a 'true’ result.

21
(Refer Slide Time: 19:34)

We take another example; I take ‘p → (q → r)’. If we remember again quickly, I write


the truth table of ‘p → q’:

The truth table of p → q


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

Now, we see our example. We have taken:

p – true
q – false
r – true

So, ‘false → true’. So, ‘q → r’ is ‘true’. Now, ‘T → T’. ‘T → T’ is ‘true’. So, this is my
result, ‘p → (q → r)’ is ‘true’.

So, in this way, we evaluate the truth values of the compound proposition. Another
condition we remember this is though when we will be evaluating for different truth
values or different assignments that a conditional proposition that is true because the
hypothesis is false and this condition is said to be vacuously true. This is said to be
vacuously true. This third situation is our ‘p → q’, ‘p’ is a hypothesis and ‘q’ is a
conclusion. Now, if the hypothesis is false, then the condition is not validated. So, the

22
result is the ‘p → q’ is always ‘true’. This is sometimes called by default. This is the
default situation, or it is called the vacuously true. This is vacuously true.

So, here we see that how we can evaluate all the compound propositions with the three
operations and the basic conditional operation.

(Refer Slide Time: 24:25)

Now, we take another example where we can tell if symbolically we can give the
proposition then what the meaning of that logic or the meaning of that compound
proposition. Because this one as well as the reverse one is very important; that means,
giving one statement or one sentence written in English how we can denote logically or
we can denote with the symbols; that means, the proposition.

So, now we take one example. I write the example that let ‘s’, ‘t’, ‘u’ denote the
following primitive statements. Now, what are the statements? I write,

s: Amit goes out for a walk


t: The moon is out
u: It is snowing

Now, we see the symbolic compound statements using ‘s’, ‘t’, ‘u’ what is the meaning of
that compound proposition.

23
So, I write a symbolic compound statements give ‘(t ∧ ¬ u) → s’. So, ‘t’ is ‘the moon is
out’ and ‘¬ u’ is ‘it is not snowing’ as ‘u’ is ‘it is snowing’. So, ‘it is not snowing,' and
that implies ‘Amit goes out for a walk’. So, I can write that:

‘(t ∧ ¬ u) → s: If the moon is out and it is not snowing, then Amit goes out for a walk.

I take another compound proposition, say ‘(t → (¬ u → s))’. If I guide this thing, ‘t’
implies ‘¬ u’ implies ‘s’. So, I can write ‘¬ u’ means the, ‘it is not snowing’. So, if the
moon is out, then ‘t’ implies ‘¬ u’ implies ‘s’, then if it is not snowing, then Amit goes
out for a walk.

(t → (¬ u → s)): If the moon is out, if it is not snowing, then Amit goes out for a walk.

(Refer Slide Time: 30:09)

We see the third one, say ‘¬ (s ↔ (u ∨ t)). So, since it is negation, so, first I write it is not
the case. This is one type of that writing when we translate from symbolical logic to our
statements. Since it is negation, I write, ‘it is not the case’ and then symbol wise we start
writing. So, it is not the case that ‘s’ means the ‘Amit goes out for a walk’. Now, what is
the physical meaning of the biconditional proposition? It is ‘if and only if’ or ‘necessary
and sufficient conditions’. For a walk, that means, if and only if ‘u ∨ t’; that means, it is
snowing or the moon is out.

¬ (s ↔ (u ∨ t)): It is not the case that Amit goes out for a walk if and only if it is
snowing or the moon is out.

24
So, again I repeat for this particular symbolical proposition what we have done? Since it
is negation, first we have written that ‘it is not the case’. Then ‘s’ is ‘Amit goes for a
walk’. Then it is biconditional so, I give ‘if and only if’, then it is ‘u ∨ t’. ‘u’ is ‘it is
snowing’, and ‘t’ is ‘the moon is out’. So, we can just translate from symbolic logic to
our statements in English. And many times, the reverse is also necessary. Reverse
translation, that means, given statements how we can get the compound proposition.

Actually, in real life, these reverse translation is very much required because whenever
we will read the properties of propositions of the different operations then how logically
we can evaluate the truth values because finally, we have to find out whether our logic is
correct or not, true or false.

So, with these fundamentals of logic that are the basics of the logic with the operations,
the primitive propositions, and the operations negation, AND and OR, and that two
conditional propositions, the implication, and the biconditional. We have read how we
can evaluate one composite proposition, and we have also learned that given one
symbolic notation of proposition how we can write the statements in English. The
reverse is also very much necessary that we will read in the next class.

25
Discrete Structures
Prof. Dipanwita Roy Chowdhury
Department of Computer science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 03
Introduction to Propositional Logic (Contd.)

We have learned the Proposition and the operations on it, the conjunction, disjunction,
negation, and the two conditional proposition the implication and the biconditional.
Today, we will read or when can we tell the two propositions are same; that means, the
relation between two propositions. Now, the simplest relation between two propositions
are the equivalence, that means, given two propositions whether they are same or
whether they are different.

(Refer Slide Time: 01:07)

So, we first define the propositional equivalence. So, compound proposition that have the
same truth value for all the cases; that means, for all assignments of primitive
proposition. If the compound propositions have the same value for all the cases, I can tell
the assignments of primitive statements, then they are logically equivalent.

As I mentioned that, this is the simplest relation between two propositions, or two
statements. So, before we learn the equivalence between the different type of compound
propositions having the logical connectives of AND, OR, negation or the conditional

26
propositions. We define three basic terms, one is called the tautology. A compound
proposition which is always true, then it is called a tautology.

Now, if your compound proposition is always false, then it is called a contradiction.


Proposition which is always false, then it is a contradiction. And the proposition which is
neither a tautology nor a contradiction, that means, neither it gets a value true always or
false always, then it is called the contingency, neither a tautology nor a contradiction.

So, the simple example of tautology, very simple example: so, I have a proposition P.
Then if I consider P and I take the logical connectives the AND, or the conjunction with
negation P. So, P and negation P this is always false, because at a time the definition of
proposition is either it is true or it is false. So, either if P is true, then negation P is false.
So, true and false that will give me true AND false. That will give you the false
statement, that means, P AND negation P, this is equivalent to a false statement. This is
we denote as a F. So, always this will be a contradiction; this will be a contradiction:

p ∧ ¬p ≡ F

Similarly, if I consider the OR, now if I take the p OR negation p, then it is always true,
because either p is true or negation p, since if p is true and if it is negation p is false. So,
if one is true, then always it is true. So, it is equivalent to a true so, this is a tautology:

p ∨ ¬p ≡ T

Now, we formally define the equivalence, the propositional equivalence, we will define.

27
(Refer Slide Time: 09:57)

Suppose that we have two propositions P and Q, two compound propositions. And they
are made of the same set of primitive propositions p1 to pn. Let two compound
propositions; two compound proposition P and Q are made of a set of primitive
proposition p1, p2 to pn. We say that P and Q are logically equivalent. They are logically
equivalent according to definition that if any values of p1 and p2, that means, a set of
values of p1, p2 to pn , that P and Q have the same values either true or false.

Normally, we define or we denote the equivalence relation as P ≡ Q. Provided for any


given values of p1 , p2 , … pn , either P and Q are true, or P and Q are false, that means,
the for the same set of primitive propositions p1, p2, … pn that P Q have the same values,
either true, or false, then they are called the logical equivalence. Now, why it is
important? Because, we are considering that we are now we want to see the relation
between true statements and we want to check.

Now, the simplest thing if we can derive the one, say given two compound propositions
P and Q. If we derived P and we get that for some values of p1 to p2, P get the values
true, that means, if P, P is true for a given p1 , p2 , … pn values. Similarly, if we see that
Q is also true for the same values of p1 , p2 , … pn , the primitive proposition, then we can
take that P is equivalent to Q.

Now, instead of this true that P can also be P can be false also, then this time Q must be
false. Then we can tell that they are actually the same statements that means P and Q are

28
the same statements or we call that logically equivalent. Now, we will use this
equivalence relation to check that any other set of compound statements whether they are
true or what what actually the relation between them.

Now, the first relation we will see that it is some rule, it is called the De Morgan’s rule,
that actually gives a relation between the two compound proposition using the basic
operations or the logical connectives the conjunction, disjunction and negation.

(Refer Slide Time: 15:59)

So, first we see the De Morgan’s rule. So, what the rule tells, say suppose we have two
compound propositions P and Q. Let P and Q are two compound propositions. And the
connectives are the logical connectives between the primitive propositions. So, logical
connectives, we can write are the conjunction (∧), disjunction (∨) and negation (¬).

Now, the De Morgan’s rules tell that the negation of compound proposition P say can be
obtained by replacing, AND by OR, the OR by AND, and making each primitive
statements as the negation of that. Then what I can take say if P is p ∧ q, and Q is p ∨ q.
Here P Q, capital P Q are the compound propositions. And small p q are the primitive
statements or primitive propositions, basic propositions or the primitive statements.

29
(Refer Slide Time: 20:35)

Then De Morgan rule tells, so what it tells that the conjunction is replaced by
disjunction, disjunction is replaced by conjunction and the each primitive statement is
replaced by it is negation. So, if I take the negation P, that is equivalent to negation ¬ (p
∧ q) , since my P is the composite proposition that is the conjunction of p and q. So, this
is equivalent to the p will be replaced by a ¬ p this AND becomes the OR, Q becomes
the ¬ q:

(a) ¬ P ≡ ¬ (p ∧ q) ≡ ¬ p ∨ ¬ q

So, what will be my negation Q? Negation Q is equivalent to the p ∨ q and that will be
equivalent to ¬ p ∧ ¬ q.

(b) ¬ Q ≡ ¬ (p ∨ q) ≡ ¬ p ∧ ¬ q

So, De Morgan’s rule tells that the rule of negation. It is called the rule of negation. And
when we will be deriving or to make simplify the some compound propositions, then
always that it is very important to apply the De Morgan’s rule, so we will get the
different form using the primitive statements and it is negation.

Now, this is a rule. So, how we can prove that thing? First we see the (a). Now, we can
see the equivalence we have defined that they are equivalent if they take the same value
for all assignments. Since, here our primitive statements are only two p and q. So, we
will take all possible assignments of p and q and that we can do by using truth table.

30
The truth table for Proof (a)
p q p ∧ q ¬ (p ∧ q) ¬ p ¬ q ¬p∨¬q
T T T F F F F
T F F T F T T
F T F T T F T
F F F T T T T

So, we see the truth table. Now, we have the compound proposition P is p ∧ q. So, first
we compute p ∧ q then we have to find out the ¬ (p ∧ q). So, this is our left hand side.
Now, we find the ¬ p, ¬ q and then ¬ p ∨ ¬ q. And we see that what we get. p, q have
four values it can be T T, T F, F T, and F F. So, p ∧ q - this will be true, false, true, false.
The ¬ (p ∧ q) - so it will becomes false, true, true, true. Now, what is ¬ p? P is T T F F.
So, ¬ p is F F T T. ¬ q is, q is T F T F. So, ¬ p is F T F T. The ¬ p ∨ ¬ q , F ∨ F, it is F; F
∨ T, it is T; T ∨ F, it is T; T T, it is T. Now, if we see that our left hand side, that is ¬ (p
∧ q). So, this is F T T T. And this is our right hand side, that is ¬ p ∨ ¬ q, F T T T. So,
what we see that for all possible assignments of p q, when they are taken or both are true,
or both are false, or one true, one false, then we get actually that they are taking the same
true value, either when they are false, both are false, or both are true. So, it is actually
that the De Morgan’s rule or the (a) part is proved. So, they it is proved the De Morgan’s
rule it is proved.

(Refer Slide Time: 28:13)

Now, quickly we can see the (b) part; b is our compound proposition Q. Q is our p ∨ q.
So, what De Morgan’s rule tell that ¬ Q? ¬ Q is equivalent to ¬ (p ∨ q). And using De

31
Morgan’s if we compute the negation, it will be ¬ p ∧ ¬ q. Now, if we prove, then again
we can draw the truth table p q. Then this time it will be p ∨ q, then ¬ (p ∨ q), then this
¬ p , ¬ q and ¬ p ∧ ¬ q.

The truth table for Proof (b)


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

We take the both p, q are true, true – false, or both are false. If one is true, then p ∨ q is
true, it is true; only when both are false then they are false. So, when I am taking
negation, it will be false, false, false, only this case it is true. Now, similarly ¬ p is false,
false and this is in this case it is true; for ¬ q , false, this is true, this is false, this is true.
So, this is ¬ p ∧ ¬ q , so, it is false, this is also false, only this is true. So, again we see
this is my LHS; this is my RHS. And they are taking the same truth value for the same
set of primitive statements that is small p and small q. So, the De Morgan’s rule is
proved here ok so, it is proved.

(Refer Slide Time: 31:25)

Now, we see another form of or alternate form of logical or conditional propositions.


This is we call the contrapositive of a conditional proposition this is also very important,
when we will be evaluating some compound propositions. We know that conditional

32
proposition is that p → q; that means, if p then q; if p then q. Now, contrapositive is that
¬ q → ¬ p , contrapositive of p implies q is ¬ q implies ¬ p.

And converse of p ¬ q is q ¬ p. So, the difference between the contrapositive and the
converse is that for contrapositive this is a ¬ q implies ¬ p and converse is simply the q
implies p. This is also have often we use this thing for evaluating the compound
proposition not to simplify the compound proposition. And next we will see that how we
can use this thing for the equivalence checking.

33
On Discrete Structures
Prof. Dipanwita Roy Chowdhury
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 04
Introduction to Propositional Logic (Contd.)

So, we have defined the propositional equivalence, and the De Morgan’s law we have
read. Now, we see some more laws that are very useful to derive or to check the
equivalence between two compound propositions. So, first we see one theorem.

(Refer Slide Time: 00:46)

We continue the propositional equivalence continue. So, first we read one theorem,
though it gives a relation between the conditional proposition and the contrapositive of
the conditional proposition. So, the conditional proposition say p → q and its
contrapositive that is ¬ q → ¬ p are equivalent.

We prove by my truth table. So, if we draw truth table, p implies q, and then negation p,
or first we give that negation q because that will help us to write the truth values, then
negation q implies negation p all possible assignments of p and q. So, evaluate. If we
remember that we read in last class that what is p implies q if p, q both are true. So, this
is true, but true implies false we have taken these as a false result, remaining cases, they
are true.

34
Now, negation q, so this negation q becomes F, T, F and T; negation, p there F, F, T, T.
So, what is negation q implies negation F, F implies F, true; T plus F, again this is F; F T,
this is true. T T this is true. So, we see that p implies q takes the truth values T F T F.
And negation q implies negation p, T F T F that means both are taking the same truth
values for the same set of p and q values. So, they are equivalent. So, they are equivalent.
So, it is proved that they are equivalent.

The truth table for Proof


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

(Refer Slide Time: 05:20)

We take one example. If you fix my computer, then I will pay you rupees 500, then I will
pay you rupees 500. So, this is the compound proposition because this is a statement. So,
what are the primitive statements here? Primitive statements say I take p is you fix my
computer ok. And q is I will pay you rupees 500.

p : you fix my computer

q : I will pay you rupees 500

So, these statement, the example statement tells that p implies q. So, if it is my
compound statement P, then it is telling that p implies q.

35
P:p→q

Now, if I write that I will not pay you rupees 500, if you do not fix my computer. This
tells that it is negation q. So, it is ¬ q , implies if you do not fix my computer. Again if it
is do not fix, if you do not fix my computer do not that means, again it is ¬ p. So, if I tell
this compound proposition is ¬ q → ¬ p, then these two step statements are same that
means, P is same. So, P is equivalent to Q, that means, if you fix my computer then I will
pay you rupees 500 or I will not pay you rupees 500 if you do not fix my computer, that
are same that are logically equivalent.

P:p→q
Q:¬q→¬p
P≡Q

(Refer Slide Time: 09:09)

Now, we see the some other rules, we call that laws of logic ok. So, only one law we
have read that is De Morgan’s law. Now, we will see that there are many other similar
type of laws that we can apply on the compound propositions and the primitive
statements that makes this compound state propositions. So, first to it tabulate that this
type of laws or first we see that the law is the very primitive laws that we can tell that
the, it is double negation.

36
Since we know the De Morgan’s law by how to negative one compound statement, so we
write that negation of negation p is equivalent to p itself we call this is double negation.

1. ¬ ¬ p ≡ p

Now, already we have seen that single negation which is nothing but De Morgan’s law I
can write as follows:

2. ¬ ( p ∧ q ) ≡ ¬ p ∨ ¬ q
¬( p∨q)≡¬p∧¬q

Now, we see that these propositions follow the our basic algebraic laws the law of
algebra like commutative associative distributive laws, so that is why sometime we call
these are the laws of propositions ok.

So, first we see that it is it if I consider the connectives at the conjunction that means, p
AND q, this is equivalent to q AND p. Then p OR q this is equivalent to q OR p, this we
called our commutative laws:

3. p∧q ≡q∧p
p∨q ≡q∨p

Then associative:

4. p ∧ ( q ∧ r) ≡ ( p ∧ q ) ∧ r
p ∨ ( q ∨ r) ≡ ( p ∨ q ) ∨ r

So this is our associative laws. And here our p, q, r are primitive statements.

37
(Refer Slide Time: 15:20)

Now, we see we read some more rule. So, we read the associative to commutative and
associative, we see the distributive. We have p, q, r. So, we take p AND q OR r which is
equivalent to p AND q OR p AND r. Similarly, if we replace AND by OR and vice versa
or then this is similarly I get p OR q AND p OR r. So, these are my distributive laws.

5. p ∧ ( q ∨ r) ≡ ( p ∧ q ) ∨ ( p ∧ r )
p ∨ ( q ∧ r) ≡ ( p ∨ q ) ∧ ( p ∨ r )

Now, there are some other some more basic laws that we tell one is if I take p and in
conjunction with p itself, that means p AND p would take p AND p, then it is p only.
Similarly, if I take P OR P, it is p these two are called the rule the idempotent this is of
idempotent laws.

6. p ∧ p ≡ p
p∨p ≡p

Now, if I take the conjunction and disjunction with the true and false only that means if I
take the p OR F or p AND T, then also p OR F because we know that whatever the p has
the value true or a false, it will be it will take that value. So, it is p only. Similarly, p
AND T, this is again p. So, this is called the identity, this is our rule of identity.

7. p ∨ F ≡ p
p∧T ≡p

38
Now, we have some other rule, we call that inverse. So, if I take again the conjunction of
negation p, we have already seen that this will be false. If I take p on negation p this is
always true. So, these two our inverse rule ok.

8. p ∧ ¬ p ≡ F
p∨¬p ≡T

Now, I have if I take the p OR T, we will get always T we give p AND false, we get
always false. So, it is our domination loss. It will dominate the true and false always
dominate. So, this is our rule of domination.

9. p ∨ T ≡ T
p∧F ≡F

(Refer Slide Time: 20:08)

Now, another important is the absorption. This is very much required when we try to
simplify the compound proposition. So, absorption is that if I do the p OR p AND q, then
it is p only and p in conjunction with p OR q, then also it is p.

10. p ∨ ( p ∧ q ) ≡ p
p∧(p∨q) ≡p

Why, see here it is p OR. So, whatever be the value of this p AND q, it will take the truth
value of p. Similarly, here p AND p OR q. So, p OR q is p. Just the logic we give, and
then p AND p is p. So, this is the rule of absorption ok.

39
Now, we have seen the negation when we take negation in De Morgan’s truth that
proposition becomes the negation of that particular proposition and the conjunction
disjunctions they are actually exchanged. Now, one is called the dual and if that we dual
of proposition p. Normally, we denote this thing as pd.

Dual of proposition p : pd

So, here if how we define the dual if the proposition p contains only the logical
connectives AND and OR, and no other connectives are there, then the dual of p is
obtained by replacing or I can take by replacing AND by OR and OR by AND, then it is
dual. Please note that there is no negation concerned because my proposition contents
only the connectives AND and OR.

(Refer Slide Time: 23:58)

Now, we have read the laws and now applying these laws, how we can check whether
the two compositions are compound statement propositions are equivalent or not. So,
first we see one conditional proposition, the equivalence of the conditional propositions.
The equivalence of conditional proposition, the conditional proposition we know that p
implies q. And if p implies q that it is equivalent to negation p or q, this is one. I can
write that negation of q is equivalent to p; and negation q this is nothing but if we apply
the De Morgan’s law on both the side.

1. p → q ≡ ¬ p ∨ q
2. ¬ ( p → q ) ≡ p ∧ ¬ q

40
So, how we can prove that thing if we try to prove always we will prove by making the
truth table. So, we draw the truth table we take all possible assignments as usual then p
implies q it is true only this is false, true, true. Now, negation p is false, false, true, true.
Now, negation p or q, so this is my negation p and OR q, so T OR F, this is T; F OR F
this is only F; T or T, T F T this is T. So, if we see p, p in condition p implies q and
negation p OR q and they have taking the same two values. So, it is proved.

The truth table for Proof


p q p→q ¬p ¬p∨q
T T T F T
T F F F F
F T T T T
F F T T T

And in the second case if we just apply for two, if we apply De Morgan’s laws, then the
left hand side that it is p implies because already we have proved that p implies q is
equivalent to negation p OR q. Now, you apply De Morgan this is negation of p OR q.
So, this is equivalent to negation of negation p, q this is negation of negation p AND
negation q. Negation of negation p is p only double negation rule, and this is p implies p
AND negation q which is the second one. So, it is also proved.

p→q ≡¬p∨q
¬(p→q)≡ ¬(¬p∨q)
≡ ¬¬p∧¬q
≡p∧¬q

So, this is equivalence of conditional proposition that is that we consider the implication.

41
(Refer Slide Time: 29:08)

Now, we see that if we consider the equivalence of biconditional proposition. So, we


know our biconditional proposition is if p AND q, two proposition, it is if and only if q if
and only if p. Now, we give that biconditional proposition is equivalent to p implies q,
and q implies p.

p ↔ q ; q if and only if p
1. p ↔ q ≡ ( p → q ) ∧ ( q → p )

Then the proof will be we take all possible assignments, then it is biconditional if p then
an if q if and only p, or if p only if only if q. So, whenever both are taking the same
assignments then only it is true. So, T T – true, F F – true, and the remaining cases it is F,
we know p implies q is T F T T. q implies p, so it is T T F T and this is and. So, T T T F
T F T F F, and this is T. So, again you see that this is biconditional. So, our LHS that it is
T F F T, and the RHS this is T F F T, that means, these are equivalent. So, there it is
proved; they are proved.

The truth table for Proof


p q p↔q p→q q→p (p→q)∧(q→p)
T T T T T T
T F F F T F
F T F T F F
F F T T T T

42
(Refer Slide Time: 33:14)

Now, what we have seen that to equivalence of two conditional proposition, one is p
implies q is equivalent to negation p OR q. And p biconditional q is equivalent to p
implies q AND q implies p.

1. p → q ≡ ¬ p ∨ q
2. p ↔ q ≡ ( p → q ) ∨ ( q → p )

Now another is their substitution rule that means, if substitution is see for we take that p
AND q is the small p it is equivalent to r conjunction s. And q is, say u OR negation t
then in one what we can do that some by substitution rule that p implies q this can be
equivalent to the if instead of p, I can write s r AND S, then r instead of q, I can write
that u OR negation t. Here, here p q as well as r s u t are the propositions ok.

p≡r∧s
q≡(u∨¬t)
p → q ≡ ¬ (r ∧ s ) ∨ ( u ∨ ¬ t )

So, I can write it actually if I can take that p is same as that of r and s, then of this
substitution we can apply. So, in this way, similarly we can apply the equivalence of the
biconditional a proposition also and we can evaluate the compound propositions for it
and we can simplified, and then we can check whether two propositions are equivalents
or not. Now, we give an example that how the laws of logic can be applied to simplify
the compound proposition.

43
(Refer Slide Time: 36:54)

Take one example, simplify the compound proposition P which is (p ∨ q) ∧ ¬ (¬ p ∧ q ).


Here p, q are primitive statements. So, we start from the given compound proposition P
and we apply the laws of logic.

P : (p ∨ q) ∧ ¬ (¬ p ∧ q )
≡ (p ∨ q) ∧ ¬ ¬ p ∧ ¬ q ; De Morgan’s law
≡ (p ∨ q) ∧ (p ∧ ¬ q ); Use of Double Negation
≡ p ∨ ( q ∧ ¬ q ) ; Distributive Law
≡ p ∨ F ; Inverse Law
≡ p ; Identity

So, my compound proposition that capital P becomes only the primitive statements p,
this is simplified to small p. P is simplified to small p. So, it is simplified. So, this
examples tells that how the laws of logic that we have read the different laws that can be
applied to simplify the compound propositions. So, now we can conclude this lecture
with this example.

44
Discrete Structures
Prof. Dipanwita Roy Chowdhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 05
Introduction to Propositional Logic (Contd.)

We have read the laws of logic, the propositional equivalence. And today we shall begin
the formal study that how we can use the implication to valid that one or to check the
validity of the propositions. Or in other way, we can tell that given an argument whether
that argument is valid or not by using the implication whether we can tell that thing.

(Refer Slide Time: 01:03)

So, it is the logical implication, which formally we can tell that finally we will be giving
some rules of inferences. So, let us consider one implication the general form of
implication. Let our p1, p2 to pn, these are primitive statements and the conjunction of
these n primitives this implies q.

( p1 ∧ p2 ∧ … ∧ pn ) → q

We call that, this is an argument argument. Now, whether this argument is valid or not.
Now, one thing is that why we will be reading this thing, what is the importance of the
validity of the arguments? Because our main objective is that to give some mathematical

45
proofs. So, when this logic will be applying to prove theorems, so that time will be seen
that given one argument or given some compound propositions whether it is valid or not.

So, if we explain this implication or the argument, what we see that we have n number of
(n is a positive integer) n number of primitive statements say p1 to pn. Now, since they
are logically connected with the connectives and that is conjunction, they are connected
with the connectives AND is the logical connectives.

So, if each of the pi is that means, each of the primitive statements p1 to pn they are true,
then the left hand side will be true, since it is a conjunction, and then q will be true. So, if
each of p1, p2, … pn is true (T), then q is true, q is true (T). So, this is valid. When it will
be invalid or even if we consider the so it is we remember that the implication truth table
that p implies q that if it is these are p, q, then result is true. It is T F, then it is false; if it
is F T, then it is true; if it is F F, then it is true. So, only this is the case (p is true and q is
false) where it will be giving a false result, it will be giving a false result ok.

The truth table of p → q


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

Now we see that when it will be giving a false result that means, if any one of p1 to pn is
false, since they are connected with the conjunction AND, so then also q is true. Why,
because the left hand side becomes F, and F implies T, if q is true, then this is actually by
default it will be true that is it is vacuously true, or by default it will be true. So, we have
to check the validity of the argument; that means, if we see that what the conditions are
on what cases that the argument is always true. Last day, we have read that if the result is
always true, or if we see the compound proposition is always true for all the assignments
of its primitive statements, then it is actually a tautology.

46
(Refer Slide Time: 07:38)

So, one way of establishing the validity of the argument is to show that the implication
that is general form that ( p1 ∧ p2 ∧ … ∧ pn ) → q is a tautology. And we can tell that then
it is a valid statement or this compound proposition is valid ok. So, we take one example.
Let p, q, r denote the following propositions, what are the propositions, see:

p : Amit studies
q : Amit plays football
r : Amit passes discrete structure course

Now, we take three compound propositions, let be denoted by capital P, capital Q and
capital R.

47
(Refer Slide Time: 11:27)

Now, may write those the statements of the compound proposition. See:

P : If Amit studies, he will pass in discrete structures


Q : if Amit does not play football, then he will study
R : Amit failed in discrete structures course

Now, we have to determine whether the following argument is valid, that means, the
argument we write in the our conventional form that

(P∧Q∧R)→q

Now, these are the compound propositions, and when they are connected with the logical
connectives, conjunction which implies q, and q is the Amit plays football. So, we have
to check this thing.

Now, last lecture, we have learned the substitution law. So, we can apply this
substitution laws here, that means, before that we write the compound propositions in
terms of our primitive statements. So, what is P? P is “if Amit studies, he will pass
discrete structures” Amit studies is small p. So, small p implies r because r is Amit
passes discreet structure course

P:p→r

The compound proposition Q is “if Amit does not play”; that means, negation q, “then he
will study” it implies he will study means it is p, because Amit studies is small p.

48
Q:¬q→p

Then what is R? R is “Amit failed in discreet structure”. So, Amit passes that was the
primitive statement small r, so Amit fail, so it will be negation r.

R:¬r

So, now, we replace the capital P, Q and R. So, if we start with the compound
propositions connected by the conjunction. So, it is equivalent to p we write small p
implies r then AND q is negation q implies p r is simply negation r.

( P ∧ Q ∧ … ∧ R ) ≡ ( p → r ) ∧ (¬ q → p ) ∧ ¬ r

Now, we can apply our laws of logic here to simplify to check the validity of the given
argument. So, we apply the commutative thing. So, we can write p → r, I can take
negation r first and then ¬ q → p.

(P ∧ Q ∧ R) ≡ ( p → r ) ∧ (¬ q → p ) ∧ ¬ r
≡ ( p → r ) ∧ ¬ r ∧ (¬ q → p )

So, we will continue to next page.

(Refer Slide Time: 17:11)

This is equivalent to ( p → r ) ∧ ¬ r ∧ (¬ q → p ). So, we have write our Commutative


law ok. Now, what is p → r? Last day we have seen that it is with the propositional logic

49
this is becomes the p → q is equivalent to ¬ p ∨ q. So, I can replace this is p → r. So, this
is ( ¬ p ∨ r ) ∧ ¬ r. And similarly I can apply here also the implication that ¬ ¬ q, so this
becomes because ¬ ¬ q ∨ p. So, it is equivalence of implication.

Now, I can associative law we can apply. So, ¬ p ∨ ( r ∧ ¬ r ) we can apply ( r ∧ ¬ r ).


Double negation, so, this becomes (q ∨ p ). So, here we have applied two rules; one is
our associative; second is double negation. Now ( r ∧ ¬ r ) this is always F. So, (¬p ∨ F),
now this becomes ( q ∨ p ). So, now, this is equivalent to since it is OR, so this becomes
¬ p. And here also I can apply ( q ∨ p ) is same as (p ∨ q ) ok.

So, similarly we can apply that here ( r ∧ ¬ r ) is equivalent to F. And here some
commutative.

So, this becomes again associative ( ¬ p ∧ p ) ∨ q, or just now we have use that (¬ p ∧ p)
is F; ( F ∨ q ). So, this is equivalent to q. So that (P ∧ Q ∧ R) → q that is it is valid.

(P ∧ Q ∧ R) ≡ ( p → r ) ∧ ¬ r ∧ (¬ q → p ); Commutative Law
≡ ( ¬ p ∨ r ) ∧ ¬ r ∧ (¬ ¬ q ∨ p ); Equivalence of Implication
≡ ¬ p ∨ ( r ∧ ¬ r ) ∧ ( q ∨ p ); 1. Associative, 2. Double negation
≡ (¬ p ∨ F ) ∧ ( q ∨ p ); ( r ∧ ¬ r ) ≡ F
≡ ¬ p ∧ ( p ∨ q)m; Commutative
≡(¬p∧ p)∨q
≡F∨q
≡q

(P ∧ Q ∧ R) → q is valid

Now, to check the validity, we have used the propositional equivalence as well as the
laws of logic. Now, today we will see that whether we can still simplified or a group of
laws of logic can be combined to apply the or to check the validity of the argument that
means mainly the implication, because our argument validity of argument we have
defined whether some implication is a tautology or not or it is valid or not. So, here we
have seen using the laws of logic. Now, if we remember the definition of tautology that
our final result or the truth value of the compound proposition that should be always true.

50
(Refer Slide Time: 23:50)

So, the same thing we see that our compound proposition was that ( P ∧ Q ∧ R ) ≡ ( p →
r ) ∧ (¬ q → p ) ∧ ¬ r. Now, we see that whether it is a tautology or not whether. So, we
do the truth table and see the thing. We make the truth table. So, we have three primitive
statements p, q, r ok. If it is a tautology, then we have to write in a different way that we
can write that ( p → r ) ∧ (¬ q → p ) ∧ ¬ r whether this implies q, this we have to check.

So, I need ( p → r ), then I need ¬ q, so that we can compute (¬ q → p ), then I have ¬ r,


then I can calculate that ( p → r ) ∧ (¬ q → p ) ∧ ¬ r. And then if I mark this thing as a S
say I apply this S : P ∧ Q ∧ R. So, this is S, then whether S → q. So, I take all
assignments; I take. So, I take all assignments of p, q, r. We know that ( p → r ); that
means, this T implies, T is true; T implies F only this is false. Again this is true again T
implies F it is false then all it is F, so all are vacuously true. So, if p is F, I can directly
write these are all true.

Now, I have ¬ q. So, ¬ q is F T, then again F T. ( ¬ q → p ). So, negation q this is F,


whenever these two are F, it is vacuously true now T T. So, they are true. Again this is
vacuously true. And then again these two are false. What is ¬ r? ¬ r is F T F T F T F T.
So, if I take the, AND of ( p → r ) , (¬ q → p ) and ¬ r, because this will give me that S, it
will give me the S. So, S is T T F. So, this becomes F. Again, this is F 1 F means it will
be F again this is T T F it is F F, T, T, F, T, T F, it is F. T, T, T, this is only true T, F, F, F
and T, F, T, again it is F.

51
So, S implies Q. Now, see this is S, and except this one, all cases it will be vacuously
true. So, except these where S implies q, q is here this T and this is also T. So, this
becomes true. So, I can write this becomes this becomes true, and or remaining cases
since my S is all F. So, that S to q, that means, this becomes always vacuously true, these
are all vacuously true. So, remaining all cases, it will be, it will be true.

The truth table of the proof


p q r p→r ¬q ¬q→p ¬r S:P∧Q∧R S→q
( p → r ) ∧ (¬ q → p ) ∧ ¬ r
T T T T F T F F T
T T F F F T T F T
T F T T T T F F T
T F F F T T T F T
F T T T F T F F T
F T F T F T T T T
F F T T T F F F T
F F F T T F T F T

So, what we see that S → q, this is a tautology because it is taking the truth value always
true. So, earlier that with the same example using the laws of logic we have validated the
compound proposition, and now with this truth table method what we have seen that S
implies q is a tautology. So, the argument is valid. So, this is a valid argument, this is a
valid argument.

Now to check this valid argument, we will try to frame the laws of inferences, so that our
validity of the proposition of argument or to check the compound propositions, the
conditions or the properties will be much easier. So, we will now see that how these laws
of logic can be used to combine a set of logic to one laws of inference.

52
Discrete Structures
Prof. Dipanwita Roy Chowdhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 06
Introduction to Propositional Logic (Contd.)

Today, we will read the rules of inferences. What are the rules of inferences? We have
read the laws of logic. We have seen that how the validity of one argument is checked by
using the laws of logic and the propositional equivalence. Now, we will see that to check
the validity of arguments when more than one laws of logics are used, then whether we
can combine together and to frame a new rule which is more compact or very easy to use
for the validity.

(Refer Slide Time: 01:19)

So, we can define that in laws of inference is nothing but the compact form of laws of
logics and we can define or this compact form so that it is much easier to apply on the
compound propositions to simplify or to validate the arguments. So, in turn that will be
much easier when we will apply the logic to prove some theorems ok.

So, we take first one example. Take one, we take one example. Say, we have
propositions, primitive propositions p, q, r; the primitive propositions; and we have two
compound propositions let capital P is p only and compound proposition Q is p → q.

53
P:p
Q:p→q

Then, we want to check the validity.

Check the validity of the argument the [p ∧ (p → q)] → q or not.

So, we can do in two ways; one method is by using the truth table. The truth table, we
will check whether it is a tautology or not.

Second method we can apply by applying the laws of logic more than one and we can
say that whether these implication is true or not or these LHS that the left hand side, I
can tell that compound propositions. Compound proposition simplified to q or not. So,
these are the two ways, we can tell that whether it is valid or not. So, we see by the first
method that by truth table.

(Refer Slide Time: 05:51)

So, our example is, continued is [p ∧ (p → q)] → q , whether it is a tautology or not. We


draw truth table here only there are two primitive statements. So, we give p q, we require
p → q and p ∧ (p → q); then, [p ∧ (p → q)] → q. We take the truth values of p and q, T
T, T F, F T and F F. Then, p → q; p → q is, it is T T so, it is T; other than this, this is
only false these are all true. Now p ∧ (p → q). So, T ∧ T, this is T; T ∧ F, so this is F; F ∧
T, this is F; F ∧ T, this is F.

54
Now, if I tell this is my, say it is something called a compound proposition A; that
means, these gives whether A → q or not. So, I will check A, and I will check q ok; A
and q. So, these implies q so, T T so, it will give me the true value; then, F F, true; F all
are F so, these are all vacuously true. Once that p → q, p is true; A → q, A is false. Then,
it is actually by default that implication is true. So, what we see that this is a tautology,
this is a tautology.

The truth table for the proof


p q p→q A: A→q
p ∧ (p → q) [p ∧ (p → q)] → q
T T T T T
T F F F T
F T T F T
F F T F T

Now, the second method; quickly we can do because it is much easier, then truth table
because we have to apply the laws of logic. So, laws of logic we can apply p ∧ (p → q).
This is equivalent to p and since, now we know that (p → q) is (¬ p ∨ q). Now we apply
the associative rule (p ∧ ¬ p) ∨ q; (p ∧ ¬ p) is F; (F ∨ q) so, which is q only; which is q
only. So, here also we see that my compound proposition on a left hand side is actually
simplified to q so, it is a valid argument.

p ∧ (p → q) ≡ p ∧ (¬ p ∨ q) ; equivalence of implication
≡ (p ∧ ¬ p) ∨ q ; associative
≡F∨q;
≡ q ; absorption

Now, see here we have applied 3 laws of logic; one is my equivalence that equivalence
of implication this is one equivalence of implication. One is the associative. So, this is
equivalence; equivalence of implication. It is associative and this is our absorption (F ∨
q) is q only. So, these three together we can tell that this is the name is that the Modus
Ponens. This is the rule of inference is called the Modus Ponens.

So, instead of applying separately, the equivalence, associative law, the absorption
together we made one laws of inference. So, now onwards instead of applying separately
these thing, we will be using the Modus Ponens. Next we see another example.

55
(Refer Slide Time: 12:33)

Now, we take the compound proposition that ¬ q ∧ (p → q) → ¬ p. As usual p, q are


primitive statements. Now, we see that truth table, again, if we write p q; then, I need ¬q.
So, I write that I need p → q. I write, I need ¬ q ∧ (p → q). Then, together the final
implication; the ¬ q ∧ (p → q) → ¬ p ok. I need a ¬ p also, ok. Directly I can write from
here. So, we give T T, T F, F T and F F.

Now, ¬ q so, this will be F T F T, p → q, T T, T; F T T. ¬ q ∧ (p → q), so F F F only this


one will be T. Now, this implies ¬ p. So, p is T so, negation is F. So, F F, it is T. Again
F, so all three F’s, directly I can write vacuously true; directly it can write true. This p, so
this ¬ p will be, here the ¬ p is true. So, T T and T this will be true. So, again we get that
this is a tautology, this is a tautology.

The truth table for the proof


p q ¬q p→q ¬ q ∧ (p → q) [¬ q ∧ (p → q)] → ¬ p
T T F T F T
T F T F F T
F T F T F T
F F T T T T

So, this rule, we tell that Modus Tollens, and using logic, we can directly prove that
thing, quickly we do. This is p → q so, this is equivalent to ¬ q ∧ (¬ p ∨ q). The (¬ q ∨
q), this will be, sorry this is the AND; this is AND so, I can give (¬ q ∧ q), this can be
commutative, ∨ ¬ p which is equivalent to (F ∨ ¬ p) which is equivalent to ¬ p.

56
¬ q ∧ (p → q) ≡ (¬ q ∧ (¬ p ∨ q))
≡¬q∧q∨¬p
≡F∨¬p
≡¬p

So, again that we can combine all these rules and we make it Modus Tollens. So, the
combination of the propositional equivalence along with a set of laws of logic, we frame
some laws of inference. That means, which will be checking the validity of some
implication or whether the implication is a tautology or not. Now, we enlist these rules.
How many such rules are there?

(Refer Slide Time: 17:55)

So, we take the rules of inference. The related logical implication that we write here and
the name of rule like the last two examples we have seen, the Modus Tollens or Modus
Ponens, we have given. So, we give some numbering.

Rules of Inferences
Sr. No. Rule of Inference Logical Implication Name of Rule
p
Modus
1 p→q [p ∧ (p → q)] → q
Ponens
∴q
¬q
Modus
2 p→q [¬ q ∧ (p → q)] → ¬ p
Tollens
∴¬p

57
p→q
Hypothetical
3 q→r [(p → q) ∧ (q → r)] → (p → r)
Syllogism
∴p→r
p∨q
Disjunctive
4 ¬p [(p ∨ q) ∧ ¬ p] → q
Syllogism
∴q

The first one, we have seen the [p ∧ (p → q)]. This is the convention of writing that
therefore, the result is q. The result is q. And what was the logical implication? Logical
implication is the nothing but the compound proposition that implies the finest result. So,
it is the p and, because I have two compound proposition; one is the simple one that
small p only and (p → q) that implies q and name of rule, we have already seen this is
called the Modus Ponens.

We have seen the 2nd one; the [¬ q ∧ (p → q)] that results ¬ p. So, logical implication is
[¬ q ∧ (p → q)], this results implies ¬ p, it is called the Modus Tollens.

Now, give the 3rd rule as if (p → q), this is one proposition and (q → r) another
proposition; then, therefore, (p → r). So, it tells [(p → q) ∧ (q → r)] → (p → r) and the
name of rule is hypothetical syllogism this is hypothetical syllogism.

Now, the 4th rule tells the [(p ∨ q) ∧ ¬ p]. It gives therefore q only. So, you can write [(p
∨ q) ∧ ¬ p] → q and the name of the rule is disjunctive syllogism.

This is now we have some more rules. Just do that thing.

58
(Refer Slide Time: 24:29)

Rules of Inferences
Sr. No. Rule of Inference Logical Implication Name of Rule
p
5 p → (p ∨ q) Addition
∴p∨q
p∧q
6 [p ∧ q] → p Simplification
∴p
p
7 q [(p) ∧ (q)] → (p ∧ q) Conjunction
∴p∧q
p∨q
8 ¬p∨r [(p ∨ q) ∧ (¬ p ∨ r)] → (q ∨ r) Resolution
∴q∨r

Again, rule of logical implications which are related to the inferences on the name of the
rule. So, we have, these are very simple that if p; that means, if p is true, then p ∨ q is
true. So, logical implication is simply p → (p ∨ q) and the name is addition. Since, the
disjunction or, OR is called the addition.

Now, we apply the simplification; that means, if p and q is true, then either p or q, I write
p it can be q also. So, I can write [p ∧ q] → p. This is simplification. See this rule is very
important because we have two primitive statements and that implies only one primitive
statement. So, by when we will do the simplification, these rule is very important.

Then, you have some conjunction that if p and q; therefore, p ∧ q. So, p and q, this is
obvious this is actually gives me p ∧ q. So, I should give this thing because, we know the

59
substitution rule that means, small p, q can be actually a compound proposition also, ok.
So, this is my conjunction.

This rule is very important this is called the resolution so, to simplify the compound
proposition, these rule is very important. This is some disjunction of (p ∨ q) and (¬ p ∨
r). It gives the result that (q ∨ r). So, I take the primitive statement p in disjunction with
another primitive statement q and negation p and disjunction with another primitive
statement r. Then, they are actually related the other two q and r, they are actually related
with the logical connectives, the disjunction. So, it the logical implication, I can write [(p
∨ q) ∧ (¬ p ∨ r)] → (q ∨ r) and this is called the resolution; this is called the resolution.

So, these are my eight rules of inferences. This is the rules of Inferences that we can
apply directly when we will try to simplify the compound proposition or we will see the
examples later that we will now we will try to prove some theorems. Then instead of
applying the simple laws of logic that we can apply these rules of inferences. But one
thing whenever we will be applying these rules of inferences, we have to mention that
which rule we are using here and that is much easier.

(Refer Slide Time: 30:23)

So, we have to remember the name of the rules and then whenever say if we apply the
sum (p ∨ q) and (¬ p ∨ r) is implies say in if I give that (p ∨ q) ∧ (¬ p ∨ r) → (q ∨ r).
Then, I have to mention that it is the application of we are applying the resolution; we
are applying resolution.

60
So, here if we remember that if I think that this is small p this is my q, then p → q. So,
this is (p) my hypothesis or we can tell premises and this is (q) conclusion. So, some
hypothesis are given and from these hypothesis, what we can conclude whether we get
the conclusion and by using what rule of inferences that we have to mention as a reasons
for simplification. Like we have to write that these are the reasons for simplifications.

And we will do the examples next day. Then, we can write properly and we will see that
how we can apply these rules of inferences and what are the formal way of writing these
hypothesis conclusion and then, the simplification applying these rules of inferences.

61
Discrete Structures
Prof. Dipanwita Roy Chowdhury
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 07
Predicate Logic

Today, we’ll read the Predicate Logic. We have read the Propositional Logic and
Predicate Logic. We define that it is nothing but an extension of propositional. And
mainly, the propositions or the statements that the propositional logic fails to handle
predicate logic can handle those things.

(Refer Slide Time: 00:51)

So, we will read Predicate Logic. It is an extension of Propositional Logic. In Predicate


Logic, we have everything that we read in Propositional Logic. So, what we have in
Propositional Logic? We have propositions like p, q, r, s which are nothing but the
declarative statements either true or false and we have logical connectives that AND (∧),
OR (∨), NOT (¬). We have some conditional implication like if then (→) and if and only
if (↔) that is by conditional.

Now, we have these propositions logical connectives and conditional implications.


Moreover, we have the ability to attribute properties and relationships on things or
variables. Over this, we have the ability to attribute the properties and relationships on
things and variables. Now, these propositional logic that we read have some limitations.

62
(Refer Slide Time: 05:19)

The Limitation of Propositional Logic: See propositional logic discusses about the
propositions or the statements which is either true or false; but it is incapable of some
statements which are normally used in mathematics or computer science and the
predicate logic will handle this type of statements. The propositional logic fails to handle
those thing. So, first we see what type of statements that propositional logic are
incapable to handle.

We take first an example. See in computer science and mathematics, we use variable.
Most of the statements involve variables and the propositional logic that we read or
discussed earlier that they cannot handle the statements involving variables. We take one
example; we see one simple statement like:

p : n is an odd integer

Now, this statement is neither true nor false. So, this is not a proposition.

So, what? Propositional logic cannot handle this type of statements or this logic
involving these statements. Why? Because n is an odd integer. So, if n = 11, then it is
true; odd integer. But n can be 10 or 110. Then, it is false. So, what is n? So, n is an odd
integer; n can take any value. So, we call that n is a variable. So, the statements involving
variable cannot be handled by propositional logic and for this, we need an extension of
the logic of systems.

63
(Refer Slide Time: 10:01)

So, we need extension of logic of systems that can handle the statements involving
variables.

So, first we define predicate. Let P(x) is a statement involving the variable x, and D is
one set such that x can take values from the set D. Now, if for each x in D, P(x) is either
true or false, then we call P(x) as the Predicate. Here, P is the propositional function, but
not a proposition. But P(x) is a proposition. Since P(x) can be true or false, and x takes
the value from the set D. Here, the D is called the Domain of discourse. Here, D is called
the Domain of P. See P is the propositional function. P is not the predicate. P(x) is the
predicate and x can take the value only from the set D.

So, we define predicate like that.

64
(Refer Slide Time: 15:31)

Now, what I mentioned that the predicate or the propositional function the P, when takes
the value x from the set D that actually defines the predicate P(x). So, x is here a variable
that can take the value from D. Now, in computer science and in mathematics whenever
the statements we are dealing or the statements involving the variable.

So, we use the term that variable can be “for every variable”, “for every” or “for each
variable” some statement are told, or “for some variable” the statement can be told. That
means, here these “for every variable” or “for some variable”, the statements are
normally mentioned. So, how we can handle this type of statements where the variables
are either for all variables or for some of the variables, or for some of the values of the
variables.

Now, based on these two types of statements, we define that two types of predicate logic
and they are normally called the Quantifiers. So, quantifiers are normally of two types.
One is called the Universally Quantified Statements; that means, those statements they
involve “for all” or “for each” every like that, or Existentially Quantified Statement
which involve “for some”.

Now, we define the universally quantified statement or existentially quantified statement


or the first the universal quantifier or the existential quantifier. First, we see the
Universal Quantifier.

65
(Refer Slide Time: 20:13)

Normally, we denote this thing by ∀. So, ∀x, this is called for all x, here x is the bound
variable. How we define?

So, we define the quantifier ∀x like ∀x P(x) can be either true or false because the P is
the propositional function, but P(x) is the proposition. So, P(x) is either true or false. So,
how we define that for all x P(x) is true, if for every x in D (because x can take value
from the set D) the proposition P(x) is true; for all x if for every x entry the P(x) is true.

We write this in symbol that which you can write that ∀x P(x) is true. Here, x is the
bound variable. We have defined, this is bound variable; and x in P(x) is called the free
variable. When, P(x) is false; so, for all x P(x) is false if for at least one value of x in D,
the proposition P(x) is false. How we write? So, we write similarly that ∀x P(x) is false.
We take one example.

66
(Refer Slide Time: 25:43)

Let one example is that, we write that ∀x (x2 ≥ 0); you take ∀x, and D is the Domain of
discourse. So, one thing is very important that whenever we will be handling some
statements with variables or the predicates, then that we must mention the domain of
discourse. That means, the set of elements from where that the variable x can take the
value. This is very important, because for these, using these values only or depending on
the values of D, the statement can be a proposition, can be either true or false.

So, if here D is the domain of discourse and here, D is set of real numbers. So, x can take
any real numbers. So, for all real numbers; that x can take the value, we know that x2 ≥ 0.
It can never be negative. For x = 0, it is 0; and for all other values, or for remaining
values x2 ≥ 0. So, the way we define; that means, ∀x (x2 ≥ 0), this is our P(x), this is true.

67
(Refer Slide Time: 29:23)

Now, if I slightly change this example like ∀x P(x), which I am telling that ∀x (x2 –1 >
0); and D is the set of real numbers. Now, we know that for x = 1, x2 - 1 = 0, which is not
greater than equal to 0. So that means it is false.

So, P(x) is false for at least one value of x, say x = 1. Say, for x = -1, also this is true. But
if we can identify only one value of x and for that my P(x) is false, then we will tell that
it is false. So that means, that ∀x P(x) ≡ ∀x (x2 – 1 > 0) is false.

Now, if we consider the Existential Quantifier.

68
(Refer Slide Time: 32:01)

So, we define the Existentially Quantified Statement, normally we denote as ∃x P(x). So,
here similarly we can tell that ∃x P(x) is true if for at least one value of x in D, P(x) is
true. And ∃x P(x) is false, if for all values of x in D, P(x) is false. Example, we take one
example. Say the statement is, one statement we make. For some prime n; n + 1, n + 2, n
+ 3, n + 4 all are composite.

Now, if we take that this is my statement, the P(x). Now, we have to identify or we have
to find out at least one such prime n, for which this is true; then it will be true. But if we
want to show that this statement is false, then for all prime we have to show that this is
false. So, for this example, we can identify, we can find out one prime value n is 23, for
which the n + 1, n + 2, n + 3, n + 4, which are 24, 25, 26, 27 all are composite. So, we
get one value of at least one prime, we can find out for which this is true.

69
(Refer Slide Time: 36:25)

So, ∃x P(x) is true for one value of n = 23. So, these existential quantified statement is
true and obviously, here the D we have taken as the positive integer, D is positive
integer.

So, we learned that; what is predicate logic; what is the difference from the predicate
logic and the propositional logic and the 2 quantifiers that existentially quantifier and the
universally quantifier and how to find the truth values of the statements. That means,
whether the statement is true or false.

So, with this the basics of Predicate Logic we learned.

70
Discrete Structures
Prof. Dipanwita Roy Chowdhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 08
Predicate Logic (Contd.)

(Refer Slide Time: 00:17)

We have read the Predicate Logic and the two quantifiers, the universal quantifiers and
the existential quantifiers; and mainly how we can find the truth values of the statements
using this two quantifiers. Now, we read the generalized predicate logic and the De
Morgan's law. So, today we see that generalized predicate logic. First we will see that
how the same statement can be represented using the existential quantifier as well as they
using the universal quantifier, or whether at all it is possible. So, first we see one simple
example we take one simple example, like say, ∃x (x/(x2 +1) ≥ 1). Say this is one
existentially quantified statement and x can take the value from the set D; that means, D
is the domain of discourse which you can take some positive integers. So, D are the
positive integers.

Now, since it is an existentially quantified statement. So, if we get one such x for which
is x/(x2 +1) ≥ 1 then the statement is true. Now, for any positive integers since x takes
any value; x takes value from D, so, for all values of x in D, this x/(x2 +1), we know that

71
never it is greater than 1, because (x2 +1) > x for positive integers, for all x. So, for all
values of x, this is false. So, these existential quantified statement is false.

Now, we have seen that for all values of x this is not true, this is false. So, then if I just
invert this thing, or we can take ¬ (x/(x2 +1) ≥ 1). So, what is that? That is equivalent to
that x/(x2 +1) < 1.

So, now can we check this thing that what happened for all values of x, this x/(x2 +1)< 1.
Now, since it is the universal quantifier ∀x, so, if we have to show that it is true then for
all values of x in D, this should be true. Now, see that this is the negation value, and we
see that for any value of x, or any value of x in D, this is true x/(x2 +1) < 1. If we
consider that x equal to 0 then it is also less than 1. Then we can tell that it is true; that
means, for x in D, this is true.

Now, see that, this is nothing, but the negation of the statement and ∃x, what I have
earlier, we have given ∃x P(x) and here, this is for we have taken ∀x ¬ P(x). Now, we
can write, the same P(x), the propositional function using the existential quantifier or
using the universal quantifier; but obviously, that it will be the totally reverse or the
negation. Here it will be the statement, it will tell either it is true or it will be false.

(Refer Slide Time: 08:41)

So, what we can tell from these simple example, we can think that ∃x and, or I should
write ∃x P(x) and ∀x P(x) the relation, or they are connected, or the relation between

72
these two, ∃x and ∀x, one negation is involved. Since in the last example what we have
seen that x/(x2 +1) ≥ 1 and the negation is that x/(x2 +1) < 1, and then we can write if one
is written using ∃x then another we can write a using ∀x.

Now, how to find negation? Already we have read to find negation we use the De
Morgan's law that we have used in our propositional logic. Now, here we see how we
can use De Morgan's law for all the predicate logic. So, De Morgan's law for predicate
logic. Since we have two quantifiers, so, here we must have two pairs of statements that
should be equivalent. So, we can write that one is for universal quantifier. So, how to
find that ¬ (∀x P(x)) and this is ∃x ¬ P(x); second one is for ¬ (∃x ¬ P(x)) and ∀x ¬ P(x).

So, for both these pairs they are actually equivalent. So, we have to prove this thing. So,
this is the relation between the existential quantifier and the, or existentially quantified
statement and the universally quantified statement and they are related by a negation
what I mentioned earlier that one negation is involved.

(Refer Slide Time: 13:34)

Now, we prove one of the statement, or one of the De Morgan's law. So, we prove the
¬(∀x P(x)) whether they are equivalent ∃x ¬ P(x), the first pair we see. So, we start with
the left hand side. So, this is some universally quantified statement. So, our LHS is some
negation of universally quantified statement. So, the statement can be true or false.

73
So, first we consider the case that let the statement ∀x P(x) is true, or you take the
negation, take ¬ (∀x P(x)) is true. So, ∀x P(x) if we omit negation so, the reverse is, this
should be false. Now, according to the definition, the basic definition of the universal
quantifier ∀x, the universally quantified statement is false if for at least one value of x in
D, P(x) is false. So, since it is false; that means, there exists at least one value of x for
which P(x) is false.

So, how? By using the notation existential quantifier; this statement we can write there
exist at least one; that means, ∃x P(x) is false; that means, ¬ P(x) is true, or we can tell
that ∃x ¬ P(x) is true. So, ∃x ¬ P(x) is true and we started which is nothing but our right
hand side. So, what we have considered that if the ¬ (∀x P(x)) is true and we see that
∃x¬ P(x) is true, which is our these De Morgan's law for all.

(Refer Slide Time: 19:16)

Now, another part is that we have to consider if it is false now we see that if we see the
(b) part, that if ¬ (∀x P(x)) is false. So, if this is false so; obviously, similar way we can
tell that ∀x P(x) is true. Now, ∀x P(x) true; that means, for all values of x in D since it is
a universally quantified statement, so, for all values of x in D, P(x) is true.

Now, for existentially quantified statement, if it is a true then what will then for all
values of x this can be false; that means, that ∀x P(x) is true. So, ∀x ¬ P(x) is false,
which is nothing but our RHS; and this is the left hand side we started for the other case
when it is false. So, I can just write this is our proof for when we have considered that

74
the universally quantified statement is false, and here we can tell that our universally
quantified statement is true. So, both the cases we can prove and this is our De Morgan's
law.

So, similarly we can prove the existentially quantified statement that is ¬ (∃x P(x)) ≡ ∀x
¬ P(x), similar way we can prove. So, we see the De Morgan's law can be applied to find
the negation of the universally quantified statement, or the existentially quantified
statement.

(Refer Slide Time: 22:37)

Now, how we can generalize this thing, we can write the generalized statements. So, the
basic concepts that we have applied to prove the De Morgan's law that we see the
generalized De Morgan's law or generalized predicate logic. So, let us consider a
universal quantifier statement ∀x P(x), and x can take the value from the domain of
discourse D; that means, D is the value of d1, d2 up to dn. And let the statements or, the
propositions are P1, P2, P3, … Pn which are nothing, but the P(d1), when x takes the value
d1, then P(d2) like P(dn). That means, when x takes value d1 from D, P(d1) which is P1
which can be either true or false that is a proposition and similarly for Pn.

Now, if we take the conjunctions of all propositions; that means, we take the
conjunction, so, P1 ∧ P2 ∧ … Pn. So, what are the physical meaning of this conjunction?
This physical meaning of this conjunction, this is equivalent to ∀x P(x) because ∀x
means for x takes each value from D that is d1 to dn and for that the statements becomes

75
or the proposition becomes P1, P2, … Pn. So, if I take the conjunction of P1, P2, … Pn
then this is ∀x P(x).

Conjunction: P1 ∧ P2 ∧ … Pn ≡ ∀x P(x)

So, similarly if I take the disjunction, so, this will be P1 ∨ P2 ∨ … Pn and we know we can
write that this will be ∃x P(x) when that any one value of x; that means, one of Pi’s are
true.

Disjunction: P1 ∨ P2 ∨ … Pn ≡ ∃x P(x)

So, what we can tell from here? We give as if these are the conjunctions of all the
propositions or the disjunctions of all the propositions. Firstly, we see whether they are
true or false. So, immediately we do not write the universal or existential statements we
see that.

(Refer Slide Time: 28:04)

Now, from the definition of ∀x P(x) what we know? That ∀x P(x) is true if for all values
of x in D, P(x) is true. So, for all values of x in D, the propositions become true. So, I can
write that ∀x P(x) ≡ P1 ∧ P2 ∧ … Pn. So, when it will be true since it is a conjunction. So,
if all are true then only this is true; that means, LHS will be true if this conjunction is
true; this part is true, if everyone is true.

76
Now, all Pi values are true, then only I can tell that this is true, since it is conjunction. So,
it will be false when any one or at least one Pi is false. So, this is my generalized form of
predicate logic. What we can conclude that, ∀x P(x) is nothing but the conjunction of all
propositions.

(Refer Slide Time: 31:03)

Now, if we see the ∃x P(x); so, definition of ∃x P(x) when it will be true? ∃x P(x) is true
if for one value, at least one value of x in D, P(x) is true, and false when for all values of
x, P(x) is false. So, I can write is P1 ∨ P2 ∨ … Pn, since we know that it will be true if one
value of, at least one value of x in D, Pi is true; that means, P(x) is true. That means, one
Pi is true. And, when it will be false? If for all x in D, P(x) is false; that means, all Pi’s
are false; that means, this P1 ∨ P2 ∨ … Pn this disjunction is false.

So, we can generalize our existentially quantified statement or the universally quantified
statement by only using our conjunction connectives or the disjunction connectives of
the propositions or the predicates. So, once we know these generalized De Morgan's law,
so, any number of predicates that we can relate, or the with the existential quantified
statements or the universally quantified statements any number of quantified statements
that we can relate with the simple negation rule and the number of conjunctions and the
number of disjunctions of this thing.

77
Discrete Structures
Prof. Dipanwita Roy Chowdhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 09
Predicate Logic (Contd.)

We have read the Predicate Logic and the two quantifiers, the universal quantifiers and
the existential quantifiers. And mainly how these universally quantified statement and
the existentially quantifier statements are represented logically. Another thing that how
De Morgan’s law is applied on them; that means, what are the relationships between the
existentially quantifier statement and the universally quantified statement or how to
negate, simply I can tell that how to negate them.

Now, in real life there are complex statements. Most of the problem they involve
complex statements and if we try to represent them logically or if we try to represent
them with our predicate logic then more than one quantifier are normally involved. So,
we must read or we have to learn that how more than one propositions or the predicates
are connected with more than one existential quantifiers or the universal quantifiers.
How they are represented or how they are converted from one to another; how De
Morgan’s law can be applied on this type of complex statements involving more than
one quantifiers.

We generalize these topics as the nested quantifiers which involves more than one
universal or existential quantifiers.

78
(Refer Slide Time: 02:28)

We take one simple example, ok.

Example: The sum of two positive real numbers is positive.


So, here the domain of discourse D: set of real numbers
Let the variables involved are x and y

So, how we can write these statements or the proposition? Since it involves two
variables, so instead of P(x) or P(y), I write:

P(x, y) : ∀x ∀y ((x > 0) ∧ (y > 0) → (x + y > 0))

Now, we have to check whether P(x, y) is true or, P(x, y) is false. Since there are two
variables, so, the bound variables are x and y, ∀x ∀y, and we see whether this is true or
false. Now, since x is set of real numbers we know that for all values of x and y this is
always true. So, we tell that P(x, y) is true.

Now, see this representation ∀x ∀y, so this we call the nested quantifier here both are of
same type, ok. Now, this can be a different type quantifier also. So, if we take another
example.

79
(Refer Slide Time: 06:46)

Say, ∀m ∃n (m > n). This is nested so I can write P(m, n), actually we should write for
all m there exist n so that m > n:

P(m, n) : ∀m ∃n (m > n)

Now, how to find out the truth values? True or false. So, the previous example that
∀x∀y((x > 0) ∧ (y > 0) → (x + y > 0)), say if I take (x + y ≠ 0), then how to check?
So, if we have to show that this is false then we have to find out at least one value of x
and y so that this statement becomes false. So, we take these set of real number. So, here
(x > 0) ∧ (y > 0) → (x + y ≠ 0); and this is always true. Since they are positive x, y are
positive real numbers, so x + y always greater than 0; that means, which is not equal to
0. So, I can write that P(x, y) is true ∀x ∀y.

Now, slightly if we change this thing say ∀x ∀y ((x > 0) ∧ (y < 0) → (x + y ≠ 0)). And
D is the set of real numbers. Then we get at least one value of x say, for x = 1 (> 0), and
y = -1, we get x + y = 0. So, we can get one value of x and y for which the statement is
false. So, we can write that ∀x ∀y P(x, y) is a false. So, the similar way that only one
universal quantifier we have checked that whether it is true or false, now we can check or
we can find out the truth values of the nested quantifier, ok.

80
(Refer Slide Time: 11:55)

Now, we take one example of existential quantifier. So, ∃x∃y ((x >1) ∧ (y >1) ∧ (xy=6)).
You take the D is domain of discourse is the set of positive integer. Since though here it
is existential quantifier that means, if it is true for one value of x and one value of y; that
means, if we can find out at least one value of x and at least one value of y for which this
is true, then the predicate is true.

So, P(x, y) : ∃x ∃y ((x > 1) ∧ (y > 1) ∧ (xy = 6))

So, for this simple example we get that for x = 2, and y = 3 or, x = 3, y = 2, we get xy =6.
So, this statement is P(x, y) is true.

Now, how to apply De Morgan’s law? We see how we can apply De Morgan’s law on
that. We take one example, ∀x ∃y P(x, y). So, if we take the negation of this statement,
∀x ∃y P(x, y)), which is equivalent to ¬(∀x ∃y P(x, y)). Since it is nested, so, the
negation of ∀x, it is our ∃x, the negation of ∃y P(x, y).

¬ (∀x ∃y P(x, y)) ≡ ∃x (¬ ∃y P(x, y))


≡ ∃x ∀y ¬ P(x, y)

So, the De Morgan’s law when it is applied through our predicates or the more than one
quantified statement we can apply and we know that the ¬ (∀x P(x)) ≡ ∃x ¬ P(x), and
∃xP(x) if we take the negation of that we get ∀x ¬ P(x).

81
(Refer Slide Time: 16:29)

So, given one complex statements having more than one quantifiers, the negation if we
do from the left hand side we will start converting or applying the de Morgan’s law and
we will apply these two De Morgan’s law on that:

¬ ∀x P(x) ≡ ∃x ¬ P(x)
¬ ∃x P(x) ≡ ∀x ¬ P(x)

Now, we try to find out the pseudo code to get the truth values of the quantifier, ok. So,
we have three quantifiers:

1. ∀x P(x)
2. ∃x P(x)
3. ∀x ∃y P(x, y)
or ∃x ∀y P(x, y)

Third one is nested, nested either ∀x ∃y P(x, y) or, ∃x ∀y P(x, y). Now, how we can find
out the truth values. We will see that thing.

82
(Refer Slide Time: 19:24)

First we see the pseudo code for the universal quantifier ∀x. Suppose, P is a proposition
that takes values from the domain of discourse D, which is a set of values d1, d2 up to dn.
That means, when I consider P(x) actually x takes the value of d1, d2 ... dn and P(x) is my
proposition.

Now, the pseudo code. We can write, because already we know how to find out the truth
values when it involves a universal quantifier ∀x or the existential quantifier. So, I write
the pseudo code say ∀x. We can write for i = 1 to n, because ∀x it is for at least one
value it should be false. So, if ¬ P(x), then return false else return true. So, better I write
this thing pseudo code ∀x P(x):

Pseudo Code (∀x P(x))


for i = 1 to n
if (¬ P(di)) // x = di
return false
return true

See if it is only for i = 1 to n, if ¬ P(x); that means, for one value of i or, x can take one
value for which this becomes false then it is false no need to check others. But for all
values of x for i = 1 to n that it is true then my P(x) is true.

So now, I can easily write the pseudo code for the existentially quantified statement.
Now P is the existentially quantified statement; that means, ∃x P(x), and similarly we
can write for i = 1 to n. If this time it will be totally reverse. So, if P(di), because one

83
value of x, P(di), then it is return true, return false. So, here we can take one value, we
can take one value of di; that means, x is taking the value of x = di.

Pseudo Code (∃x P(x))


for i = 1 to n
if (P(di)) // x = di
return true
return false

So, for nested quantifier just extend this idea of writing the pseudo code we can write the
pseudo code.

(Refer Slide Time: 26:50)

Say ∀x ∀y, since it is nested I take same. So, for i = 1 to n, for j = 1 to n our nested loop.
If ¬ P, this time it will take two values of x and y, so did j. So, if ¬ P is true; that means,
return false, else return true. So, here x = di, y = dj, for the domain of discourse is the set
of values of d1, d2 up to dn.

Pseudo Code (∀x ∀y P(x, y)) D = {d1, d2, … dn}


for i = 1 to n
for i = 1 to n
if (¬ P(di, dj)) // x = di , y = dj
return false
return true

And for all nested quantifiers the other cases say ∀x ∃y or ∃x ∃y, we can write similarly
the pseudo code, we can find out the values.

84
Now, quickly we see one example how we can write this thing.

(Refer Slide Time: 29:19)

So, we take one example:

Example: All that glitters is not gold

So, here there are two propositions we can define, we can write:

P(x) : x glitters
Q(x) : is x is gold

So, we can write:

1. ∀x (P(x) → ¬ Q(x)) — Every object that glitters are not gold


2. ∃x (P(x) ∧ ¬ Q(x)) — Some object that glitters is not gold

So, we can apply the logic at 1 that say ∀x (P(x) → ¬ Q(x)) is ∀x (¬ P(x) ∨ ¬ ¬ Q(x)).
And similarly from 2, also we can write that ¬ ∃x (¬ P(x) ∨ Q(x)). So, 1 and 2 are the
same. Here ¬ ¬ Q(x) means Q(x) only.

1. ∀x (P(x) → ¬ Q(x)) ≡ ∀x (¬ P(x) ∨ ¬ ¬ Q(x)) ≡ ∀x (¬ P(x) ∨ Q(x))


2. ∃x (P(x) ∧ ¬ Q(x)) ≡ ¬ ∃x (¬ P(x) ∨ Q(x)) ≡ ∀x (¬ P(x) ∨ Q(x))

So, we see that both one and two are same.

So, with this example what we see that whatever we have applied in our propositional
logic the rules, that is applicable in predicate logic and we see that with the application of

85
De Morgan’s on predicates we get the same results. So, for complex statements with one
quantifier or more than one quantifier that we learn how to represent or how logically
they can be written or how they can be converted from one statement to another
statement using De Morgan’s rule.

86
Discrete Structures
Prof. Dipanwita Roy Chowdhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 10
Predicate Logic (Contd.)

We have read the fundamentals of logic, mainly the propositional logic, the predicate
logic, the difference between propositional and predicate logic. Then, the laws of logic,
the laws of inference and some examples also we have seen that how they are used for
solving problems.

Today we will see all the rules whatever we have read that how they are actually used to
represent symbolically or with logical symbols, the statements of a problem and to infer
something that means, to conclude or to prove given a conclusion whether that is true or
false. And in that way we can tell whether it proves a statement to be correct or false.

So, first we see how the laws of inference is applied to practical problems. We have read
the quantifiers last lecture, and today we will see that how these laws of inference are
used for quantified statements for practical problems.

(Refer Slide Time: 02:05)

Laws of Inference. So, the quantifiers we have read are of two types, one is the universal
quantifier we have given the name ∀x P(x). If I write ∀x P(x) then immediately I have to

87
mention a domain of discourse D. It means that x can take values from the set of element
D, they can be a set say d1, d2 like dn.

So, if we remember that the main difference between the propositional logic and the
predicate logic I mentioned that predicate logic mainly that involves a variable. And the
variable can take any values and this is some specific values it take, that means, when x
can take a value d1 then I can write P(d1). So, this is when I give this P(d1) then it is
called the sum the proposition because P(x) is the proposition, so the proposition with a
specific value of specific value of x. Say here x equal to d1. So, this is called the
specification. So, ∀x P(x) if I write P(d1) this is called the universal specification or
universal instantiation. This is I write that ∀x P(x). I replace this thing by P(d1), ok.

Similarly, if I use the ∃ for existential quantifier, ∃x, which is my existential quantifier
then ∃x P(x). Domain of discourse, I take the same thing the D then I can write that it is
P(d1), similarly I can write this is P(d1) and it is written as the existential instantiation.
So, very simply I can tell that both P(d1) when ∃x P(x), or P(d1), ∀x P(x) that means, for
a specific value of x that is why it is called specification I can tell this is also existential
specification, that one for a specific value of x that what will be the proposition.

Now, in our real life problem that most of the cases that it will take some instances that
means, that variable can take a value for a particular problem. We see with some
example this thing.

(Refer Slide Time: 09:00)

88
So, we take one example very simple example, we take that

Example: Everyone loves to join either Microsoft or Google


Amit does not love Microsoft, so Amit loves Google.

So, we have to check whether this inference is correct or not or whether this statement is
correct or not. Now, we apply the proposition or we see that from predicate logic or the
how we can use the laws of inference for this quantified statement.

So, first we see we assume some proposition:

M(x): x loves Microsoft


G(x): x loves Google

So, everyone loves to join either Microsoft or Google; so for everyone means ∀x. So,

∀x ( M(x) ∨ G(x) ) ………….. (1)

Now, Amit does not love Microsoft. So, if someone does not love Microsoft if it is
general variable for x then x loves Microsoft, so x does not love Microsoft that I can
write as ¬ M(x).

Now, x can take the value that if I put x is Amit because it is for everyone that. So, if x is
Amit, so this is something called the instantiation that means, if I write that ¬ M(Amit).
So, this is something is called that instantiation or specification.

1. ¬ M(Amit)  Instantiation

Now, if I reflect see this here that x is Amit with this instantiation then we can get that

2. M(Amit) ∨ G(Amit)  Universal Instantiation

See here we note that whenever it is instantiated by some value specific value then we
omit this quantifier, that here it is a universal quantifier that we have replaced. So, it is
called that universal instantiation, it is universal instantiation.

Now, I have

1. ¬ M(Amit)  Instantiation
2. M(Amit) ∨ G(Amit)  Universal Instantiation

89
So, from 1 and 2 we can write that it is G(Amit), and this is rule of inference. It is called
the disjunctive syllogism.

So, this is one rule of inference, that if we apply for 1 and 2, then we get G(Amit), that
means, Amit loves Google. So, we can tell that, the conclusion is Amit loves Google.

So, first we have taken the propositional function then actually the predicate then the
variable, takes what particular value what just now we have defined that, this is a
instantiation or some specification. And when specification if we put then we omit the
notation of that universal quantifier, we write and then only we can apply the rule of
inference and from there we check whether my conclusion is correct, that means our
inference is correct, that means given hypothesis these are my hypothesis, and this, the
conclusion is true, ok.

So, now we see another example.

(Refer Slide Time: 18:45)

Say, a student in the discrete structure class has not read the book and everyone in
discrete structure class has passed the first class test. So, this imply that, someone who
passed first class test has not read the book. So, whether our conclusion is correct or not
that we have to check.

So, first thing is that we consider some proposition. So let,

90
C(x): x is in the Discrete Structure class
B(x): x has read the book
P(x): x has passed the first class test

So, now what are the hypothesis given? So, the hypothesis are student in the discrete
structure class has not read the book. So there exist x is student, so someone; there exist
x that in the discrete structure class C(x) and he has not read the book, so C(x) and not
read the book so it is negation B(x). This is one hypothesis. And then everyone in DS
class has passed the first class test. Everyone, so for all x, for all that means, everyone
that has passed the class first class test that means, ∀x P(x) is true.

Hypothesis: ∃x (C(x) ∧ ¬ B(x))


∀x P(x)

And then we have to check that whether someone who passed first class test has not read
them. That means, with the conclusion should be, that someone who passed first class
test has not read the book in first class test, means that, it is P(x). That means, ∃x P(x)
and who has not read the book that means ¬ B(x). Now, we have to check whether given
these hypothesis whether the conclusion is true or false. Now, we apply the rules of
inference and for this quantified statement.

Conclusion: ∃x (P(x) ∧ ¬ B(x))

Now, there is some procedure to do this thing. So, the procedure is that, for the solution
we have to write the steps and the reason.

(Refer Slide Time: 25:46)

91
So, we start with one the hypothesis and going on:

Step Reason
1 ∃x (C(x) ∧ ¬ B(x)) Premise
2 C(a) ∧ ¬ B(a) Existential Instantiation on 1
3 C(a) Simplification of 2
4 ∀x (C(x) → P(x)) Premise
5 C(a) → P(a) Universal Instantiation on 4
6 P(a) Modus Ponens on 3 and 5
7 ¬ B(a) Simplification of 2
8 P(a) ∧ ¬ B(a) Conjunction of 6 and 7
9 ∃x (P(x) ∧ ¬ B(x)) Existential generalization

And, so it is true that means, ∀x that, someone who there exist some x; ∃x that who has
passed, but not the read the book.

So, if we can summarize that thing that rules of inference for quantified statements, we
write whatever we have read if we just do the summary that rule of inference for
universal quantifier and the existential quantifier.

(Refer Slide Time: 32:35)

So, these are the rule of inference and we give the name one:

92
Rules of Inference for Quantified Statement
Sr. No. Rule of Inference Name of Rule
∀x P(x)
1 Universal Instantiation
∴ P(d) if d is in D
P(d) for every d in D
2 Universal Generalization
∴ ∀x P(x)
∃x P(x)
3 Existential Instantiation
∴ P(d) if for some d in D
P(d) if for some d in D
4 Existential Generalization
∴ ∃x P(x)

So, whenever the rule of inference we will apply we have to remember this two
quantification, that is the universal quantification and the existential quantification.

(Refer Slide Time: 37:06)

And the one point we must remember this is very important that whenever we will use
some laws of inference that it must be the some quantified statement. That means, it must
be some instantiation, must be done before that. Like here in step 2, we have done that
x=a, that means, there is no quantifier here, there exist x of for all x then only we can
apply. So, this is something we must maintain that whenever we will be using laws of
inference to solve some problem that we have to write in these steps, and whatever the
reasons. That means, which laws of inference we have applied that we must mention
here. And this is some convention we must follow.

93
So, with this we finish the lecture of the Foundations of Logic and how the logic rules,
mainly the laws of inference, the laws of logic, the negation, how to find negation, the
De Morgan’s rule; they can be applied on the proposition.

94
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 11
Proof Techniques

Today, we will read the different Proof Techniques. So, first we see that what do we
mean by proofs and what to proof?

(Refer Slide Time: 00:41)

First we introduce a mathematical system. A mathematical system consists of axioms,


then definitions some a number of terms that can be predefined or some terms are newly
defined. Now, we know that axioms; so, first we write the mathematical systems you can
write that it is a set of axioms then some definitions and a number of terms.

Now, these axioms we can think that, it is assumed that they are already proved some
statements or we can tell some theorems that are already proved. Axioms are assumed
which are already alright or we can write directly or assume to be proved. And,
definitions are used to create new concepts and terms that are explicitly defined as well
as can be implicitly defined for mainly for axioms. So, we define a mathematical system
mainly by these three parameters.

95
Now, we can think the theorems that can be treated as a proposition which has already
been proved or some we have to prove that proposition. So, we define or that theorems
can be treated as the propositions. Since, now we know the proposition we have read in
logic. So, as if theorems we are thinking as a proposition which is that has already been
proved or we have to prove. Now proposition is to be proved means the truth value or we
can tell that the proposition is true that is the proposition I have to show that proposition
is true; that means, the truth value of the proposition is true.

Now, an argument that establishes the fact that this proposition is true is a proof. So, we
define the proof we define proof as an argument that establishes the truth value of the
proposition. Now, this argument that can be defined or that can be presented in different
way and that are called the different proof techniques. So, different arguments or
different form of arguments mainly at the different proof techniques.

Now, already from our previous knowledge we know the theorems, lemmas or corollary
associated with theorem. So, lemma and corollaries these are again we can treat that as
the different form of theorems. We know that lemma is also a theorem which is not very
important to prove, but is very useful to proof another theorem.

And, we can tell corollary; corollary is another theorem. It is also a theorem that derives
or it is derived from another theorem very easily. So, in these basic definitions of a
mathematical system that mainly in a mathematical system that we will define the
different terms and then using those terms or definitions will state some theorems or
some statements.

Since, now the theorem means it is nothing, but a propositions to be proved and then we
will see how we can prove that statements or how we can show that the proposition, or
the truth value of the proposition is true. So, before we give the different proof
techniques first we see how the theorem can be treated as a proposition.

96
(Refer Slide Time: 11:58)

So, the general form of theorem; so, I can write that for all terms or, for all values of x, if
p(x1, x2, …, xn) then q(x1, x2, …, xn) so, this is some universally quantified statement. So,
the general form of theorem is a nothing, but a universally quantified statement. Now,
this is my hypothesis, and this is my conclusion.

So, what we have to prove? That if p is true; that means, all x1, x2, …, xn which are in the
domain of discourse g; if p is true we have to show that q is true. So, we represent the
theorem like a proposition. Since now we know we have read the logic and we know that
what is proposition, and what are the true values of the proposition or what are the
different logic rules or the laws of inference or different other rules we can apply to
derive or to show that some conclusion to be true or false.

So, we have to read that how we can do the proof? So, first we see that a direct proof is
very simple and always we use. So, the name is direct proof. So, direct proof, if p is true;
that means, the hypothesis we assume p is true and with the help of other axioms,
definitions and the previously derived theorems; we have to show that q is true, the
conclusion is true. So, this is mainly the direct proof. So, we see one example of the
direct proof.

97
(Refer Slide Time: 17:22)

Example: We give the statement that if m is odd and n is even, then show that m + n is
odd, where m and n are two positive integers.

Now, what definition is required? All of you know that what is odd and what is even, but
it has some proper definition. So, what is an odd number? We know that m is an odd
number if there is one integer K1 such that m = 2K1 + 1. Similarly, I can define an even
number. So, n is an even number, if there is one integer say K2 such that n = 2K2. So,
these are the two definitions or these are our previous knowledge that we need to prove
this statement, or theorem.

So, what is then m and n? Since given m is odd and n is even; so,

m + n = 2K1 + 2 +2K2
= 2(K1 + K2) + 1
= 2K + 1 (where K1 + K2 = K)
= Odd Number

So, it is proved. So, the theorem is proved. So, this is one direct method of profit proving
the statements. Then, immediately we have to think that if there is a direct method then
there must be one indirect method. So, what is that indirect method?

98
(Refer Slide Time: 22:00)

So, indirect method normally is some proof we do by the method of contradiction; that
contradiction we have ready a study of logic. So, mainly the proof by, or a special case
of contradiction is called the contrapositive. These are the methods of proof by indirect
way; that means, indirect method of proof.

Now, we define this technique. So, now we know that, if p then q, this is the proposition
that we want to prove. Now, here we assume that q is false, because we have to prove
that q is true. That means, ¬ q is true.

So, using p; that means, p is true, ¬ q and with the help of axioms, definitions, and
previously derived theorems we will show a contradiction. What is contradiction? We
have to show q is true, but we assume ¬ q is true. So, we will show a contradiction and
we will prove the theorem.

So, the difference from the direct method is that in the direct method greatly we have
taken that the hypothesis is true and from there only under with the definitions or
previously derived theorems, like the previous example we have taken the definition of
odd numbers and even numbers. In addition here in proof of contradiction we assume
that our conclusion is false and from there we will derive that thing.

99
(Refer Slide Time: 26:21)

We take one example. If x, y or two positive integers, if x + y ≥ 2, then x ≥ 1 or y ≥ 1.


Now, here if p then q, so,

p : x + y ≥ 2, this is my hypothesis
q : x ≥ 1 or y ≥ 1, so, this is my conclusion

So, for contradiction or indirect proof, we assume ¬ q. So, it is ¬ q ≡¬ ((x ≥ 1) ∨ (y ≥ 1)).


Then we apply De Morgan’s law. So, this becomes negation x ≥ 1 means x < 1, OR
becomes AND, y < 1.

¬ q ≡ ¬ ((x ≥ 1) ∨ (y ≥ 1))
≡ (x < 1) ∧ (y < 1)

Now, we know that we have p is true; that means, because we have to use p true, then ¬q
and the definitions or the previous knowledge and the previously derived theorems,
axioms, definitions etc.

p is true means that : x + y ≥ 2 ……………………(1)


And ¬ q means just now, we got that : x < 1 and y < 1
So, what is x + y? (x < 1) ∧ (y < 1), i.e., x + y < (1 + 1), i.e., x + y < 2 …………….(2)

So, from 1 and 2 we get a contradiction. So, that means, what we assumed that ¬ q true,
is false. So, q is true and the theorem is proved.

100
(Refer Slide Time: 32:00)

So, we can define the contradiction in this way that and if p →q, if p then q. That means,
p → q this is my proposition. (p → q) that implies p → q → r ∧ ¬ r. So, our theorem to
be proved is if p then q which is p → q.

Now, p → q, from there we take p true and ¬ q, and if that implies one contradiction; that
means, some proposition r ∧ ¬ r, then this is a contradiction.

So, this is if we get p → q → r ∧ ¬ r, that mean contradiction then this is actually the
basic principle of the proof by contradiction.

So, we see in this lecture we have read the very basic techniques of proof or very basic
proof techniques is direct method and the indirect method. And, mainly how the
theorems are represented as a proposition and then how they can be proved or the truth
value of the conclusion can be made if the theorem is represented as a proposition.

101
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 12
Proof Techniques (Contd.)

So, we are discussing about the Proof Techniques and in the last lecture we have started
the indirect proof techniques. And under indirect proof techniques we have read the
proof by contradiction.

(Refer Slide Time: 00:37)

In the proof by contradiction we have assumed that when the theorem is represented as a
if p then q, then using the hypothesis to be true, p true, the ¬ q; that means, conclusion
which we have to prove true, false. And then other axioms definitions and previously
derived theorems we have tried to prove that the conclusion is true or to give a
contradiction. So, that was the indirect techniques or the proof by contradiction.

Now, how do we know that the proof by contradiction works correctly? Or more simple
way if I tell that what we are assuming that ¬ q, and if p is true AND ¬ q together they
imply a contradiction. That means, r ∧ ¬ r whether that is working correctly or I can tell
that whether they are equivalent, I can tell p ∧ ¬ q whether they implied that r ∧ ¬ r, and
whether this thing is equivalent to p ∧ ¬ q, p → q and r ∧ ¬ r.

102
So, if we give it proved by the truth table method. So, we first give it to table that since
here we have 3 propositions. So, I take a truth table give a truth table of next page we go.

(Refer Slide Time: 03:25)

That p q r these are the 3 values then we take p → q (i.e., if p then q), then our
assumption that p ∧ ¬ q that we have assumed for contradiction and then the
contradiction itself that r ∧ ¬ r, then whether (p ∧ ¬ q) → (r ∧ ¬ r).

Now we have to show that whether the p → q. p → q because this is the theorem that we
want to prove; that means, if p then q which is which is p → q and p ∧ ¬ q → r ∧ ¬ r.
What is the basic principle of contradiction? I write this is my principle of contradiction.
So, first I show that whether this method is correct or it is coming correctly that the way
we are applying the principle of contradiction, we take all the possible truth values of p q
r, and so on.

The truth table for the proof


p q r p→q p∧¬q r∧¬r p∧¬q→r∧¬r
(if p then q) (principle of Contradiction)
T T T T F F T
T T F T F F T
T F T F T F F
T F F F T F F
F T T T F F T
F T F T F F T
F F T T F F T
F F F T F F T

103
So, these two are equivalent. You see that these two columns (the highlighted columns)
are equivalent. So, the technique that we are using in the contradiction method that it is
proof that it should work properly; that means, p → q that the theorem to be proved; that
means, the proposition and which is equivalent to p ∧ ¬ q → r ∧ ¬ r. So, this is the basic
principle of contradiction.

(Refer Slide Time: 09:31)

Now one special case of contradiction is the contrapositive and what is the principle of
contrapositive? We know that, when we have read the logic that, if p → q, the
conditional proposition that it is equivalent to that ¬ q → ¬ p. So, sometimes to prove
some statements or theorems that it is much easier to show that ¬ q → ¬ p, instead of the
p → q.

We see one example, same for any integer m, if m2 is odd, then m is odd. This is one
statement that we have to show that it is true or we have to prove. So, if m2 is odd then m
is odd. So, our m2 is odd, this is our hypothesis p. If p then q, so m is odd this is my
conclusion.

So, this is my hypothesis this is my conclusion and what contrapositive tells? That p → q
and negation is equivalent to ¬ q → ¬ p. So, what is ¬ q? q is, m is odd. So, ¬ q is m is
even.

104
Now, we know the definition of even number. So, m is even is we can write 2k. So, what
is m2, it is 2k x 2k = 2 x 2k2. So, again this is an even number since 2 x 2k2 we can write
2 x k1 so that is an even number. So, what is even number? That hypothesis was m2 is
odd and we are getting m2 is even; that means, it is ¬ p, this is my ¬ p because p was m2
is odd.

So, ¬ p is m2 is even. So, what we see we started with m is even; that means, the ¬ q, and
we got that it is ¬ p; that means, ¬ q → ¬ p. So, and we know that this is equivalent to
the p → q. So, since we get this is true, then p → q, so q is true. So, it is proved. So, this
is by prove by contrapositive, this is a special case of contradiction.

(Refer Slide Time: 14:10)

We see another example, prove that there is no positive integer n such that n2 + n3 = 100.
How to prove this thing? See two ways I can prove this method; very simple way.

So, one method, see one way I can tell that n2 + n3 = 100. So, if I have two terms in the
left hand side. So, if I think separately then n2 must be ≤ 100, and n3 also must be ≤ 100,
since the sum of n2 + n3 = 100. So, n2 ≤ 100; that means, n must be ≤ 10 similarly, here I
can tell n ≤ ∛100. So, 4 because if it is 5 then it is 125. So, n ≤ 4. If I take both that thing
together then only for n = 1, 2, 3, 4 these cases we have to check.

Then what is the value of for n = 1? n2 + n3 = 1 + 1 ≠ 100


For n = 2: n2 + n3 = 4 + 8 = 12,
n = 3: n2 + n3 = 9 + 27 = 36

105
n = 4: n2 + n3 = 16 + 64 = 80
So, no one is these are equal to 100.

Now, see here the proof is another way I can do, another way what better I tell that thing
also that I can do in this way n2 + n3 = 100, I take n2 (1 + n) = 100. So, since these are
two factors; we know the factors of 100, these are 2, 4, 5, 10, 20, 25, 50.

Now see n2, this is a perfect square and in the factors of 100 there are only two perfect
square, 4 and 25. So, if n2 = 4 then n = 2. So, (1 + n) = 3. So, 4 x 3 = 12 ≠ 100.

And if n2 = 25 then (1 + n) = 6, n = 5. So, then in that case 25 x 6 = 150 ≠ 100.

Now, these are the two ways I can prove that n2 + n3 = 100 that it is there is no such
positive integer n exists. Now see in this technique in both the cases the way we have
proved, what we have taken different cases of n, or different values of n. 1st method we
have taken n = 1, 2, 3, 4 and we have seen whether n2 + n3 = 100, or not. Here only the
cases are we have taken n2 = 4 and n2 = 25, but see here also we have taken that 2 cases,
here there are 4 cases (1st method) here there are 2 cases (2nd method). So, this is one
technique which actually comes from the either direct method or indirect method, but
this we categorize in a different way we will call that proof by cases and many time this
is very helpful or much easier to prove some theorems.

(Refer Slide Time: 21:52)

106
So, we can tell that this is the proof by cases. How we define? Because our theorem is
stated as or represented as if p then q.

And if we can elaborate if p it takes p (x1, x2, …, xn) then q (x1, x2, …, xn). Now these if
p is partitioned in to different cases. So,

p → q ≡ (p1 ∨ p2 ∨ p3 ∨ … ∨ pn) → q
≡ (p1 → q) ∧ (p2 → q) ∧ (p3 → q) ∧ … ∧ (pn → q)

So, these are considered as the different cases, and if I can prove then we can tell that
this is actually proof by cases for each cases. So, now we take one example.

(Refer Slide Time: 25:13)

So, then the last digit or sometimes we call final digit of a perfect square are only are
confined into some digits they are 1, 4, 5, 6 and 9 ok. So, we have to show that the last
digit of a perfect square are only confined to these decimal numbers 1, 4, 5, 6 and 9. So,
now, if we take by cases so I can think in this way that solution. So,

Case 1: Square of number 1 and 9  last digit 1


Case 2: Square of number 2 and 8  last digit 4
Case 3: Square of number 3 and 7  last digit 9
Case 4: Square of number 4 and 6  last digit 6
Case 5: Square of number 5  last digit 5

So, what we see that the whatever be the numbers that last digit is from 1 to 9 and then
these are for 1 and 9 is 1, for 2 and 8 is 4, 3 and 7 is 9, 4 and 6 is 6, and 5 is 5. So, that

107
means, these are only the last digits of perfect square is 1, 4, 5, 6 and 9 it is proved. So,
this is a very simple example of the proof by cases, many time that one complex prove is
becomes very simple if we can partition the cases.

(Refer Slide Time: 30:38)

Now sometimes we call that there are many different, other different techniques which
are actually derived from direct or indirect one such is that a counter example we created
that one is that by counter example. So, just to give one example that show that for all n
2n + 1 is prime, whether it is true or false or I make a statement rather that. So, for all,
this is my statement that for all n, 2n + 1 is prime.

Now, if we again do by cases say for n = 1, we see that this is 2, prime. For n = 2, then it
is 5, prime. n = 3, it is 9. So, you see that for n = 3, that 2n + 1, this is not a prime
number, but this is a composite number. So, this is a counter example, and we can tell
that, this is a false statement.

So, many time that we can use that this is proved by counter example. So, these are
normally the different techniques direct or indirect and these are the prove by cases or
the counter examples or the contradiction. The contrapositive which are slightly different
variant of that direct indirect methods. And another way, another proof techniques which
is very important particularly in computer science that is proof by induction. So, next
step will read that thing.

108
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 13
Proof Techniques (Contd.)

We are discussing about the proof techniques and last lecture, we have read the direct
proofs and the indirect technique of proofs. Today we will read the mathematical
induction. And this is the most important proof technique that we use.

(Refer Slide Time: 00:43)

So, we will read mathematical induction. First I explained what we mean by


mathematical induction, and how it is used to prove the different formulas. Suppose, we
have a sequence of blocks numbered 1, 2, 3 like that. We draw the block. So, first we
will draw the blocks. So, these are number 1, 2, 3 and say up to n. So, we have n number
of blocks. And some of the blocks here are marked as x, say some of the blocks marked
x. And suppose that we have n number of blocks, some of them marked cross. Suppose,
if block n is marked, then block n + 1 is also marked, this is given. Then we claim that
every block is marked. Then how do we prove that our claim is true?

So, say first we see that mark n number of blocks, and some of them marked x. So, first
we assume that block 1 is only marked. So, I have block 1 is only marked. Now, it is
given that if block n is marked, then block n + 1 is marked. So, if n = 1, since block 1 is

109
marked, so n + 1 = 2. So, block 2 is also marked. Now, if n = 2 is marked, so n + 1 = 3,
so block 3 is also marked.

Now, in this way, if I increase n and we add 1 to n, we can show that up to any number,
say n that all blocks are marked. Now, suppose some a few of the blocks are marked say
for n = 4, the block is marked. Say for n = 5, block is marked. All blocks are marked.
Then if I consider the n + 1, that means, block 6 then it can be marked.

So, we can prove that for every n, and n ≥ 1 that all blocks are marked. So, this simple
concept that if it is true for one basic value and then some statements are given, then
based on that statements, we can prove that it is true for all values of n, all positive
values of n and this is actually the mathematical induction.

(Refer Slide Time: 08:11)

So, now, we use mathematical induction in more formal way. We first take a one simple
example how we use the mathematical induction to prove some simple mathematical
formula. So, we will take one example that to show that sum of first n positive integers is
n(n+1)/2, all of you know this formula, but we have to prove by mathematical induction.

Now, first we see it first sum of first n positive integers, so we can write that
Sn = 1 + 2 + 3 + 4 + … + n
So, for n = 1, S1 = 1 = 1(1+1)/2
for n = 2, S2 = 3 = 2(2+1)/2

Now, for n = n, Sn = n(n+1)/2

110
Now, from the given series or the formula, we can see that for S1 = 1, this is true, we
give a tick mark. For n = 2, it is 1 + 2 = 3, so the formula is true. For n = n, we assume
that for n the formula is true. So, we assume that for n, the formula for Sn formula of S n
equal to n into n plus 1 by 2 is true.

Now, we have to show that or if we can show that for the next value of n, it is true, then
we can take that for each value of n the formula is true. So, you see for n = n + 1. So, for
n = n + 1, or from the definition we know that it is Sn+1 is

Sn+1 = 1 + 2 + 3 + … + n + (n + 1)
= Sn + (n + 1)
= n(n+1)/2 + (n+1)
= (n(n+1) + 2(n+1))/2
= (n+1)(n+2)/2

This is true for any value of n. So, we can write for all n this is true. So, now we can give
the principle of mathematical induction.

(Refer Slide Time: 14:25)

Suppose that we have a propositional function. Let the function be S(n) whose domain
of discourse is the set of positive integers. Suppose, that S(1) is true, that means, the
propositional function S(n) for n = 1 is true. For all n ≥ 1 if S(n) is true, then S(n+1) is
true. Then S(n) is true for every positive integer n.

111
Now, we have taken one propositional function S(n), and we assume that S(1) is true.
We give this is number (1).

And for all n ≥ 1 if S(n) is true then it is given that S(n+1) is true. Then S(n) is true for
every positive integer n. So, this is the principle of mathematical induction. And we will
use this thing to prove the formula or to verify some equalities or inequalities in
mathematics. Now, we see that some example we see with this thing.

(Refer Slide Time: 18:39)

You take one example that use induction to show that n! ≥ 2n-1 for all n ≥ 1. So, we know
the definition of factorial that:

n! = 1, for n equal to 0
n! = n x (n – 1) x (n - 2) … 3 x 2 x 1, for n ≥ 1

So, if we want to use the mathematical induction, then in the principle of mathematical
induction,

Basis Step: for n = 1, 1! = 1 ≥ 1 = 21-1 ………. True


These we call that the basis step
Inductive Step: Assume for n = n, the formula is true: n! ≥ 2n-1
This is all inductive step
Now, we have to show that it is true for (n+1)!. So, we see that
(n+1)! = (n+1)(n(n-1)…3.2.1)/n! = (n+1)n! ≥ (n+1)2n-1, for n ≥ 1
≥ 2 . 2n-1; n+1 ≥ 2
≥ 2n

112
So, it is proved.

Now from these two examples what we see that one correct formula must be given. And
we are actually proving that whether for some basic values that is for n = 1, the formula
is true or not; and then for some n if we assume that for n it is true, then whether n + 1
the formula is true or not. Then the question is that how we can get the formula or the
correct formula. So, sometimes that from some the result for different values of n, we
can or from the sequences of the results, we can frame some formula.

(Refer Slide Time: 25:29)

I give one small example say we want to add or take the sum of say Sn = all odd
numbers:

Sn = 1+3+5+…+(2n-1), for n ≥ 1

Now, I do not know what the correct formula is. So, what I will do.

for n = 1, S1 = 1 ( = 12)
for n = 2, S2 = 4 ( = 22)
for n = 3, S3 = 9 ( = 32)
for n = 4, S4 = 16 ( = 42)

So we can tell that, for n = n, Sn = n2

So, our formula is that Sn = n2 and then we can prove. So, this is one very simple
technique to get the correct formula. Now, the scope of mathematical induction is again

113
not only for proving the correct formula or verifying the equalities or inequalities,
actually it can be used for many other mathematical proofs. So, one such example we
see.

(Refer Slide Time: 27:37)

Use induction or mathematical induction to show that 5n - 1 is divisible by 4. So, what


will be the basis step:

Basis Step: for n = 1, 51 – 1 = 4, which is divisible by 4.


So, the statement or the proposition is true.

Now, we see the inductive step:


Inductive Step: assume for n = n, 5n - 1 is divisible by 4.
The proposition is true is true.

Now, I see whether it is true for n = n + 1.

for n = n + 1, 5n+1 - 1 = 4 x 5n + 5n – 1 = divisible by 4

As 5n – 1 is already true, and since it is 4 x 5n, so the first term is divisible by 4. So, it is
divisible by 4 from mathematical induction.

So, the basis step, that is for n = 1, we check whether the formula is true or not. And for
the inductive step, we assume that the immediate predecessor value is true.

114
(Refer Slide Time: 32:05)

That means if we can write that for mathematical induction that, how to use that for basis
step some basic value of n, normally for n = 1. We show that the proposition that means,
the given statement or the formula say proposition S(n) is true; that means, S(1) is true.

And for inductive step inductive step that means, for all n ≥ 1, we first assume S(n) is for
n it is true. Then we have to show that if n + 1 is true, so that means, to show the truth
values of the proposition for some n, the immediate predecessor statements or the
propositions is assumed to be true. And here for the basis step for some basic value n =1,
it is true. Now, if for some formula or some proposition that n = 1 is not valid.

115
(Refer Slide Time: 35:17)

That means, for some proposition if n = 1 is not valid that means, there does not exist
any result for this. Then we consider some value n0, n = n0. And we show that S(n0) is
true. So, some basis step can be replaced that instead of S(1), we can show that S(n0) is
true ok. So, this is the principle of mathematical induction is used to prove the formula or
to verify equalities, inequalities and other proof techniques.

116
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 14
Proof Techniques (Contd.)

So, we have learned the mathematical induction and now we will see that there is another
form of mathematical induction which is also very useful to solve many other
mathematical problems which is the strong form of mathematical induction.

(Refer Slide Time: 00:37)

So, if we remember the principle of mathematical induction, then we have assumed that
if we have to proof the formula for some value; then the immediate predecessor value or
immediate predecessor statements is assumed to be true.

Now, the main difference from the normal mathematical induction and the strong form
of mathematical induction is that here we assume that not only the immediate
predecessor statements, but for all previous or preceding statements must be true. So,
first we read, write the principle of strong form of mathematical induction; so, suppose
we have a propositional function say S(n) with the domain of discourse is the set of
positive integers. We put one restriction that set up positive integers greater than or equal
to n0.

117
Now suppose that for what you see for n = n0; that means, S(n0) is true and for all n > n0,
if S(k) is true for k where n0 ≤ k < n, then S(n) is true. Then we claim then S(n) is true for
any value of n > n0.

Now, we first see the difference from the simple mathematical induction. So, what is the
basis step? This is our basis step. We have considered the general value that n = n0; n0
can be 1, but we take some other value we can take also that some other value of other
than 1. And then for all n greater than n0 if S(k) is true for k, n0 ≤ k < n; that means, this
is my inductive step and here we do assume that all preceding statements are true. That
means, I can write the inductive state; we assume the truth values of on preceding
statements.

So, this is the main difference from the difference from the normal form of mathematical
induction from the normal form of mathematical induction, where we have assumed only
the immediate predecessor statements to be true. And many times these are strong form
of mathematical induction are very useful to prove some complex problems. Now, we
see some of the examples and how actually strong form of mathematical induction can
be utilized.

(Refer Slide Time: 08:19)

So, we see one example. Show that the postage of rupees 4 or more can be achieved by
using only rupees 2 and rupees 5 stamps. So, first we have to show the basis step.

118
Now, here before writing the basis step and the inductive state, we try to explain that
how what will be our approach that to use the strong form of mathematical induction.
See since rupees 2 stamps are allowed rupees 2. So, if any n minus 2 postage it is true;
that means, any n minus 2 postage can be achieved with rupees 2 and rupees 5, then what
we can do? We can just add another stamp of rupees 2 and we will get the postage of
rupees n; that means, if this is my proposition say proposition is S(n) that S(n) is the say
proposition of that postage of rupees n; postage of rupees n can be achieved my rupees 2
and rupees 5 stamps.

Now, if we assume that if we assume that S(n – 2) is true; that means, that S(n – 2) is that
postage, this is postage of rupees n - 2 be achieved can be achieved by rupees 2 and
rupees 5 stamps, then we will simply add rupees 2 more. So, we add stamp of rupees 2
and we will get S(n) and S(n) can be achieved or S(n) is true. So, this is our approach.
So; that means, is very simple if we consider or if we can see that S(n – 2) is true then we
will add each time only rupees 2 stamp and we will get the, we will get for all values of n
it is true.

Now, say if it is 5 say n = 5 then or n - 2 is n - 2 is 3 so, but our statement is not given for
n = 3 or say if n = 4, then n - 2 is 2. So, it is not given it is particularly for n = 5. So, our
statement for this is n = 3 or n = 2 it is not given the statements are only rupees 4 or more
rupees 4 or more. So, here our n0 is; that means, our basis step that n0 = 4 and 5. We have
to show separately that the statement is true for n = 4 and n = 5. So, this is this should be
our basis step. So, now we see the proof.

119
(Refer Slide Time: 14:20)

So, what basis step when for n0 equal to, for n0 = 4, we need 2 rupees 2 stamp for n0 = 5,
we need 1 rupees 5 stamp. So, postage of rupees 4 and rupees 5 postage of rupees 4 and
rupees 5 can be achieved by using rupees 2 and rupees 5 stamps. So, our basis step is
true. So, our S(n0) is true or basis step is true. Now what about our inductive step?
Already we have seen that strong form of induction that all preceding statements are true.
So, assume S(n) is true for all preceding statements or all preceding values of n. So, it is
true for n - 2. So, S n - 2 is true.

So, once S(n – 2) is true add rupees 2 stamp and make S(n) be true so, it is proved. So,
one S(n – 2) is true we will just add rupees 2 and S(n) is true. So, it is proof that any
postage of rupees 4 or more than 4 can be achieved by stamps of rupees 2 and rupees 5.
So, this is proved. So, notice for this particular example it is very much required that that
sum preceding values like for n we have that S(n – 2) must be true. Now, we say
different type of examples that how mathematical induction can be used to compute the
complexity or the number of steps because that is very important in computer science.
So, we see a different type of example here.

120
(Refer Slide Time: 19:26)

Suppose we have we insert parentheses and then multiply the n numbers. So, we have to
multiply n numbers say a1, a2, a3, …, an, and we insert parentheses and then multiply the
n numbers. Say for example, n = 4, I have the numbers a1, a2, a3, a4 and the
multiplications of a1 . a2 . a3 . a4; so, we insert parentheses and first we multiply (a1 . a2)
and then (a3 . a4). Say this is A1 . A2 ; and then I need another multiplication. So, to
multiply 4 numbers; we need 3 multiplications.

Now, proof that if we insert parentheses in any manner whatsoever and then multiply the
n numbers, then the number of multiplications are n - 1; that means, to multiply a1, a2, a3,
…, an, we have to perform n number of multiplications. And if you insert parentheses
and we multiply 2 numbers at a time; now, we see the proof.

121
(Refer Slide Time: 24:58)

So, first is the basis step. So, for n = 1, I have only one number a1. So, the number of
multiplications is 1 which is equal to number multiplication is 0 = 1 - 1. For n = 2 the
numbers are a1 and a2. So, the number of multiplication is 1 = 2 - 1. So, the basis step is
true. So, we can write that, for n = 1 or n = 2; the multiplication is n - 1 is true.

Now, for inductive step say I have n numbers a1, a2, a3, …, an. So, now, we put
parentheses. We first partition into 2; we multiply (a1 . a2 … at) and (at+1 . at+2 … an).
Now if we apply the strong form of induction, then t < n, first thing is that we partition or
we insert parentheses so, that t numbers we multiply, and rest (n – t) numbers. These are
t numbers, and, these are (n - t) numbers; so, here t < n as well as (n – t) < n.

122
(Refer Slide Time: 28:45)

So, if we use the strong form of induction mathematically induction is write, the
proposition is true for all preceding statements true for all values less than n; that means,
it is true for t and n - t since t < n, and (n – t) < n. Since, we have partition or we have
inserted the parentheses so, that t numbers are multiplied in one part and rest (n – t) are
multiplied in another part.

So, if we continue the inductive step we can write that the number of multiplications; the
number of is, for the first part it is since t numbers are there. So, (t – 1) multiplications
are required plus for (n – t - 1) multiplication of required and the last multiplication I
need another one. So, this is for t number of multiplications or I should write
multiplication of, number of multiplications for t numbers and this is one number of
multiplication for (t – n) numbers and this is for number of multiplication for last two
product.

So, this becomes (n – 1). So, it is it is proved; see this is number of multiplications. So,
similar way what will given a program or some computations like that this is a
multiplication. So, what will be the number of computations required, number of
multiplication, number of additions, a number of comparisons which actually directly
gives a complexity of a program so, or complexity of some algorithm. So, using strong
form of mathematical induction sometimes it is very easy to compute the complexity of
some algorithm or the of some program.

123
We have now one small thing that it is we have read the simple or normal form of
mathematical induction and the strong form of mathematical induction. Now yeah if we
know read the well ordering property which is actually the generalized concept of both
of this form. So, I must, I just mention or write this property.

(Refer Slide Time: 34:30)

Now, it is the well ordering property. Now, well ordering property of non-negative
integers that if state that every non-empty set of non-negative integers has a least value;
and this is the generalize, this simple statement is the generalized form of the normal
mathematical induction and the form of normal mathematical induction as well as strong
form of mathematical induction. We can write generalized form of both the forms of
mathematical induction.

Only I mention that this well ordering property; this is mainly used to proof our well
known that quotient reduction theorem. That quotient reduction theorem, it is used and
the theorem that if a positive integer n is divided by d; that means, if n and d are integers
greater than 0, then there exists q, the quotient and r, the remainder that satisfy n = q.d +r
where, 0 ≤ r < d and furthermore that q and d are unique; furthermore q and d values are
unique.

So, this is our very well known Quotient Reduction Theorem and this is when it is
proved by very easily it can be proved by well ordering property. But, all of we know
this simple form just I mentioned that we can prove this thing by this mathematical

124
induction. So, with this, we finish that concept or that how mathematical inductions are
used to prove the many mathematical formulas.

125
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 15
Proof Techniques (Contd.)

So, we are discussing the mathematical induction; that means, the Proof Techniques that
normally we use the mathematical induction. We have already read the normal form as
well as the strong form of mathematical induction. Now today we will see different type
of problem not only mathematical, but other problems how directly or indirectly we use
the mathematical induction.

(Refer Slide Time: 00:56)

So, this session is the problem solving using mathematical induction techniques. So, first
we see one very simple problem. So, find the sum of n consecutive odd numbers, find the
sum of n number of consecutive odd integers. See normally the problem we see that
while we use mathematical induction that some well known formula or the correct
formula is given and then normally we validate it by induction or we proof that the
formula is true.

So, for this particular example that formula is not given, we already discussed this type
of problem. So, first we have to find out a correct formula and normally we do that thing
for some, taking some primitive values and then to observing the sequences and we try to

126
identify or try to frame one formula for that. So, this is sum of n consecutive odd
numbers, if we so we know that n consecutive number or numbers are that 1, 3, 5. So, n
is 2n – 1, these are the n consecutive odd integers and we have to find out the sum.

So, i = 1 to 2i – 1, or 2n – 1, or I can give, better I write, 1 to n Σ(2i – 1). I have to find


this sum.

Now, if I consider i = 1, then the sum say S1 is only 1, if i = 2, S2 is 1 + 3 = 4. 1 + 3 + 5 =


9. And if we observe the pattern or the sequences we see that S1 = 1. I can write that as if
12. This is for S2 that is i = 2, I can write this is 22, for 3 this becomes 32, for 4 this
becomes 42.

So, I am getting a compact formula for this. So, i = n, this Sn is 1 + 3 + 5 to (2n – 1) is =


n2. So, first we get a formula that it is n2. Now we have to proof by induction that this
formula is indeed true; that means, if I write that my sum = (i = 1 to n) Σ(2i – 1) = n2.
Whether this formula is true or not. So, earlier we have seen when we have discussed the
mathematical induction how to get a correct formula. So, normally this is one of the
technique that we get that thing. Now, we have to proof and we remember that to prove
this thing we have to do the two steps, we have to follow, one is the basis step.

(Refer Slide Time: 07:49)

So, basis step where we consider for i = 1, we know the n2 = 1 and the sum = (i = 1 to 1)
Σ(2i – 1) = 1, which is = 12. So, my basis step is true, it is true for n, i = 1.

127
Now, we see the inductive step, inductive step we assumed that for i = n the proposition
is true, in this case the formula for this sum the sum = (i = 1 to n) Σ(2i – 1) = n2 that is
true, sum is true. We have to proof that for i = n + 1, or we have to show that the
equation is true or the formula is true.

So, assuming that the, for i = 1 it is true and then for i = n it is true. So, for i = n + 1 what
is our expression? That our expression is (i = 1 to n + 1) Σ(2i – 1) and these I can write
that (i = 1 to n) Σ(2i – 1) + the value for the for (i = n + 1); that means, 2(n + 1) - 1. So,
this is my last element for i = or the last odd integer when i = n + 1.

Now, according to that inductive state it is true for n so this part is the first term is n2 and
this becomes 2(n + 1) - 1. So, this is n2 + (2n + 1) which is nothing, but (n + 1)2. So,
when i = n + 1 again it is giving (n + 1)2. So; that means, the formula is true for; is true
for i = n + 1. So, we can write that for all n, (i = 1 to n) Σ(2i – 1); that means, sum of all
consecutive integers up to n = n2. So, it is true; so, for all n the formula is true. So, it is
proved. So, normally, how we use mathematical induction to proof the simple
mathematical formula.

(Refer Slide Time: 12:25)

Now, we see a different type of example, but when indirectly we can apply the
mathematical induction. We take one problem statement, let a wheel of fortune has the
numbers from 1 to 36. So, wheel of fortune has the numbers from 1 to 36 painted or need
in a random manner. Show that regardless of how the numbers are painted, always there

128
are 3 consecutive numbers on the wheel whose total is or sum, it is the sum is 55 or
more. So, this is one type of game, I think all of we have seen in sum fair somewhere
that it is in a seat is a circular wheel and we have only one pointer type. See so, some
randomly say I start from 30, then 1 then 17, 9, 2 in this way sum random way it is
painted and this is this is we call that the wheel of fortune.

So, it is in this way it is. Now our and these numbers are in random manner it is printed
on the wheel, now we have to show that whatever random way or whatever way the
numbers are printed on this there are always there exist 3 consecutive numbers whose

numbers are, whose total sum is ≥ 55. So, we have to show this thing.

Now, we use mathematical induction very indirect way to prove this or statement ok. So,
the solution we do. So, we have 36 integer integers. So, let x1, x2 that x36 are the, or
denote the integers printed on the wheel, printed clockwise; that means, now we since
our numbers are not in order. So, we consider x1, x2 x36 in order and they denotes the
numbers printed clockwise on the wheel.

Since the sum of 3 numbers we have to consider. So, we first assume that if we consider
that the result is false; that means, the sum of sum of 3 consecutive numbers or less than
55, why? Because the problem statement tells that there exists or there are 3
consecutives, there are 3 consecutive numbers on the wheel whose total sum is 55 or
more. If the statement is false, if the statement is false of the result to be proved
statement is false then for all numbers this sum of 3 consecutive numbers are less than
55. Then the sum of, then the sum less than sum of 3 numbers consecutive 3 numbers are
less than 55.

Now, how many sums are there on a wheel? See we have 36 some numbers, now I can
write that numbers are the way we have taken as if this is my x1, this is x2, x3, x4, in this
way I have x36, x35, x34, in this way the 36 numbers are given.

So, from the result to be false all such 3 consecutive numbers 3 consecutive numbers say
x1, x2, x3 these 3 then x2, x3, x4 these 3, x3, x4, x5. Similarly, all these numbers this is x34,
x35, x36, x1 then x36, x1, x2 all such all these consecutive numbers must be less than some
of these 3 numbers must be less than 55.

(Refer Slide Time: 22:33)

129
So we can write that for the result to be false since for all sums, for all sums of 3
consecutive numbers we have to show that this is false. So, we can write that x1 + x2 + x3
< 55. Say x2 + x3 + x4 < 55; x3 + x4 + x5 we can continue in this way. And in this way x34
+ x35 + x36 < 55 then since it is a will; that means, circular in fashion. So x35 , x36 , x1 that
is again 3 consecutive numbers, then x36 + x1 + x2 this is also < 55. So, these are my,
these are the all possible all possible sums of 3 consecutive numbers on the wheel
numbers on the wheel.

So, how many sums are there? You can see that it starts with variable x1 or it starts with
integer x2, x3, x36. So, there are all together we have 36 sums. So, we have 36 number of
sums. Now see if we just observe that thing; that means, in these 36 sums each term each
xi appears 3 times since it is a some of consecutives 3 numbers since, it is sum of
consecutive 3 numbers. So, in these 36 sums each term or each integer xi appears 3
times.

So, we can write that 3 (x1 + x2 + x3) or 36 that will be less than 36 x 55, which is less
than 36 x 55 is if we multiply this is 1980.

Now, what is this x1 to x36 because this is the integers, sum of integers 1 to 36 only they
are printed on a different order. But when we are taking the sum these are whatever way
we take this is actually sum of integers and that should be 1 to 36 that sums are n (n + 1).
So, this sum is, sum of these number is (36 x 37) / 2 is (18 x 37) and this is equal to 666.

130
So, my LHS is 3 x 666 is this becomes 1998. Now what do you see? That these number
these 30 sum of 36 sums this becomes the 1998, but if it would be, if this is the
statement, the early the first statement we have assumed that the for the result to be false;
that means, for each consecutive number must be less than 55 then it must be less than
the all sum of 36 terms must be less than 1980. But what we see that it should be 1998
so; that means, our assumption is false; that means, that for this result to be false.

So, we the conclusion is that we have at least 3 consecutive terms. So, 3 consecutive
terms whose sum is or total is greater than equal to 55 say this is a indirect way that we
have actually proved and this is that these sums the 36 sums we have written that is
actually by induction and this is a indirect way of applying the induction.

(Refer Slide Time: 31:25)

And if we just quickly see one another example that some mathematical example say we
know the harmonic numbers. How we define that thing? We define that say Hk = 1 + 1/2
+ 1/3 + … + 1/k.

Now, there are a number of problems, the number of inequalities equalities that we can
proof on this harmonic numbers. Now, one is we can write that proof that H2 to the

power n is ≥1 + n/2 for all n ≥ 0, here we directly apply our mathematical induction. So,

what is our basis steps? So, solution for our basis step you see for n = 0. So, H20 = H1 = 1
so I can write this is = 1 + 0/2 so, this is true. So, our basis step is true.

131
For inductive step we assume for i = n, it is true for i = n the result is true ; that means,

our result is true is that H2n ≥ 1 + n/2 that is true. So, we have to show for i = n + 1. So, i

= n + 1, 2n+1 ≥ 1 + n + 1/2 that we have to show.

Now, what is H, is H2n+1? This is 1 + 1/2 + 1/3 + … + 1/2n + 1/2n+1 like that. So, up to

this is my H2n, this is H2n is 1 + I can write ≥ this is ≥ 1 + n/2 + 1/2n+1. Now how this

term I can show?

(Refer Slide Time: 35:01)

So, our H2n + 1 I can show that this is ≥ 1 + n/2 + 1/2n+1. So, I can write this thing that

because this is up to 2n. So, these term is if I know that what is our Hn ok, if I consider
my H2n+1 this will be 1 + 1/2 + 1/3 + 1/2n+1 + 1/2n+2 + 1/2n+1.

So, my Hn is only up to this term and I have these are the terms that I have to add now
what are those these terms. See I can write so this is my H2n plus see this is the lowest
term. So, when I am giving the greater than equal to then what I can write each term I
can replace by 2 n+1 since, this is my lowest term. So, this is 2n+1 + 2n+1 + 2n+1.

So, how many terms are there? Since this is H2n this is my H2n and the whole term is
H2n+1; that means, here there are 2n terms are there. So, I can write that 1 + n/2 + 2n /2n+1,

132
which is greater than equal to 1 + n/2 + 1/2 which is greater than equal to 1 + n + 1/2. So,
for H2n+1 we show that this is greater than equal to 1 + n + 1/2. So, this is proved.

So, what we have seen that mathematical induction is very, the most important proof
techniques that we have read and different type of problems not only the mathematical
things or just to verify the formula, we can also prove or verify the other type of
problems where directly or indirectly we can apply the mathematical induction. And in
computer science as well as in different fields of other science and engineering streams
mathematical induction is very much required true proof the formulas or to verify the
formulas.

133
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 16
Sets and Functions

Today, we will reach the Sets and Functions.

(Refer Slide Time: 00:26)

This is if very basic concepts in mathematics and almost in all streams of engineering
and science, we require the knowledge, the concepts of this two. So, first we read the set.

We define set, very simple way if we define the set is an, it is an unordered collection of
objects. These objects are normally sometimes we call the elements or members, called
the elements or sometimes we call they are the members of the set. Another property of
set is that unordered collection that are normally the elements we are considered these
are or these objects are, objects are distinct objects. And as already mentioned in the
definition or unordered; that means, in which order it is coming that is set is in the
definition of set we do not concerned or set is not defined. So, that is why in the
definition itself we mentioned that is unordered collection of objects.

Like we tell the set of even integers or even before that I can write normally we write the
notation is say A is a defined as the set; say it is 1, 2, 3, 5, 7. So, this is the notation

134
normally we use to define a set. So, here these 1, 2, 3, 5, 7, these are the elements or
objects of the set, these are the elements of the set and like I can tell that X is set of
positive integers or Y is set of even integers. Similarly, I can define that R is set of real
numbers and if these, if I denote that, or I can, these thing also I can write say set of
positive integers; I can write X is x such that x is a positive integer.

So, here both the definition are same. Here, if I write x is set of positive integers same as
I also can write that x is small x, x is a positive integer; that means, all x which is a
positive or x which is a positive integer that must be one element of this set. Normally,
we denote that the x belongs to X, this is the notation we use that x ∈ X.

So, normally this is the notation we use the small letter to denote the element of a set and
the capital letter which denotes the set itself.

(Refer Slide Time: 06:38)

So, normally we write that x ∈ X, here x is the element and capital X is the set. Now, just
now I give example that one set A which has only say 5 elements 1, 2, 3, 4, 5, 7, say 6
elements ok. There are 6 elements, on there can be 60 elements and I can take that x such
that x is a positive even integer. So, here the number of elements how many elements are
there only 6. So, if the set contains finite number of elements, then it is a finite set.

So, in this example A is a finite set. Since it contains only six elements, but set B, B we
have defined B contains all the positive even integers and how many positive even

135
integer we have, this infinite number of positive even integer 2, 4, 6, 8 just we 100, 100,
200, 4 there can be infinite. So, there is something called infinite set; that means, if
infinite number of elements are there in the set. It is an infinite set. So, the in how many
elements are there in the set that actually gives a type of set it is? So, number of elements
is an important thing in the set and we define that is as the cardinality of the set.

(Refer Slide Time: 09:37)

Normally, we denote so the cardinality of the set gives the number of elements in the set.

We define or we denote that as the cardinalities is in this way. So, this gives a cardinality
of the set; that means, the number of elements, is the cardinality of X. So, previous
example this is equal to 7 for finite set A. Now, there can be some set that where no
element is there; that means, I can have a, I have a set where there is no element. So,
normally this is called an empty set or null set or void; we just null or void. So, this is
defined as set having a set with no element. It is another notation we use this is the null
set now when can we set or when can you say that two sets are equal say, let we have,
we have two sets say X and Y.

So, we can tell X=Y, so, you can tell X=Y say if ∀x (x ∈ X → x ∈ Y)∧(x ∈ Y → x ∈ X).
Then, two sets are equal. So, what the meaning; that means, all elements of set X and all
elements of set Y are same, then the two sets are equal and that in propositional logic
using propositional logic, we can write X = Y if ∀x (x ∈ X → x ∈ Y)∧(x ∈ Y → x ∈ X).

136
(Refer Slide Time: 13:55)

That we know that X is a set for x set x for all we can write that ∀x, x ∈ X; that means,
small x are the all elements of X.

Similarly, if we consider y, then ∀x, x ∈ Y, then the proposition that if we get that ∀x (x
∈ X → x ∈ Y); that means, for all elements of X, again they are the elements of Y and
similarly all elements of Y implies that x this implies they are all elements of X, then if
this is true, then I can tell then two sets are equal. So, this is the way to show that two
sets are equal when we have to prove to show or to prove, then we have to show this
proposition and logic to be true.

137
(Refer Slide Time: 16:06)

Now, we take one example ok, we take one example say prove that if A={x | x2+2x-8=0}
and B = {- 4, 2}(say I have two elements) that there equal, then the two sets are equal.
So, first x ∈ A implies I have to show that for all x what we have to show,
∀x(x∈A→x∈B). So, what type of set A is? A is x such that x2 + 2x - 8 = 0. So, if I put
what x2 + 2x - 8 = 0. So, what value of x, this equation is true. So, if I solve x2+4x-2x-8.
So, this is x + 4x - 2 = 0. So, x = - 4, or x = 2.

So, x ∈ A; that means, for - 4 or 2 that if x ∈ A; that means, x = - 4 or 2. So, this implies
that if x ∈ A; that means, for all x that satisfy. So, for this case this is actually our case 1
that for all x, the x if x satisfies the equation x2 + 2x - 8 = 0, then the value of x are x = -4
and x = 2. What do you see that B is the set of elements - 4 and 2. So, x ∈ b. So, our now
what is our case 2 or case 2 is for all x, for all x belongs to b implies x ∈ A.

Now, we see x ∈ B, x is -4. So, if x = -4, then x2 + 2x - 8 = 0, it is true. If x = 2, then


x2+2x-8 = 0 true; that means, for x = -4 and 2, A; that x2 + 2x - 8 = 0 this is true; that
means it is x ∈ A. So, what we see that both the cases that for if x ∈ A, then it implies
x∈B; and x∈B implies x∈A. So, we prove that A = B since we have proved that ∀x
(x∈A→x∈B) and (x∈B→x∈A). So, this is the way we should show that if two sets are
equal.

138
(Refer Slide Time: 22:40)

Now, we define the subset, subset opposite, define subset. Suppose X and Y, suppose X
and Y are two sets. If every element of x is an element of Y, we say that X is a subset of
Y and we denote that X is a subset of Y. So, this is my notation of subset. So, we take
example is very simple example we can take, say my X is 1 and 5 and Y is the set say 1,
4, 5, 7, 9 like that. So, what we see that every element 1 is 1 ∈ Y, 5 ∈ Y. So, I can take
that X ⊆ Y. Since 1 ∈ Y, 5 is also belongs to Y and my X is 1 and 5 only.

(Refer Slide Time: 25:20)

139
So, this is my subset notation. You see the example one another example. We see that
prove, A is a subset of B where A = {x | x2 + x - 6 = 0} and B is the set of integers, B is
set of integers. So, A is all such x that satisfies these equation and we know that x2+x-
6=0; that means, for x values are (x + 3) (x – 2) = 0. So, x = - 3 and 2 and B, the set of all
integers, so - 3 is also belongs to B, 2 also belongs to B, A is actually the set of - 3, 2
because that satisfies this. So, my A is the subset of B, proved A ⊆ B.

(Refer Slide Time: 27:33)

Now, x belongs to if that using the propositional logic if we write that x ∈ A → x ∈ B.


Now, if for all x it is true if it is true for all x, then we tell that this is belongs to A ⊆ B.
So, for all x whether this is true. Now, if I write using our logic for all x, x ∈ A → x ∈ B
and this must be true. Now, say I this is one, say one proposition or basic statement I
think that p and x belongs to B another statement q. So, if it is ∀ x (p → q) if I think that
that is true where p, I have assumed that x ∈ A; and q, I have assumed that x ∈ B ok.

Now, for all x I have to show that this is true for all x. Now, if it is to be false, if my
statement this conditional statement because this is a conditional statement. So, if these
implication or conditional statement is false; that means, negation of this is true, that is
¬(∀ x (p → q)). This is true; that means, negation if this is false, then this should be true.
If this implication is false, so; that means, we remember that negation if p implies q. If
we remember the formula that p → q is equivalent to ¬ (p ∨ q). So, if I take ¬ (p → q)
which is equivalent to, we apply De Morgan’s law q is equivalent to p and negation q.

140
So, if we apply here this thing; that means, this is negation for all x, my p is x ∈ A and
implies; sorry x ∈ A → x ∈ B.

So, ¬ (∀ x) means, ∃ x. ∃ x ¬ (x ∈ A → x ∈ B). So, this is simply p q. So, negation p q


what we have seen ¬ (p → q) is (p ∧ ¬ q). So, this becomes ∃ x ((x ∈ A) ∧ ¬ (x ∈ B));
that means, I can write ¬ q is (x ∉ B). So, what we get and that must be true, this is true.
So, what we get? So, if it is a subset A is a subset of B then we tell that, A ⊆ B; that
means, x ∈ A → x ∈ B.

Now, if it is false then the negation is true and we get ∃ x; that means, there exists at
least 1 x, for which x ∈ A, but x ∉ B.

(Refer Slide Time: 34:45)

So, if we have to show that a is A ⊄ B; that means, what we see that if we want to show
that x is or A is not a subset of B for A, B and two sets then I have to then at least one
element, then we have to show that there exists at least one element, say x that which
belongs to A, but does not belongs to B, then we it is not, then A is not a subset of B,
then A ⊄ B.

And, but if I have to show that A ⊆ B, then ∀ x, we have to show ∀ x (x ∈ A → x ∈ B),


this is true. So, the summary is that if we have to show that A ⊆ B, then I have to show
for all this is the thing, and if it is not then at least like the counter example we have to
show that at least one such x exists that which belongs to A, but does not belongs to B.

141
(Refer Slide Time: 37:26)

Now, with this concept, we can use the say Set Union, we can define set union that A
and B are two sets, then this union of A and B contains elements which are either A,
either in A; that means, A ∪ B : x ∈ A ∨ x ∈ B.

Now, A intersection B, that we write A ∩ B : x ∈ A ∧ x ∈ B. So, intersection is all the


elements. So, set intersection that for sets A and B, A ∩ B contains elements that belongs
to both A and B and what we write that A ∩ B is equivalent to we write x belongs to A
and x belongs to B. And set difference, if A and B are two sets then A - B, I can write
that x belongs to A and x does not belongs to B. Similarly, B - A that x belongs to B and
x does not belongs to A.

142
(Refer Slide Time: 41:08)

So, these are my set operations. We define union normally denote by A ∪ B, intersection
is A ∩ B, and set difference is A - B or B - A. Normally, these are the operations we use
on the set. There are many other properties on set and that we will discuss in the next
class.

143
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 17
Sets and Functions (Contd.)

We have read the fundamentals of set theory, mainly the basic definitions and some
fundamental properties that we have read on set. Today’s lecture will read the basic set
operations and some fundamental properties of set. We know the subset of a set, we have
defined the subset of a set; first we see some basic definitions on set.

(Refer Slide Time: 01:08)

So, if A and B are two sets and for all elements x for all x, x ∈ A if it implies that x ∈ B;
that means, all elements of A are also the elements of B, then we have defined that A ⊆
B. Now, if A is a subset of B and A not equal to B; A ≠ B, then we called that A is a
proper subset of B and the notation is the A ⊂ B.

So, this is our subset notation, this is our proper subset notation. Now, we define another
properties of subsets of a set is called the power set. We define power set. So, this is the
set of all subsets may be proper or not, proper subset or not of a set. So, this is called the
power set. So, set of all subsets of a set. You see one example say we take one, set
consider one set A which has three elements say a, b, c. Now we define the power set of

144
A and normally we denote as the P(A) so, it is the set of all subsets. So, what are the
subsets of {a, b, c}? First is null set, {Ø} is one subset, then sets have been only one
element like {a} only {b}, {c} or two elements say {a, b}, {a, c}, {b, c} and all three
elements {a, b, c} these are the all possible subsets of set.

And other than {a, b, c} other than these subset all are proper subset of A, only this
subset {a, b, c} is the only one subset is equal to A. So, this is my proper or power set.
Normally we denote this thing as a notation is P(A). Now what are the cardinality of the
power set? The cardinality of power set P(A) is, here see that if it is only 3 elements,
then this is 8. So, this is actually 23. So, this is my cardinality of power set. Now, see this
is a general rule that if I have an n element set, then the power set cardinality of power
set is 2n. Let us put that thing in a theorem.

(Refer Slide Time: 08:21)

So, I give you theorem, but if |A| = n then cardinality of |P(A)| = 2n. Now how to prove
that thing? Before we give the proof so, we consider the previous example let A be a set
that A equal to 3 elements like {a, b, c}.

Now, just now we have seen that the power sets are, power sets are like { Ø }, {a}, {b},
{c}, ... Now we see some properties. See these are all the subsets of A. Now if we
observe there are two different classes, what are those subsets? One of the subsets having
element a say, one particular element “a”. I am considering and subsets not containing
element “a”. So, we see that what are the subsets having element a. This is one {a}, {a

145
b}, {a, c} and {a, b, c}. So, we put that a subset {a}, {a b}, {a, c} and {a, b, c}. These
are the four subsets that contain the element “a” and the remaining they do not contain
the element “a”; one is the null set, then it is {b}, it is {c} and it is {b c}.

So, the property we see that in both the subset both the classes that number of elements
are same. Here it is 4 number of elements; this class contains 4 number of subsets. This
class also 4 number of subsets. So, we will use this property to prove the theorem. Now
we will give the proof by induction. So, we will see the proof by induction.

(Refer Slide Time: 13:09)

So, the conjecture is that what we have to prove the cardinality is n; that means, in n
number of elements we have to prove the |O(A)| is 2n. So, we consider the basis step. For
basis step we consider for n = 0; that means, the what is the power set is n = 0; that
means, it is only one element that is the empty set or { Ø }. So that means, the cardinality
of power set is 1 and we know this is equal to 20.

So, for the basis step; that means, n = 0, the conjecture is true. So, basis step it is true for
n = 0, it is true. Now what will be our inductive step? For inductive step, we assume that
for n, for value of n the conjecture is true. So, assume that if |A| = n, then |P(A)| is 2n; this
is true. So, we have to prove that if the |A| is n+1, then we have to show that the |P(n+1)|
is 2n+1. And, then according to the principle of mathematical induction; it is to be proved.

146
Now, say I have n element, say here we assume for n it is true; that means, we have
considered, we consider that the set as n number of elements. Now, we add a new
element say, “a” is added to the set A. So, that the total number of elements of A
becomes n + 1; that means, now the new cardinality of A is n + 1. Now, just now the
property we have seen that when we have added a new element “a” so, we get.

(Refer Slide Time: 17:59)

So, for the set A whose cardinality is n + 1, then we have or we can get 2 classes of
subsets; we have 2 classes of subsets. The first one type of class or one category contains
the element ‘a’ in all the subsets. The second category do not contain; that means, all the
subsets do not contain the element ‘a’.

Now, which do not contain ‘a’, which is nothing but the previous set. So, this do not
contain ‘a’ is it is the set A, or I should tell the old set a old set A having n element only.
Having n number of elements because the element we have just introduced. And the first
category contains the element ‘a’ only and just now the property we have seen that
always this is the half of the subsets that contains a particular element ‘a’ and half of the
subset that do not contain a particular element ‘a’. That means, if we consider these, say
these are old elements set, say this is the power set of Y; that means, this is power set of
Y having or we write that P(Y) is the number of all subsets that do not contain ‘a’.

And if P(X) represent all the subsets of A having n + 1 elements; that means, after
inserting the new element ‘a’ then clearly that P(Y) is or cardinality of P(Y) is the

147
cardinality of P(X) / 2. Since from the property we have seen, this is the property we
have seen that always if we consider one specific element the half of the elements
contains one particular element and half of the subsets that do not contain that particular
element. So, seeing applying that property that P(Y) is that continuity of P(X) / 2.

(Refer Slide Time: 23:19)

So, the |P(X)| is 2 x P(Y). And what is cardinality of P(Y)? |P(Y)| is the cardinality of the
power set having n elements. And according to that inductive step that we know we
have, we know that this is 2n, since the |P(Y)| is 2n. So, this becomes 2n+1.

So X, we have consider the P(X) all the subsets of ‘a’ having n + 1 elements and we
proved that this becomes the cardinality is 2n+1. So, we can conclude that for all n we can
conclude then for all n, all values of n the cardinality of P(A) is 2n where ‘a’ is a set of n
elements. So, our theorem is proved. Now, we see some set operations.

148
(Refer Slide Time: 25:45)

So, we have already defined. So, the different type of set operations that it can be binary
operations or it can be unary operations and there can be some special operation. So, we
have already read that set union. So, if we consider 2 sets A and B; A and B are 2 sets,
then set union normally we define this is the notation A ∪ B; that means, it is defined
that the elements it contains the elements are either in A or in B or both. We have read
the set intersection. We denote and the elements this is the set containing the elements
which are in A and B, and set difference the elements that are in A, but not in B.

So, we see these are all binary operations; these are binary operations. If we take an
example so, we take one example say A is 3 elements set {1, 3, 5} and B is another set
say {2, 5, 7, 8}. So, what is our A ∪ B? So, either in A or B or both; that means, {1, 2, 3,
5, 7, 8} these are the elements; like 5 is element 5 is both in A and B and other elements
either in A or B. What is A ∩ B? A ∩ B is only {5} because the element which is both in
A and B is only 5. What is difference A? A - B which are in A, but not in B and there are
only 2 elements that {1, 3} which are in A, but not in B. Then what is B – A? what is B -
A? B - A is {2, 7, 8}. So, these are the elements. Now, we have defined that null set.

149
(Refer Slide Time: 31:07)

Let me set does not consider normally we define as this notation {}, or empty set; so, no
element in the set. Now we define another set called the universal set and the concept is
that most of the time we deal with the sets or the subsets of a larger set. Say let A, B, C
we are working that A, B, C are the 3 sets we are working on and A, B, C are the subsets
of a larger set. Say this is larger set is called U, say U, then these and these are all proper
subset say, B is proper subset of U, C is also a proper subset of U; not equal. So, then U
is the universal set or sometimes we call universe or universe instead of these 3 there can
be any.

So, that what the number total number of subsets under which are the subsets of proper
subsets of A larger set we call this is the universal set. Now, with these basic definitions
and some of the fundamental operations we have seen that some binary operations like
union, intersection and the set difference. We will again read that some properties and
some more operations that are very much important when will be handling some
practical problems using set.

150
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 18
Sets and Functions (Contd.)

We are discussing about the set operations, we have read the set union, set intersection,
set difference and now we read another operation, which is very important is called the
Cartesian product of set.

(Refer Slide Time: 00:41)

We have defined a set as an unordered set of elements, unordered collection of elements.


So, if we consider two sets say, A and B; consider two set A and B having some
elements. Now, Cartesian product of A and B are the set of all possible ordered pairs of
elements of A and B is defined as the set of all possible ordered pairs set is unordered,
but Cartesian product is ordered pairs of elements of A and B.

Normally, we denote the product as the A X B. So, we denote the product say P=A X B,
take one example. Let the two sets we define like A is {1, 2, 3}, 3 elements and B having
2 elements say {a, b}. So, A X B is the Cartesian product; is the Cartesian product of A
and B and these are set of all possible ordered pairs. So, since A comes first so, it is the
ordered pair. So, set of (1, a), (1, b), then (2, a), (2, b). This things the simple pair we
take {(1, a), (1, b), (2, a), (2, b), (3, a), (3, b)} and we can if I just give a tree type of
structure say give tree type of structure, say A X B. So, A has 3 elements, say {1, 2, 3}
and B has 2 elements {a, b}.

So, if we see as if this is my A X B. So, we get (1, a), (1, b) this is {(1, a), (1, b), (2, a),
(2, b), (2, a), (2, b), (3, a), (3, a), (3, b)}. So, we get all possible pairs. So, what is the
cardinality of this set? So, | A X B | is | A | x | B |. So, in this case | A | is 3 and | B | is 2
so, this is 6. So, this is equal to | B X A |, what is | B X A |? So, if we see that B X A then

151
B has 2 branches 2 elements. So, 2 branch a and b and a has 3 elements, 1, 2, 3. Since,
now the ordering is changed so, B X A is (a, 1), if I take B X A is (a, 1), (a, 2), (a, 3), (b,
1), (b, 2), (b, 3), (b, 1), (b, 2), (b, 3).

So, clearly the |A X B| is |B X A|, but see the A X B is this set {(1, a), (1, b), (2, a), (2,
b), (3, a), (3, b)} and B X A is the set {(a, 1), (a, 2), (a, 3), (b, 1), (b, 2), (b, 3). So, the A
X B ≠ B X A, because the two sets are different since, it is considering an order. So, here
elements of A are coming first and in the pair of B X A elements of B are coming first.
So, that we can write that A X B, clearly my A X B that Cartesian product of A X B is ≠
B X A, since it is an ordered pair ordering is ordering matters here. So, what is our A X
A or B X B?

(Refer Slide Time: 09:27)

So, if we consider the Cartesian product of the set itself A X A, A is the set {1, 2, 3} the
same example if we consider. So, similarly we can get this is the pair {(1, 1), (1, 2), (1,
3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3)}, these are the all possible pairs. Similarly B
X B the Cartesian product of B only. So, this is {(a, a), (a, b), (b, a), (b, b)}. So, again
this is one binary operation like set union, set intersection, set difference.

So, we have read that 4 binary operations; union, intersection, difference and the
Cartesian product on sets these are the 4 operations binary operations. Now, we read
another very important thing that a different type of representation or some pictorial view
of sets, which we can see as a tool, which is very much used or to do some operations on
set.

152
(Refer Slide Time: 11:45)

So, it is called the Venn diagram, we use the Venn diagram so, we define Venn diagram.
As if this is a pictorial view of sets, it is an end or tool to work on the sets and the
different operation subset ok. So, let A, B are two subsets of the universal set U. Now,
we have read binary operations, one unary operation, we call the compliment of a set is
defined as the number of elements is the elements sorry not number, this is the elements;
defined as the elements, which are not present in A if we consider the complement of A;
that means, if I normally we denote this thing as a A complement. So, A complement is
the set of elements that are not in A is the set of elements that are not in A.

So; that means, if I consider that universal set U and A is the subset of U. So, I can tell
that this is U - A; that means, U - A contains those elements which are not in A. So, we
define this unary operation this is one unary operation that complement. Now, how we
represent the these sets using Venn diagram?

(Refer Slide Time: 15:18)

153
Say we universal set, since it is a pictorial view. So, universal set is represented as a
rectangle and the subsets or subsets of universal set or normally, we call the sets are
represented as circles as circles. So, if A and B are 2 sets and U is the universal set then
we can represent this thing as say, this is my universal set U, and this is A say this is B.
So, if I give the notation, this is U say these circle a first circle that is say A second
circle, this is B these are the sets. Now, I give some region as if this is 1 region, I, II, III
and region IV. So, what do we mean by this region? So, region I contains the elements, I
give all the region what they represents. So, region I contains the elements that are in the
universal set U, but not in A or not in B. So, these are the set of elements. So, region I
covers the elements neither in A, in set A or in B.

Region II, region II is the elements in A only, but not in B, but not in B, region III that
elements that are both; that are in both in A and B that are in both A and B and region IV
like the elements in B, but not in A. So, normally we represent in this way that using the
rectangles and using the circles and with these notations that are the elements we cover.
So, see what do you mean by region II? Region II is both are in the elements that are in
both or region III, the elements that are in both A and B, region III in both A and B. So,
we know that both A and B; that means, A intersection B.

So, region 2 is actually intersection of A and B. So, elements in A, but not in B region II,
these we can simply write A - B set difference similarly, region IV elements in B, but not
in A. So, I can tell B - A, this is the elements neither in A, neither in A or in B. So, this is
if I consider this is A ∪ B. So, if I consider this is A ∪ B; that means, they are either in A
or B or both. So, neither; that means, it is the complement; that means, this is U–(A∪B).
So, the pictorial representation, how we define the pictorial representation though
different regions actually represents the different sets or the different operations on the
set like these A ∪ B, A ∩ B set difference, A - B or B - A or this is the complement of
the union of 2 sets. So, normally with this picture we can use in this way. So, if I just see
that more on Venn diagram that examples.

(Refer Slide Time: 23:04)

So, if I consider simply A ∪ B; simply A ∪ B as you usual or U is the universal set we


are two sets and U is the universal set. So, we can write this is my universal set this A

154
this is B. So, A ∪ B; A ∪ B is this thing. So, this is our A ∪ B, all right this is A, this is B
and this is my U so, the shaded portion is A ∪ B. Similarly, the intersection, A ∩ B
since, both in A and B. So, this is my, this is my A ∩ B.

Now, this Venn diagram is used to solve the problems dealing with sets, the very easy
way we can solve the problems using Venn diagrams. So, Venn diagram is used to solve
the problems with sets of that deals with sets and we see 1 example and then it will be it
will be some 1 class of problems that normally very easy way we can solve using Venn
diagram. So, we take 1 example.

(Refer Slide Time: 26:42)

We write the problem say among a group of 165 students, 33 students are taking
mathematics and computer science, 20 students are taking mathematics and physics and
24 students are taking physics and computer science. 8 students are taking all 3 subjects
physics mathematics and computer science. Then 79 students are taking only
mathematics are taking mathematics, if I consider separately 83 students are taking
physics and 63 students are taking computers science. The question is that how many
students are taking none of the subjects, none of these 3 subjects among these 165
students?

So, this is clearly a problem of set union intersection set difference using mainly these 3
operations. Since already, we have seen that how using Venn diagram, we can represent
the set difference union intersection. So, we try to solve using Venn diagram and that is a
very easy way that we can solve this problem.

155
(Refer Slide Time: 31:26)

So for this problem, if I draw the Venn diagram first. For this problem, we draw the
Venn diagram. So, this is my universal set that U is 165 students. Now here, I have 3
sets, one is my mathematics, one is my physics and physics is 83 students. So, slightly
bigger set another is that of my computer science, this is my computer science. So, this is
my I represent M the mathematics the set of students, who are taking mathematics, set of
students who are taking physics, set of students who are taking computer science by C.

So, let M is the set to students taking mathematics, C is the set of students taking
computer science, P is the student set of students taking physics. Now, we have seen that
8 students take the all 3 so, if I just draw this thing. So, this should be 8 so here, it will be
a 8. Now, if we consider the 20 students are 33 students are taking; 33 students are taking
maths and mathematics and computer science. So, this is my mathematics, computer
science and physics.

So, we take that this is my 25 + 8 together they are taking similarly, my 24 students are
taking 25, 24 students are taking physics and computer science. So, this will be my 16
and similarly 20, 20 students are taking maths and physics. So, this will be 12 now, I
have mathematics students are 79, physics students are 83 and computer science students
are 63. So, clearly that I can write these only mathematics students are who are taking
only mathematics student here that will be 79 - 3, we have to cut; that means, 12 + 8 + 25
difference, we take and this will be clearly 34. So, I can write here it is 34. Similarly, if I
take only physics student and only computer science student, we can write 12 + 8 + 16,
is equal to 47 students. So, only physics students are taking 47 and here I can take 25 + 8
+ 16 is 63 - 49 is 14 students are taking only computer science.

Now, we get that all union of the set of mathematics physics and computer science
students that are together, if I take it will be 156 students and since our universal set; that
means, all students will be 165 students. So, the students who are not taking any of the
subjects that is clearly that U minus that union of this; that means, 165 - 156 and this is
equal to the only 9 students. So, we get this is my result that 9 students are not taking
none of the subjects, not taking any of the subjects. So, this is a very common tool of
solving problems using set using the Venn diagram mainly the set operations.

156
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 19
Sets and Functions (Contd.)

So, last lecture we have read the some basic properties of set and mainly the operations
on set. Today you will see some very useful properties on sets using the binary and the
unary operations on the sets and mainly these are the properties that are very useful to
solve the problems using sets. So, first we list those properties and we can prove later the
all the all these properties. So, first thing is that some useful properties of sets.

(Refer Slide Time: 01:04)

So, we consider three sets and a universal set U. So, let U be an universal set and A, B, C
are three subsets of U. So, the following properties hold on A, B, C and U and all the
operations that we read on set and any of these property actually we can write as a
theorem since, we can prove these properties also. So, the first property give the serial
number 1 and this is something called the, we call these properties as the laws since we
can prove this property. So, this is first is associative laws of set.

So, we have operations on, here we have we consider these three sets and the operations
are union, intersection and set difference, we use this thing. So, associative laws we can
write if we take union of two (A ∪ B) ∪ C this is same as that of A if I take A ∪ (B ∪ C)

157
and for union operation whatever law is valid, that is true for intersection also. So, if we
write if we just replace union by intersection we will get (A ∩ B) ∩ C that is same as A
∩ (B ∩C).

Now, we see the commutative laws, if I consider only two sets here. So, A ∪ B is B ∪ A
and similarly I can tell A ∩ B is B ∩ A.

(Refer Slide Time: 05:11)

So, if we continue the third rule there is the important distributive laws on sets, we write
that A ∩ (B ∪ C) is (A ∩ B) ∪ (A ∩ C). If we exchange the operations that intersection
and union that is same A ∪ (B ∩ C), later we can prove this distributive laws.

Now, identity laws so, if I take the union of a set A with my null set then we will be
getting A only because null set means these having no elements and union is that
elements which are either in A or in the null set. So, it is actually thus we can tell this is
addition. Similarly if I take A intersection with my universal set then again this is the set
itself so this is as if the identity. Now I have the complement laws. So, A ∪ A’ is the
universe only, because if I take the subsets of A and A’; that means, all the elements of
universal. Similarly if I take A and intersection A bar then this is actually a null set,
because these are A and A’ are the disjoint sets having no common elements they are
disjoint.

158
Then idempotent law; so, if I take A ∪ A which is A itself, similarly if I take A ∩ A this
is A itself.

(Refer Slide Time: 08:54)

7th law I can tell it gives some thing on the bound. So, this is the bound laws either lower
bound or the upper bound. So, A union with universal set is the upper bound that the
universe only. Similarly if I take the A intersection with the null set which is the lower
bound is the null set. Now, I have absorption this is very much important when we try to
simplify some set operations.

So, absorption is A ∪ (A ∩ B) is A only, similarly if I exchange intersection and union I


will be getting A only. Now, involution if we take the double negation of to a
complement of set; that means, A complement of complement that is the set itself then
our something called the 0/1 laws. That means, if I take the compliment of my null set
that is nothing, but my universal set and if I take the compliment of universal set which
is my empty set or the null set.

159
(Refer Slide Time: 11:17)

I have another laws left which is the our well known De Morgan’s law on set De
Morgan’s laws for set and the operations are union and intersection and the complement.
So, we can write that if I take (A ∪ B)’ of that I will get the A’, union is replaced by
intersection, and B’. Similarly if it is (A ∩ B)’ this will be A’ ∪ B’ and we can prove.

So, these 11 laws; the these 11 laws on set though we are telling these are the property
actually any one of this law we can prove this law on set that we can prove logically. So,
they are sometimes we call these are also the theorems on set. Now, we see that how to
prove some property, first we consider on say commutative law; the very simple one first
is consider.

160
(Refer Slide Time: 13:10)

So our, this is my law 2 that we told that A ∪ B is B ∪ A or A ∩ B is the same as that of


B ∩ A. So, this is one set say first we the first part we take this one and we prove equal
this is part A; we call this is my part A and we prove part 1 and we prove that thing. So,
proof of part 1 and similarly we can prove part 2. How we can prove? So, see these are A
union B, if this is one set similarly B ∪ A is a set. So, let x be an element of A ∪ B. So,
how we can show that two sets are same? If we have to show that X = Y then we have
two that if (x ∈ X → x ∈ Y) ∧ (x ∈ Y → x ∈ X) for all x, we have to prove this thing.

So, first we say let x be an element of A ∪ B. So, since x ∈ A ∪ B since it is a union; that
means, x is either x ∈ A or x ∈ B because either A or B or both. So, I can write that x ∈
B or x ∈ A; that means, x belongs to same as that of x ∈ B ∪ A. That means, if I consider
that if x be an element of A ∪ B I have considered then I have shown that x ∈ B ∪ A also
so; that means, (x ∈ A ∪ B → x ∈ B ∪ A). Now we have to show this is for all x this is
for all x. So, this is one we have shown now we have to show that if I consider x belongs
to.

161
(Refer Slide Time: 16:49)

Now, for the reverse one that let x ∈ B ∪ A; that means, again I can tell that x ∈ B or x ∈
A. So, I can again I can write x ∈ A or x ∈ B. So, I can write x belongs to A or B. So,
what I can write that for all x for all x that (x ∈ B ∪ A → x ∈ A ∪ B). So, this is my 2.

So, for all x we can show the first one and from 1 and 2. So, you can tell from 1 and 2
that for all x that (x ∈ B ∪ A → x ∈ A ∪ B). So, I can tell that B ∪ A = A ∪ B. similarly I
can take I can prove that the intersection also. So, my commutatively or commutative
law of set laws on set is proved. So, this is, this is trivial. We proved the distributive law
ok.

162
(Refer Slide Time: 19:03)

We proof of distributive laws of set ok. Now, we write one part one of the distributive
laws that A union or x A intersection B union C equal to A intersection B union A
intersection C, or I can write A ∪ (B ∩ C) is (A ∪ B) ∩ (A ∪ C) again similarly I can tell
this is my part 1 and this is my part 2. So, it prove the part 1. So, take the proof of part 1,
again the same logic say I can tell my LHS this is my x this is my x this is my y. So, X =
Y we have to the logic is that for all x we have to show that x ∈ X → x ∈ Y and x ∈ Y →
x ∈ X.

So, let x ∈ X means A ∩ (B ∪ C). I have assumed that my; that means, I can tell that
what I have assumed x ∈ X here X is A ∩ (B ∪ C) and Y is that (A ∩ B) ∪ (A ∩ C) ok.
So, what does it mean physically? That if x belongs to A intersection from the definition
of intersection and union since it is the intersection; that means. So, x belongs to A and
because it is a intersection so this is this is and x belongs to B ∪ C ok. So, x belongs to A
this is constant and so it is there I take this is always there.

Now from this x ∈ (B ∪ C) what we can write? Now these it means that x ∈ B or x ∈ C.
So, now, if we consider; that means, I have this and that means if I consider now I can
write that x ∈ A and x ∈ B or since x ∈ A and so x ∈ A or this is and x ∈ C.

So, this is one part this is one part I can write now this is and again this is this is and this
is and this is or. So, I can write that x ∈ A and x ∈ B the first I can write this is equal to x
∈ (A ∩ B) since it is and x ∈ (A ∩ C) and this or this or I can replace by union, this

163
should be a union. So, now, what I get x belongs to A union B, A intersection B or; that
means, union x belongs to C. So, how I can write this thing how if I now just right x ∈
(A ∪ B); that means, (A ∩ B) ∪ (A ∩ C). So, I started that x belongs to we have assumed
let x ∈ (A ∩ B) ∪ C and which implies that x belongs to which implies that x ∈ (A ∩ B)
∪ (A ∩ C).

(Refer Slide Time: 25:48)

So, the first thing what we have assumed that; that means, that x ∈ A ∩ (B ∪ C) implies
(x ∈ (A ∩ B)) ∪ (x ∈ (A ∩ C)); that means, these and this is for all x; for all x. So, this is
we get for all x can tell for all x I get this is one implication 1. Now if I consider let x ∈
(A ∩ B) ∪ (A ∩ C), since from the definition of union then I would write; that means.
So, the x ∈ (A ∩ B) or x ∈ (A ∩ C). So, x ∈ (A ∩ B) means x ∈ A and x ∈ B and this or
again I can write or x ∈ A and x ∈ C. So, again here we see that x belongs to a in both
the cases that x must be A.

So, I write this x belongs to A both the cases it is there and if I consider in this way and
this is here this x ∈ B or x ∈ C. So, same as that I can write x ∈ A and together I can
write this x ∈ B since it is odd so it is union C. So, x ∈ (B ∪ C) and x ∈ A. So, this is
same as x ∈ A and means union and this intersection and is intersection and this is B ∪
C. So, what we have assumed? We assume that x belongs to this set and we infer that
they or it implies that this. So, I can write now that. So, we can get that for all x for all x
x ∈ (A ∩ B) ∪ (A ∩ C) → x ∈ A ∩ (B ∪ C) this is my 2.

164
So, since for all x, x → x ∈ A ∩ (B ∪ C) remember that x ∈ X → x ∈ Y and x ∈ Y → x
∈ X for all x and then this is nothing, but my X = Y. So, here from 1 and 2, from 1 and 2
we can infer that my X is A ∩ (B ∪ C) and Y is A ∩ (B ∪ A) ∩ C. So, it is proved. So,
my part one of my distributive laws of set is proved and similarly we can prove the part
two also. So, in this way any one of the 11 laws that we have enlisted that we can prove.

(Refer Slide Time: 31:31)

Quickly we can see the proof of our De Morgan’s law proof of one De Morgan’s law. If
we take the De Morgan’s law one part that this is this is a law set. So, again I can similar
way I can take that let x belongs to this is my X say this is my X and this is my Y. So,
the similar way I can tell that this is A ∪ B’. So, if x ∈ A ∪ B; that means, x does not
belongs to A ∪ B because if it exists in the complement part if I remember the Venn
diagram also. So, this is these x must not be in that a union b. So, if I write; that means, x
does not belongs to A since it is union. So, or x does not belongs to B; that means, x
must not be in A or in B or anywhere in A or B.

So; that means, x ∪ A’, since we are in the universal set U similarly I can take x ∈ B’. So,
what it means? That means, x ∈ A’ and here it will be and B complement A complement
and B complement because x must not be in A, x must not be in B; that means, x must be
in A’ and must be B’. So, we can tell that when we have taken that x ∈ A ∪ B’ that
implies x must be A bar and x come must be in the B bar complement; that means, x

165
belongs to A ∪ B implies x ∈ A’ ∩ B’ or I can other way I can x ∈ X because this is my
X that implies belongs to Y and this is for all x we have done.

(Refer Slide Time: 35:10)

So, this is one similarly the same way if I consider. Let x ∈ A’ ∩ B’ since we have taken
the union. So, this means x ∈ A’ or x ∈ B’ then x does not belongs to A and x does not
belongs to B. So, x belongs to either A’ or B’; that means, x does not belong to A and x
does not belongs to B; that means, x does not belong to A and B; that means, x does not
belong to A ∩ B. So, x ∈ A ∩ B’. So, x for all x what we get? That x ∈ A’, B’ implies x ∈
A ∩ B’.

So, this is my two. So, again from one and two we can infer that X = Y; that means, X is
my A union A intersection B union inverse is the and that is A bar complement B bar
and this is the one part of De Morgan’s is proved. So, in this way that any one laws that
we can prove using the elements of set whether they are they exist in some set or whether
they do not exists in the complement in this way mainly from the concept of the set the
complement of a set and the three operations that we have read on the set mainly the
intersections, the union and the complement of the set.

So, we have read the fundamentals of set the operations the basic definitions and now we
can proceed for that functions and relations using this set where, these basic concepts of
sets are very much required. And, as we have started with the discussion that this is the

166
very basic concept the set is the very basic concept of any mathematical streams
mathematics computer science or any discipline we required this concept.

167
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 20
Sets and Functions (Contd.)

Now, we have read the fundamentals of set, we know that what actually we mean by the
term set and the different set operations or the different laws that we can apply on set.
So, today will read the function.

(Refer Slide Time: 00:39)

First I give the idea of function, say is a very simple example let a car travels with a
constant velocity, constant velocity say v for a time t. So, we know the distance travelled
by the car say d equal to v t, since it is a constant velocity

Now, let v is 100 kilo meters per hour and the car travels for t hours, simply we know the
distance d equal to 100 t. Now these equation 1 we know that this is distance is a
function of time, distance is a function of time. That means, d is a function of t normally
we write d is a function of t. What do we actually mean by these? Now say I take
different values of t since time t is time. So, t can be some real positive number, positive
real numbers, real values it can take so, it can take positive real numbers. So, see initially
I am taking only integer value say for t = 1. So, my d = 100, say for t = 2, d equal to 200;
t = 3, d = 300 like that since it is a constant values 100. So, I can get this type of value.

168
Now, see for each t = 1, 2, 3 that for these value d is assigned a value 100, 200, 300 like
that. So, we can write now that if I draw in these way as if that this is something called
the my time as if I am denoting the time here and this is my distance, this is my distance.
So, my t can be 1, 2, 3 or give that values t can take these values 1, 2, 3 this t can take
values and for these my distance can be say 100, 200, 300 like that.

So, now if I connect; that means, if I give this thing that it will be a pair, as if it is a pair
of t d, this a pair this t d pair and that pair will be 1, 100; to 2, 200; 3, 300 in that way it
will go. That means, this is now if I connect as if as if 1 and 100 will be connected, 2 and
200 will be connected, 3 and 300 will be connected in this way it will work. So, this is
one example of a function that I can write that this is an f and it gives you that some t to
d and see last time we have read the Cartesian product.

Now if I consider that my, all these time values as if this is something one set called X, X
consists of all the time values that the car travels. And, this is the distance travel if the, it
is a set x then I can tell that this is all the Cartesian product or a subset of the Cartesian
product. So, this is a subset of the Cartesian product. So, this is a subset of X x Y, that X
Cartesian product Y, I can write in this way. So, this is the concept of function. So, now
formally we can define function, the definition of function.

(Refer Slide Time: 07:15)

So, let X and Y be two sets, plus just now we have the example we have defined as if X
is the set of all real numbers denoting my time, Y is the set of values the distance

169
travelled. Now a function from X to Y, the set X to Y is a subset of the Cartesian
product. X Cartesian product y for each x belongs to X there is exactly one y belongs to
Y with x y belongs to f.

So, how I define that X and Y be two sets a function from X to Y is a subset of the
Cartesian product X cross Y such that for each of the element of the set x, x belongs to X
there is exactly one y belongs to Y with x y belongs to f. Normally, we denote that f is
we denote like f the function is X to Y this is my function and here X is called the
domain of f, domain of the function f, Y is called the range of function f.

Like the previous example that we have taken the t as the positive real numbers. So,
when we have considered set x having the values all values of t’s then the domain is
positive real number, similarly my d is also the positive real number. So, here domain
and range all are positive real numbers. So, now we take some example, simple example
of function.

(Refer Slide Time: 11:19)

Some simple example of function we see. So, we need two sets let the X is only 1, 2, 3
these are the, and Y is I take a, b, c. Now, if I draw the X so this is my set X and this is
my set Y, I give only two values 1, X has three elements only and y has also 3 elements a
b c. Now normally we represent pictorially by the function as by arrow diagram. So, we
use the arrow diagram; that means, we already have seen their function assigns a value of

170
for each value of X to some value of Y and that will be exactly one, exactly one value of
Y is assigned.

So, if I give arrow diagram we will draw one arrow from element of X to element of Y,
say I give a arrow here then 1 to a, 2 to b again I put 3 to a. So, since the function we
have defined as a subset of Cartesian product. So, here the subsets on Cartesian product
is nothing, but the ordered pairs. So, it is 1, a; 2, b; again 3, a so this is a function. Now,
if I consider, if I consider say a different type of assignment, again this is X, this is Y say
I have 1, 2, 3 and here a, b, c. I give some arrow that say 1 is connected to a, again 1 is
connected to b, 2 is connected to c, 3 goes to b.

See here this is it is not a function so; that means, these arrow diagram it gives that f
equal to 1, a; then 1, b; then 2 c; 3 b. So, this is not a, this is not a function, why? See
here 1, a and 1 b; that means, that it violates the definition that or the assignment that 1 is
connected to both a and b. So, this is for this reason that it is not a not a function, not an
example of a function.

(Refer Slide Time: 16:00)

Now we take another example, say again that same X = 1, 2, 3 set and Y = a, b. So, if I
take X and Y I take 1, 2, 3 and this is a, b then say 1 is connected to a, 2 is connected to
b, but 3 is not connected. So, again this is not a function because the definition tell for
each X. So, since we do not have here we do not have any, we do not have any

171
connection for 3, we have only the set here f is 1, a; and 2, b but we do not have 3. So,
this is not a not a function, this is not a function.

Now, we have just now we have seen that this is that function r, last example that this is
say a many to one; that means, both 1 and 3 is assigned to a, or it can be that only 1, a; 2,
b; 3, c that type of function can be there. So, for based on their assignments that that one
value of X is as how it is assigned to another set. So, we can define that the different type
of function.

(Refer Slide Time: 17:54)

So, normally the type of functions are; we have three type of functions are there. One is
called the one-to-one function, this is a one-to-one we called it is or injective. We have
onto function it is called surjective and one is one-to-one as well as one-to-one and onto
and onto and this is called bijective function.

Now, we see that how they are different or how their assignments are from one set to the
other set that X to Y how they differ. So, first we see that one-to-one function, you see
one to one. So, if was with the definition that a function from X to Y, a function from a
set X to Y is said to be one-to-one or what we call the injective if for each y ∈ Y. That
means, for each element of Y there is at most one x ∈ X with f(x) = y.

So, here for first thing is that for each y ∈ Y and we have at most one x ∈ X this is my
mapping.

172
(Refer Slide Time: 21:34)

So, if I take one example that say I take the same example of X to Y. 1, 2, 3 here a, b, c
as if X is 1, 2, 3; Y is a, b, c and my function is given as here 1, a; 2, b; say 1, a; 2, b; 3, c
then if I give the arrow that 1 is assigned to a; 2, b and 3, c. That means, for each element
of Y; that means, for each value of a, b, c at most one value is given ok, at most one.

So, if I take the same example say I have I have 1, 2, 3; I have a, b, c then say a is
connected to b, 2 is connected to a, and say c is not connected then also it is a because
for if we see the definition that for each y there is at most one f ok. So, here c is not
assigned any value. This is so, this is a function ok, c is not connected or assigned, but if
I take this type of example. So, it is a function, but it is not a not one to one function, not
a one to one function, it is not a one to one function.

173
(Refer Slide Time: 24:39)

So, what is the condition to be satisfied for a function to be onto? The condition to be
satisfied for a function to be onto one-to-one first, one-to-one I write that for all x1, and
for all x2; if I consider two values then f(x1) = f(x2) implies x1 = x2; this must be true.
That means, if I get some f(x1) = f(x2) then x1 must be x2 that last previous example we
have seen. So, this must be this is the condition to be true.

So, if it is not a one-to-one if it is not a one-to-one then the above condition must be false
then, if I give some number that the condition one must be false. So, if I take the
negation of that thing, if I take then that negation must be true; negation must be true. If
it is not one-to-one, not a one-to-one function, then if I apply the negation rule then I get
there exist x1 and there exist x2. And, this is negation of f(x1) and if I remember that
negation p to q; that means, negation p or q this is equivalent to p and negation q because
negation p or q. So, this is p and negation q. So, directly I can write that, directly I can
write that f(x1) = f(x2) and x1, negation x1, x = x2 means x1 not equal to x2.

So, this is the condition we have to show or this is the condition that we can if it is true
we can show that the function is not one-to-one. So, whenever we if exact and problem is
given we have to show that the function is one to one then we have to we have to show
equation 1. And if we have to show that function is not one-to-one then we have to show
this thing; that means, there exists x1, x2 for which f(x1) = f(x2) and x1 not equal to x2. So,
if we take one example, that one example you see.

174
(Refer Slide Time: 29:09)

Say prove that 2n – n2. So, if n, f(n) = 2n – n2 is not a one to one. So, not one to one then
we have to show that f of x1, x2; and x1 not equal to x2 there exists some value there exist
some x1 and x2. So, now if I take that n = 2, and n = 4 because I have this is x1, n = 4
some I have x2 say. Now what is f(2)? f(2) is 22 - 4 is 0; I have f(4) is 24 - 42 is 0. So,
what we see that f(x1) = f(x2) and x1 not equal to x2 ; that 2 not equal to 4 so; that means,
it is not a not a one to one not a one to one function ok.

Now, we see that our onto function, we define my onto function simply that, a function f
from X to Y is onto if the range is Y and it is called the; the onto function is called the
surjective, it is called the surjective.

175
(Refer Slide Time: 31:11)

And what is the condition to be satisfied? Condition is so for all y that y ∈ Y because this
is my range there exists x ∈ X, I get that f of x = y. And this is the condition to be
satisfied that the function to be condition that the function to be onto and if the function
is not onto like the previous one we have done that we take the negation and it will be
that there exists y then belongs to X for all x ∈ X, negation of f(x) = y. So, if x not equal
to y.

So, there must be at least one x, at least one y; that means, it is not the range we
remember the range is the set of y, range we call the set range is the set y. So, at least one
element y exists for which f(x) not equal to y and then; that means, it is not onto and if I
define that our bijective function, our bijective function.

176
(Refer Slide Time: 33:50)

If a function is one to one as well as onto, one to one and onto and onto then the function
is then it is a bijective function. So, we have read the basic concepts of function and the
three different type that mainly the injective function, surjective function and the
bijective function. And some simple examples that, how or what type of function it is
and how to show that if it what are the conditions to be satisfied to show that if it is a
bijective or if it is a injective or if it is a surjective. So, bijective the two condition must
be added, this the conjunction of the two functions, the two conditions of bijective onto
functions and the one to one functions.

177
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 21
Relations and their Properties

Relations are very important role in computer science as well as mathematics and there
are almost many braches of engineering. It is a mathematical structure and mainly
relation is defined on a set. So, now, we have the concept of sets, we have read the
functions and today we will see the relations and the properties.

(Refer Slide Time: 00:48)

So, first we defined a relation mainly relation is defined on a set. Now, we defined taking
two sets. And so, relation or better I can tell a binary relation first, normally we define it
by R from a set X to Y; that means, the elements of set X how they are related to
elements of Y and we define these relation as a subset is a subset of the Cartesian
product X x Y, if that the ordered pair (x, y) ∈ R.

And, normally we define this thing or we denote this thing as a, xRy where here x is
related to y, xRy; that means, it x is related to y and x as usual that my x belongs to the
set X, y belongs to the set Y. And if X = Y then the relation R is on set X only relation R
is on set X only; that means, it that time it denotes the relation of the elements of only
one set X.

178
So, formally we can or in mathematical notation we can write that x ∈ X such that x, y
belongs to R for some y ∈ Y, that is it and here also we called the X is the domain of R
and Y is the range of relation R. Here y ∈ Y and such that (x, y) ∈ R for some x, for
some x ∈ X.

Now, the definition is very similar to the definition of a function we have read then what
is the difference between a relation and a function. So, first I make one statement that a
function is a special class of a relation and what is the difference?

(Refer Slide Time: 05:34)

See, when we have defined function that we have the domain of f because both function
and relation are subset of a Cartesian product X x X. So, I write that both function and
relation are subsets of Cartesian product X x Y.

Now, the definition of function if we remember then it tells that domain of f is X here
also the domain of f is X, for is X for R now for each x ∈ X there is exactly one y
belongs to the set Y such that x, y ∈ f. So, this is the difference is here and that is why we
call that the function is a special class of function is a special class of relation of relation,
because here only for each x there is exactly one y, ok. Now, it is not true for relation.
So, relation is actually a general say situation.

Now, we take one example of relation. So, mainly we are considering that one elements
of a set how it is related to the elements of other set. We take one example that let two

179
set we consider one is X is say 2, 3 and 4 these three elements and Y has some elements
say 3, 4, 5, 6, 7, 8 and the relation how X and Y are related that with that (x, y) ∈ R, (x,
y) ∈ R if x divides y. So, that means, this is the relation between the elements of x and
the elements of y.

So, all possible Cartesian product of (x, y) only we will be taking that subset where this
property holds or only for those pairs relation consists of that that pairs where x divides
y.

(Refer Slide Time: 09:52)

So, we see that which are the pairs. So, if we continued that with that thing. So, our X is
2, 3, 4 and Y is 3, 4, 5, 6, 7, 8. So, what will be the relation R? R as we have defined that
subset of Cartesian products. So, 2, 3; 2 does not divide 3; 2 divides 4; so, 2, 4 is one pair
then 2, 6 then 2, 8. Now, if I consider 3 then 3, 3 3, 6 if I consider 4 then 4, 4 and 4, 8.

So, this is a subset of the Cartesian products because Cartesian products are all possible
ordered pairs and then this is the subset that holds therefore, these the relation holds in
that x divides y, x divides y.

Now, if I consider another example if we consider say simply I am considering as if one


relation is given say R equal to 1, 2, 3, 4 say, ok. I take the set X, I take the set X is one
only four elements and the relation is defined that relation is x, y where x less than equal
to y; that means, (x, y) ∈ R if x less than equal to R and then all x, y belongs to x then the

180
relation is that I consider that we will consider all such pairs where that x less than equal
to y.

So, my relation I can tell that this is 1, 1 because equal to is there, so, 1, 1 then 1, 2 then
1, 3 1, 4 then 2, 2; 2, 3; 2, 4 similarly 3, 3; 3, 4 and 4, 4. So, this is the subset of the
Cartesian products or these are the ordered pairs set of ordered pairs that for these it
holds that x less than equal to y. So, this is a one relation.

(Refer Slide Time: 14:03)

Now, sometimes we denote the relation by using some figure or some picture and that is
a very informative way to present one relation and it is called that digraph it is called the
digraph of a relation. So, digraph is a general term, but here we are defining digraph only
on the context of relation.

So, if I consider that set just now the example we have seen that X the set 1, 2, 3, 4 and
the relation we got the like 1, 1; 1, 2; 1, 3; 1, 4; 2, 2; 2, 3; 2, 4 and 4, 4 and we have
defined that x less than equal to y then (x, y) ∈ R and (x, y) ∈ X.

Now, digraph we how we define that the elements of X the vertices of this graph or just I
that each element of the set X of the set X is a vertex of the graph and we put a directed
edge from x to y; that means, for all pair the pair exists we give a directed edge and why
it is directed edge because it is a ordered pair because relation is defined as the ordered
pair. So, we give an edge.

181
So, for this particular relation if I draw the directed or digraph of this thing, so, I am first
thing I have four elements. So, I give 1, 2, 3, 4 then I see that 1, 1 is there. So, normally
if there is a directed edge from x to x we call that is a loop. So, loop is defined a directed
edge like x to x is defined as loop. So, we give a loop here. So, 1, 1 then 1, 2 so, we give
one directed edge 1, 2. So, 1, 1; 1, 2 then 1, 3 so, I give directed edge here then 1, 4 now
2, 2; 2, 3; 2, 2 again it is a loop 2, 3, then 2, 4, then 3, 3 again it is a loop, 3, 4 and then 4,
4. So, this is the digraph. This is my digraph of this particular digraph of the above
relation.

Now, we have a different type of relation normally we use and these are the relations are
of now we consider is of three types.

(Refer Slide Time: 19:47)

So, the types of relation it is reflexive, it is symmetric and in this context we will read
also not symmetric or anti symmetric and one is called the transitive relation. So, now we
define one by one that what are these type three different types and what are their
differences. So, first we define the reflexive. So, a relation R on relation R on a set X is
defined as reflexive if the pair (x, x) ∈ R for any x ∈ X. So, the relation now we consider
if x is, x ∈ X, x is one element in the set x, now the relation if x is related to x. So, that
(x, x) pair this is, this belongs to R, then it is reflexive.

182
We take one example one very simple example if we see that. So, I consider a relation R
which of elements R consider the a, a say b, c; c, b and d, d. So, R is defined on set Xs it
has four elements a, b, c, d.

Now, we see here that for any x, a that a, a is here a, a belongs to R d, d belongs to R, but
we see that b, b; b, b does not belongs to R or c, c that pair is not also in R.

(Refer Slide Time: 24:21)

So, this is not reflexive we take another example that previous example. We have seen
that less than equal to we have seen one very simple example that if I consider that again
that previous example that say at x again 1, 2, 3, 4 and we have seen relation is we have
taken the relation that x less than equal to y. (x, y) ∈ R the relation we have taken that (x,
y) ∈ R and then x, y.

Now, here we see that since it is less than equal to we have what we have seen that x less
than equal to, x less than equal to y. Since it is less equal to sign is there, so all such pairs
1, 1; 2, 2 because 2 equal to 3, 3; 4, 4 all along with other that it will be in the relation R.
So, this relation must be a, this relation is a reflexive this is an example of a reflexive
relation.

And, then another example, we have seen that x divides y. We have taken some X say 3,
4, 5 and Y some 3, 4, 5, 6, 7. Then if the relation is that R is that x; x divides y, as we
have considered earlier that x divides y then R that say 3, 3 will be there, then 4, 4 will

183
be there because 4 divides 5, 5 is also there since 5 divides 5, but see here that 6, 6 or 6,
7 because here there is no element of 6 because x divides y that 3, 3; 4, 4; 5, 5 will be
there and other along with the other elements that 3 3, 6 or no other will be there only 4,
4; 5, 5 only 3, 6 will be there. So, here this is for this will it is also a reflexive this is also
a reflexive because the element divides itself. So, this is reflexive. Now, we see that
symmetric.

(Refer Slide Time: 27:51)

Symmetric that a relation R on a set X is symmetric if (x, y) ∈ R then (y, x) also belongs
to R, and if we it see that same example the example that R say a, a then b, c then c, b
then d, d. Then this is symmetric because b, c is there then c, b is also there. So, this
relation is symmetric.

See if we consider that our earlier example that X = 1, 2, 3, 4 and relation is x less than
equal to y x less than equal to y that is we called x or y, that is x less. Now, see that if x
less than equal to y then say one if I consider that 1, 1 is there 1, 2 is there, but 2, 1 never
can be there here never we get 2, 1 because it is only some ordered and x less than equal
to y. So, y never can be less than. So, this cannot be here.

Similarly, that if 1, 3 is there 3, 1 cannot be here or 2, 4 is there. So, 4, 2 cannot be there.


So, that means, these are the pairs never it will come in this relation. So, here this
relation is not less than equal to x this relation is not symmetric, it is not symmetric.

184
Similarly, our example of that x divides y that is also not symmetric because if x divides
y then y divides x that is never true. So, if (x, y) is in the relation R then (y, x) cannot be
in the relation R and our is, it is transitive I have another transitive.

(Refer Slide Time: 31:26)

So, relation R on set R on a set X is transitive if (x, y) ∈ R; and (y, z) ∈ R then (x, z), if
(x, z) also belongs to R then, if (x, z) also belongs to R then the relation is relation is
transitive.

So, that same simple relation if we consider that R that a, a; b, c; c, b; d, d. So, b, c b, c


and c, b, so, b, c belongs to R, c, b belongs to R then b, b if b, b because x, y; y, z the
next z; that means, here it is b, b. So, b, b belongs to R then it will be transitive, but what
do you observe that here b, b is not here in this relation. So, it is not a transitive relation.

185
(Refer Slide Time: 33:41)

So, it is not transitive, but it is not transitive. But, our previous example that the relation
x less than equal to y or the relation x divides y. See less than equal to y again if I
consider the set x is 1, 2, 3, 4 then in the relation R we will get if I get 1, 2 we will get 2,
3 because 2 less than 3 we will get 1, 4; 1, 3; 1, 2; 2, 3 we will get 1, 3.

Similarly, if I get 2, 3, I get 2, 4. So, 2, 3 I get 1, 2; 2, 4 I get 1, 4. If I consider 2, 3 then


3, 4 so, it will be 2, 4 also it means that if x since x less than equal to y, so, some (x, y) ∈
R and if my (y, z) ∈ R then because x less than equal to y; similarly here y less than
equal to z. So, from there I am get that x less than equal to z. So, we can tell always that
(x, z) must be belongs to R. So, this is a transitive relation, this is a transitive relation.

And, similarly for if x divides y we know that if x divides y; and the (x, y) is in the
relation and then y divides z, then x must divides z. So, that is also a, this is also a
transitive relation this is also a transitive relation.

186
(Refer Slide Time: 35:55)

Another relation is that it is a variant of symmetry symmetric relation when we have read
that there is two other options one is not symmetric one is called the anti-symmetric. So,
if it a relation is not symmetric if it is not symmetric we called anti symmetric we define
that if (x, y) ∈ R; (x, y) ∈ R. And x not equal to y then y, x does not belongs to R. Then it
is called then it is anti-symmetric. One very funny thing is that one relation can be both
one relation can be both symmetric as well as anti-symmetric, symmetric as well as anti
symmetric. And, the example is very simple example we give one relation say if it is a b,
b; c, c this is the relation; obviously, this is symmetric because (x, x) ∈ R.

And, since there is x not equal to y; that means, a, b or b, c this type of pair is not here a,
b or b, c this type of part is it is not in this relation. So, this is also so, it is vacuously true;
that means, the statement is false that x not equal to y in this type of topple is not here.
So, it is automatically it is anti symmetric. So, this particular relation is both symmetric
and anti symmetric.

So, with this we give the idea of that basic relations on the three different type of the
relations and then we will read the properties of relations.

187
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 22
Relations and Their Properties (Contd.)

So, we are discussing about the Relations and Their Properties. We have read the
different basic definition of relation. We have seen some basic three different types of a
relation; mainly the reflexive, the symmetric and the transitive. And, today we will read
that some other type of relation and which mainly we consider as if the properties of the
relation what type of properties it holds.

So, we will first consider the equivalence relation.

(Refer Slide Time: 01:05)

We will consider the equivalence relation. Now, since we know already the three basic
type the reflexive, symmetric and transitive. So, with respect to that we define that a
relation that is reflexive that reflexive, symmetric and transitive on a set X is called the
equivalence relation ok; that means, a relation R which is a reflexive symmetric and
transitive.

We see one simple example we consider a relation R where the relation is given and say
the relation R on a set x and that is set having elements 1, 2, 3, 4, 5, 6 and the relations

188
are given 1, 1; 1, 2; 1, 3. So, I take 1, 3; 1, 5 then 3, 5 I take 3, 3 I take 5, 5 then I take 2,
6; 2, 2; 6, 6; 3, 6 2 I also take 3, 1 also take 5, 1; 5, 3 and then say 4, 4. So, I have taken
this relation is given.

Then first we see whether it is a check for it’s whether this is reflexive or not. If we
remember that the definition of reflexive or x, x belongs to R. So, for this one we see that
1, 1 is there, 2, 2 is there, 3, 3 is there, 4, 4 is there, 6, 6 is there, 5, 5 is there. So, for all;
that means, for every x for every x belongs to X; for each x ∈ X, (x, x) ∈ R. So, it is
reflexive. So, it is reflexive relation is so, R is reflexive.

Now, we check for symmetric we check for symmetric.

(Refer Slide Time: 06:16)

So, symmetric if (x, y) ∈ R; then (y, x), if (y, x) also belongs to R then it is R is
symmetric. Now, we check for that thing. So, we see that 1, 3; 3, 1; 1, 5; 5, 1. So, we see
that 1, 3 here 1, 3; 3, 1; 1, 5; 5, 1; 3, 5; 5, 3 then 2, 6; 6, 2.

So, if we see this is 1, 3 in different color 1, 3 then I see that 3, 1 is there, 1, 5; 5, 1 is


there, 3, 5 then 5, 3 is there, 2, 6 then 6, 2 is there. So, I can tell that this is symmetric
relation. So, R is R is symmetric. Now, we have to see whether it is transitive or not.

So, in the relation if I see that (x, y) ∈ R and (y, z) ∈ R; then if (x, z) is also belongs to R,
then it is transitive. So, we see the see that 1, 1; 1, 3. So, 1, 3 is there 1, 3 is there then 1,
1; 3, 5. So, we should check that 1, 5 is there similarly if I check that 1, 3 we do not have

189
any other such cases, 2, 6 6, 2. So, 2, 2 is there 2, 6; 6, 2 and 2, 2 is there 2, 6; 6, 2. So, 2,
2 is there.

So, we can tell that this property also holds. So, R is also transitive. So, this particular
relation R is a equivalence relation since all three a reflexive symmetric and transitive
three properties it holds. So, R is an equivalence relation.

(Refer Slide Time: 10:10)

Now, we see that some previous examples that we have seen that say we have taken
some x = a, b, c, d and the relation we have taken a, a; b, c; c, b and d, d ok.

So, b, c and c, b is there, but b, b is not in relation R. So, obviously, it is not R is not
transitive, R is not transitive. R is b, c is there c, b is there. So, R is symmetric R is
symmetric a, a and d, d is there, but b, b and c, c is not there, so, not reflexive. R is not
symmetric, not reflexive. So, now, we see some other properties of relation.

Before we go to that other properties 1 property of that equivalence relation when we see
the digraph we must see that thing say if it is a for R is an equivalence relation and if I
draw the digraph of R. So, for if R is equivalence or I can write the digraph of
equivalence relation R.

So, first thing is. So, I have say three elements any I am considering. So, since it is a
equivalence relation. So, first thing it must be reflexive. So, there must be loop for every
vertex. So, there first thing we identify that there must be loop must be loop on every

190
vertex because it is since it is reflexive since it is reflexive. So, this is 1. Now, if it is
symmetric; that means, always there must be if it is 1 to 2, x to y, x, y then y, x. So,
always there will be edge between an edge there will be edge between x to y and y to x,
it will be a directed edge directed edge between x to y as well as y to x.

So, here if it is always this will be nothing another is that 2 to 3 and 3 to 4 is there. So,
there must be must be 2 to 4, this means it is transitive and same thing will happen. So,
for equivalence relation that we from the digraph this property, we can always check
very easily. So, this is one property of the relation R.

Now, we see another important property of equivalence relation it is called the partition.

(Refer Slide Time: 16:14)

So, given an equivalence relation, so, define partition first you define that given an
equivalence relation on a set X, we can partition X by grouping the related members on
X. So, main thing is that grouping and here elements that are related may be thought of
that are as if equivalent. So, equivalency. Now, first we give a theorem on this definition
of partition we give a theorem. We write let R be an equivalence relation on a set X.
Now, in each a element belongs to X that element of X let a is the set of all elements x
belongs to X such that xRa; that means, x is related to a and by this notation a that this
notation a this a, it is it denotes all the elements al l the elements of x that are related to a
we denote by this.

191
Then, we define S; S is a partition and these are these box such that a ∈ X and this a is a
partition, is a partition on X. So, mainly very simple way if I tell that R is an equivalence
relation on a set X and we are identifying all the elements which are related and we
denote that thing by this box a. Say a is one such elements and all for all x which are
related to a that is why we have written xRa. So, these all elements which are related to a
we are denoting that thing by this box a and this S for these boxes this is a partition on X;
that means, all elements that are related to a, we are grouped together and we are telling
that this is a partition on X.

(Refer Slide Time: 20:52)

Now, how we can proof that thing that if we want to prove that a ∈ X then aRa, it is true.
So, first thing we can tell that for each element each element on X must be a must be
some member must be a member of a partition because aRa; that means, the this a exist.
So, it is a member. Now, we have to show exactly one member of X. Now, show now we
have to show that every element is. So, that every element is exactly member of exactly a
one member of S exactly a one member of S.

So, if we can write in this way if x ∈ X, and x belongs to some part a and intersection b;
that means, all elements related to a and then all elements related to b then this partition
must be the same partition since x must be in a and b. So, suppose we consider some two
elements c and d, ok; suppose we consider a relation cRd; that means, that c is related to
d. So, let x belongs to partition c so; that means, xRc holds.

192
Now, since cRd also holds and xRc. So, since it is an equivalence relation. So, I can tell.
So, it is xRd holds since it is transitive since transitive since xRd; that means, x ∈ d also.
So, I can tell that this set; that means, all elements which are belonging to c, it is a subset
of d I can tell this thing.

(Refer Slide Time: 25:08)

Now, using the same logic that applying the same logic I can tell that all elements that
are related to d, again they are subset of c and earlier we got, I we got that c is a subset of
d. So, from the property of subsets of a set we see we must take that c equal to d.

So, we have assumed that x ∈ c, xRc so; that means, here we tell that x ∈ X that x
belongs to. So, we can tell that xRa; xRa then since it is intersection so, xRb also it is
true and I can tell that this is equal to a, I can tell that this is equal to b and so, from here
I can tell that box a; that means, the partitioning is the same as that of partition b.

Now, I give another definition of equivalence class, from this is very much related of this
equivalence class. So, let R be ad equivalence relation on set X. So, let R be an
equivalence relation on set X then the all the elements related to a and that we have
defined as the set the sets as the [a] are called the are called the equivalence class
equivalence classes.

193
(Refer Slide Time: 28:36)

So, if we take the example of say I have I have a one set X equal to say 1, 2, 3, 4, 5, 6
and say on some relation some relation I get that is using some that the previous relation
if I write 1, 1 then 1, 3; 1, 5 then 3, 1 and 5, 1; 3, 3 say 5, 5 and then I get say 2, 2; 2, 6;
6, 2; 6, 6 and say 4, 4. So, this is some relation given.

Then, we can tell that s I can tell the partition that where 1, 3, 5 then 2, 4, 2, 6 I get
because 1, 1; 1, 3; 1, 5 then 3, 1; 3, 5; 5, 3. I should add 5, 3 here and 5, 5 then similarly
2, 6 and 4, 4, so, I can get this type of three partition. Then I can write that box since this
is my related elements 1, 3. 5, so, I can tell 1 and this can be related as the [5]
equivalence class and they are actually 1, 3, 5.

Similarly, my 2 equivalence class or 6 this can be only two elements 2 and 6, and 4 is
only one, only 4 is there. So, this is one example of equivalence class.

194
(Refer Slide Time: 31:14)

I take one example quickly say I have a set X equal to. So, I am taking all integers 3, 4,
5, 6, 7, 8, 9, 10 and I am taking the relation x R y where if 3 divides x - y, and (x, y) ∈ X.
So, if I write quickly my relation R will be all such topple say 1, 4; 4, 1 because 3 divides
then 1, 7; 7, 1; 1, 10; 10, 1 these are all divided.

Then I should take 2 I should take 1, 1 also, first one then I should take 2, 2 then 2, 5; 5,
2 then 2, 8; 8, 2 then I have 3, 3 then I have 3, 6; 6, 3 I have 3, 9; 9, 3 I have 4, 4 then I
have 4, 7; 7, 4 because x - y divides by 3 and I have 5, 5. So, all such 5, 5 then 5, 8; 8, 5 I
have 6, 9; 9, 6 then 6, 6 6, 6, then I have 7, 7 or 8, 8; 9, 9; 10, 10 all these tuples will be
my relation.

Now, what will be my equivalence class from here? I can consider equivalence class as
that say I am writing one box 1, I define that x belongs to X that if 3 divides x - 1 as if I
am divide writing like that.

195
(Refer Slide Time: 34:46)

So, what will be my then 1? Then 1 will be that elements 1, 4, 7 and 10 because all 4 - 1,
1 - 4, 7 - 1, 1 - 7, 10 - 1, 1 - 10 this all will be divided by 3.

Similarly, what will be my 2? Because x, 3 divides so, here it is if I quickly write 3


divides x - 1, here 3 divides x - 2. So, it will be 2, 5, 8. Similarly, my [3] will be 3, 6, 9
and see the way we have defined that every element belongs to only one partition we if
we consider say here 1 is the here, 2 is here. So, of every element so, if I every elements
is member of only exactly one equivalence class. So, and there these classes are all in
that way it is are all distinct class in that sense is a distinct class.

So, I can write actually that if X1 if I set 1 X and these are my classes, so, if there are k
such equivalence classes then this will be Xk; that means, all that cardinality will be same
and if all are they consider r elements then actually these are full k n number of elements
will be there. So, this is that concept of equivalence class on the equivalence relation R
and we get the partition from here.

196
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 23
Relations and Their Properties (Contd.)

So, we are discussing the relations. And last day we have seen a special type of relation,
mainly it comes under the properties of relation is the equivalence relation. Now, we
often use relations to order some or all of the elements of a set; and for this, we use some
properties of relations. The three basic properties that we have read the reflexive,
symmetric, we will see today some variant of symmetric, and the transitive property that
are mainly used. But, here the relation is called the something called partial ordering.

(Refer Slide Time: 01:17)

So, today we will see how relations are used to order the elements of a set. So, we will
read the partial ordering or sometimes we call partial order ok. Now, when we use the
relations to order the elements of a set, say if we see some example that we use relations
to order the elements of a set, this is a general thing.

Now, as an example I can tell that to order the set of integers containing the pair of
elements say (x, y), and the relation is less than or greater than, relation is less than say
(x < y). Normally, we called xRy, where R is the relation is the less than or we use this to
order the words.

197
So, we write other example that to order words using the relation containing a pair of
words say (x, y) when I think; when x comes before y. So, here if we consider our
alphabet set say A to Z in order that means as if A is in position 1, B-2, C-3, and this is Z
in 26, so this is in some in some order. And this ordering will govern that which letter
comes before y. Say x comes before y, if x position is less than the position of y, and
here positions means that 1, 2, 3. And normally this is the ordering we use in dictionary,
and that we will be again in details we will be describing later.

Now, another example we can think, say on more practical example that we can schedule
to schedule the tasks of a project, again using the relation say a relation a pair (x, y), pair
of tasks (x, y) a pair of tasks and the relation is and the relation is such that x must be
terminated before y begins. So, for this type of examples, we can use relation. And this is
some particular properties that mainly the reflexive, the anti-symmetric, and the
transitive properties are used for that.

(Refer Slide Time: 07:39)

So, we define the partial ordering first. So, relation R on a set X is called a partial
ordering, if the relation is reflexive, transitive, and anti-symmetric. Now, if we remember
that instead of instead of anti-symmetric, if it is symmetric, then last day we have defined
that as a equivalence relation.

Now, a set X along with this relation R is called the R is called the partially ordered set
or more commonly the term is used called the poset correct. Normally, we denote that as

198
the term here it is X, along with the relation R, we called this is my poset ok. And the
elements of X the elements of X or members of X elements of X are called the elements
of poset.

Now, we see first one simple example we see some example. So, show that greater than
operation that the relation greater than equal to right is a partial order or partial ordering
on the set of integers. Normally, the relation is relation is R; we is greater than and the
set of integers the set of integers normally we denote as Z.

(Refer Slide Time: 13:23)

Now, see what are the properties, the relation holds? Previous example-1 continued.
Now, if I consider a pair say a, b, so if or a, b belongs to z. So, my I am I am considering
the set z, and the relation is greater than equal to, and I am checking, whether it is a poset
or not ok. Now, a, b belongs to z. So, my relation is R is R is ≥, so if I write a R a. Since,
a = a, so a R a holds, a R a is true that means, my relation R is so a R a is true, so the
relation is reflexive.

Now, if I consider that some relation a R b that means, a ≥ b. I consider b R c that means
b ≥ c, where a, b, c; a, b, c ∈ z. Then since it is positive integer or a set of integers, so I
can write that a, so a ≥ c that means, a R c holds that is a R c holds, so it is transitive.

Now, if a R b if I consider a R b, and a ≠ b, since my relation is greater than equal to so


that means, here I have to consider only greater than that means, a R b and a ≠ b means

199
only a > b. So, now if I consider a > b that means, if we remember the definition of anti-
symmetric that means, a R b and if a ≠ b, then b for this relation greater than b R a, this is
it holds, because never b R a is true this is true. That means, if a > b, then b cannot be
greater than since a > b, so b cannot be greater than a. So, this relation is anti-symmetric.
So, my z, greater than equal to this is a these set of integers with the relation greater than
equal to, is a poset is a partially ordered set.

(Refer Slide Time: 18:13)

Now, we see another example. We give example-2 as the instead of the greater than
equal to we take one relation the divisibility. So, you show that the divisibility relation is
a partial ordering on set of positive integers, normally we denote as Z+. And the divisible
the relation, we denote relation R, we denote as the by division. So, we have to show
whether we have to show that the Z+ with the relation divisibility is a show this is a
poset.

Now, first we see the reflexive. See always a R a is true, since a divides a divides a is
positive integer that a ∈ Z+, so it is reflexive, so it is reflexive. It is also transitive,
because if a R b and b R c that means, that is a | b, b | c, so I can conclude that, so a | c.
So, it is transitive it is transitive.

Now, what about the anti-symmetric say if a R b holds that means, a | b that is a | b. So, if
a ≠ b, if a ≠ b, then b R a is never true that means, b is not in this relation a, so this is

200
anti-symmetric so this is anti-symmetric. So, Z+ is a so this is a proof, this is a poset yes
it is a poset.

(Refer Slide Time: 22:23)

Now, we show a different type of example. In the last lecture, we have defined the power
set which is nothing but the all the subsets of a set. Now, we will show that the relation
inclusion set inclusion. So, show that the relation that means, if it is a subset, that is a
inclusion is a partial order or partial ordering on the power set P(S), where S is the or
power set P(S) of set S. So, power set if I remember that power set is the set of all
subsets of S of set S.

Now, we consider a subset A ok. So, if A is a subset of A or we know that it is always


true that A is, A ⊆ A, so a R a holds, which tells that it is reflexive. Now, if A ⊆ B and B
⊆ A that means, a R a, a R b, and b R a if both hold, then we know that A = B.

So, if A ≠ B, then it does not hold; so that means, it is anti-symmetric, because if it is A =


B, then actually the condition is false for anti-symmetric property, and so it is, that
means, for condition to be the relation one to be anti-symmetric is A ≠ B. So, then it is
anti-symmetric. So, a R b and b R a hold, then A = B. So, it is then it is vacuously true
for the property of or that the relation to be anti-symmetric or I can write the condition
that the relation to be anti-symmetric is false, so anti-symmetric property, so it is
vacuously true.

201
Now, we have if A ⊆ B, and B ⊆ C, so from the definition of subset, we know that A is,
A ⊆ C, so which directly gives that it is transitive. So, we can tell that my relation the
partial order set. So, the conclusion is the partial order set on P(S), with thus subset this
is a poset, this is a partial ordering.

(Refer Slide Time: 28:55)

Now, we see one example, when the relation is not a poset. Let R be a relation on the set
of people such that the relation holds that a R b if a, b are two people, and a is older than
b. This is the relation a is older than b. So, this is my relation. So, we have to show that R
is not a poset; R is not a partial ordering. Now, we see that the relation is older than.

So, first we see that we take three people a, b, c such that a R b that means, a is older
than b. b R c that means, b is older than c, and which means that so a is a R c holds that
that is a is older than c. So, it is transitive so it is transitive. What about anti-symmetric,
because a is older than b, so b cannot be older than a. If a R b that is a is older than b,
then b R a never holds, so that means, this is anti-symmetric this is anti-symmetric.

But, see that a is older than b, so a R a that one person can never be older than himself or
herself. So, a R a it never holds a R a never holds. Since, one person cannot be older than
himself or herself, so it is not reflexive so the relation is not reflexive not reflexive. So, it
is not a the conclusion is conclusion is that relation it is not a R is not a partial ordering.

202
(Refer Slide Time: 34:15)

Now, we can define that in this relation one thing is called the total order, because we
read the term partial order. So, what is total order for that we define a comparable or
incomparable set. The element a and b of a poset; if it is a partial order set, say in X, R is
comparable if a R b or b R a holds. That means, if I consider the relation R as the say less
than equal to, then either then either a ≤ b or b ≤ a holds, then it is a comparable then this
comparable.

But, say if I consider say relation is a division divisibility property, then a divides b or b
divides a, that is comparable, but not for all sets it may not be true. Then it is called then
if it is not if that means, if neither a R b or b R a hold, then they then it is incomparable.

203
(Refer Slide Time: 36:47)

Now, now if I know the comparable and incomparable, so I can define the total order.
See total order of set X, and I take a relation like this is a or I can give the simply I can
give the relation R is a poset, and every pair or every pair of elements are comparable,
then x is called a totally ordered.

So, just now we have seen that the set of integers set of integers Z, and less than equal to
this is a totally ordered set, because, if I consider any two elements in the set, they are
actually comparable, but if I consider positive integer Z+, and division then not a totally
ordered set. Since, if I consider say (3, 7), 3 and 7 this pair, then 3 R 7 or 7 r 3 that
means, 3 does not divide 7, 3 does not divide 7 or 7 does not divide 7 does not divide 3.
So, 7 R 3 in it they do not hold. So, it is not a totally order set.

204
(Refer Slide Time: 39:45)

So, well ordered we can define as the so well ordered earlier we have defined. Now we
give a different definition that if it is the set X with a relation R is a poset, where the
relation R is a totally order, where R is a totally order or total ordering better I write R is
a; R is a total ordering, and every non-empty set name subset of X has a least element ok.

Now, the most important application in poset is the lexicographic ordering in dictionary,
we know this is lexicographic ordering. All of we know that in dictionary that normally
the words are appeared according to the ordering of their letters. And we can show that
how this a poset or how this constructions work in a poset so how this constructions
work in a poset.

So, if we define say I have a poset A1, say less than equal to; I have a another poset A2,
then I can take some Cartesian product of Cartesian product of these posets, because
finally these are all sets with some relation. So, we can take Cartesian product of say A1
X A2 X … Say if I have some An; now how I define this Cartesian product?

205
(Refer Slide Time: 43:13)

Say if so, I consider some two pairs consider two pairs (a1, a2) and (b1, b2). Now, either
a1 < a2, or a1 = a2, and for some integer I that I can consider that or some i > 0 that a1 =
a1=b1 this is ok.

Since, we are considering a1, a2 and b1, b2. So, this is a1 < b1 or if a1 = b1, and for some
integer i > 0; a1 = b1, a2 = b2 like ai = bi, then the next ai+1 < bi+1. Then the lexicographic
ordering is that the word say a1, a2 that ai , ai+1 that is ordering is like that b1, b2, b3,… bi,
bi+1.

Normally, this is mainly used in our arrangement of dictionary. So, lexicographic


ordering, which is nothing but the application of poset that is mainly used in our
dictionary. So, how this relation and the property are used for practical purposes, this is
one of the examples.

206
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 24
Relations and Their Properties (Contd.)

So, last lecture, we have read the partial ordered set and their some practical applications.
Now, these lecture we will see that how the partial order set can be represented pictorial.
And finally that becomes an algebraic structure, and we call this is Hasse diagram. So,
we read Hasse diagram opposite here.

(Refer Slide Time: 00:55)

So, today we will read the Hasse diagram. So, explain the Hasse diagram with some
example. If we remember that we have read the directed graph of a relation that means, a
relation can be directed graph or not we call digraph is used to represent a relation.

Now, a relation on a relation R on a set x, with the property reflexive, anti-symmetric,


and transitive is a partial is a partial ordering. And the set is X, is X with R is called a
partial ordered set or poset. Since, it is finally a relation on a set X, so we can represent
this thing by a digraph.

207
Now, we take one example first that same example if I consider that, we have a set X
having four elements say 1, 2, 3, 4, and relation we take is the less than equal to relation
is less than equal to.

Now, the if we remember the diagraph, so relation we remember the relation will be the
pairs (1, 1); (1, 2); (1, 3); (1, 4); then (2, 3); (2, 4); since it is less than (2, 2) less than
equal to then (3, 3); (3, 4); (4, 4).

So, first we see that 1, 1 is there, since it is less than equal to since it is equal to so a
equal to b. (2, 2) will be there, (3, 3) is there, (4, 4) is there, so that means or in other way
I can tell that it is since it is reflexive it is reflexive. So, all (1, 1), a R a it a R a it holds.

(Refer Slide Time: 05:07)

So, if we draw the diagraph, now if for this example if, the example continued, so if I
draw the digraph. And this time we are giving that first thing is we know that for digraph
that all elements will be a vertex, all elements will be a vertex.

So, this is my 1, say this is 2, this is 3, and this is 4. Since, it is reflexive. So, every time
there will be a loop, since it is a R a holds. I can tell that since it is reflexive, it is a partial
order, so it is reflexive. And it digraph has loops on every vertex.

Now, if I see that it is less than equal to, now I am considering some direction either
upward or the downward direction see (1, 2); (1, 3); (1, 4). So, I can now put one

208
directed edge that I can put (1, 2); (1, 2) since 1 is less than 2, 2 is less than 3, 3 is less
than 4, again 1 is less than 3, 1 is less than 4 also.

So, (1, 1); (2, 2); (3, 3); (4, 4); then (1, 2); (1, 3); (1, 4) what about (2, 2) less than 3,
again 2 less than 4. So, this is my this is my digraph of this is my diagraph of the poset
on the poset say X less than equal to and X = 1, 2, 3, 4; now, see since it is a poset, so
always it is reflexive always it will be a transitive.

So, now we can minimize, so Hasse diagram is some minimized digraph. So, simply I
can tell that Hasse diagram Hasse diagram is a minimized digraph representation, how
we can minimize. See since it is poset, it is always reflexive. So, what I can do, I can I
can delete all the loops, since it is a poset always it is true. So, we will not show
separately.

Similarly, since it is a transitive. So, what I can do that if we only 1 to 2 or 1 to 2 to 3,


then 1 to 3 always will delete. So, delete the edge or the edges responsible for all for
transitive property. Finally, we will delete all the arrows. We will delete all the direction,
all the arrow or the direction that means, all edges should be that means, since all edges
should be undirected so all edges should be undirected.

Now, why we can do this thing, because we are considering we are considering only the
poset we are considering the poset, and the digraph of a poset. So, poset is reflexive and
transitive. So, we are not separately giving any representation for the property reflexive
that is why, we delete we delete loops.

Since, it is transitive that is why, we delete the edges responsible for transitive property,
what does it means that if it is a or c; a R b, then b R c, then I will put a R c. So, a to c
will delete these, we delete a to c. Since, we have already a to b and b to c. So, we do not
give we do not give a R c a to c.

And now for this type of as diagram in the Hasse diagram always we give the arrow
either in upward direction or downward direction since we give either upward direction
or downward direction. So, I do not need any arrows for that. So, we delete all the arrows
from here. So, in this way we can minimize; then how we can do that thing.

209
(Refer Slide Time: 13:31)

So, in the first step so Hasse diagram, so you we continue the same example. So, again if
I quickly draw 1, 2, 3, 4, then I give 1, 2, 3, I give 1 to 4, then I give 2 to 4. So, what will
be mine? So, this is my initial digraph. Then what will be mine step 1. We first drop the
all the loops, so we drop all the loops. So, only I this is my step 1, and I can write that
step 1 is drop the groups.

Now, what will be mine step 2? Then all arrows for transitive are all the edges for
transitive property that means, we can drop 1 to 3, 1 to 4, and 2 to 4, so step 2 will be 1,
2, 3, 4. So, all the transitive thing we draw. So, this is my step 2, we drop all the edges
representing the transitivity.

Now, my final step, we drop all the arrows. This is only connection. So, drop all the
arrows or direction all the direction, and this is my final Hasse diagram, so this is my
final step or this is my Hasse diagram. So, how we construct the Hasse diagram of the
poset; poset X less than equal to, where X is 1, 2, 3, 4, because earlier we have shown
that for this relation are less than equal to it is a poset. So, the in this way, we can draw
the draw the Hasse diagram. And see that it is very minimized form and very simple
form of the digraph ok.

210
(Refer Slide Time: 18:53)

Now, we see for some other example. So, again that earlier we have seen that for
division, so give the draw the Hasse diagram for the poset I write in this way a, b, and
the relation is divisibility where a divides b. And on the set on the set the relational
relation on the set R is on the set X equal to say 1, 2, 3, 4, 6, 8, 12.

So why? Now, we know the procedure for drawing the Hasse diagram. So, first we draw
the digraph. Since, I have a 6, 8, 12, 4 or 3, 7 nodes ok. We draw the digraph, I have 1,
so 2, 3. So I, given this way 6; I draw this is 1 so it divides b.

So, 1 divides everyone, 2, 3, 4, 6, 8, 12. So, there will be some initially the directed edge
to 1 to everyone, 1 to 2, 1 to 3, 1 to 4, 1 to 6, 1 to 8, 1 to 12. Then 2, 2 divides 4, 6, 8, 12;
so 2 divides 4, 2 divides 6 ok, we can give a different color, so that it can I will give you
a different color for 2 to 4; so that it will be clearly we can understand 2 to 6, then 2 to 8
and then 2 to 12.

Then, for 3, 3 divides only 6 and 12; 3 divides 6 and 12, I give a different color. 3
divides 6 and 3 divides 12, then 6 divides 12, then since every one divides a divides a.
So, I have loops to every node or vertex. I have loops to every nodes, 4 I am not given 4
is 8. So, 4 divides 8, 4 divides 12, but 8 does not divide 12 or only 8 divides a 12 divides.
So, this is my digraph.

211
Now, first thing I step 1 I draw, the all the loops. So, if I step 1 and step 2 together if I
give, then the transitive edges also we can drop. So, I write if I giving in, I give 1. So, I
have only, I will give only 1, 2, 3 then 2 to 4, 3 to 6, 4 to 8, 6 to 12; then I have I have 2
to 6, I have 4 to 12.

So, this time I have drop all loops and transitive edges and transitive edges. Now, finally
we drop all the arrow diagrams. So, these becomes this becomes my finer that simply I
draw 1, 2, 3, 4, 6, 8 and 12. Well, I can give the nodes blue; so that it will be clear and I
have 4 to 12; I have 2 to 6. So, simply this is my Hasse diagram.

(Refer Slide Time: 27:19)

Now, we have if we see that in the last lecture, we have seen that our power set is a
poset, some power set S is a poset is a poset.

Now, if we consider S the set S is 3 elements, then we can draw the Hasse diagram of p
s. So, draw of power set s. So, if we remember; what are the elements of the power set
see S is equal to a, b, c; we remember the elements will be 2 to the power 3, 8. And what
are those elements, the power set, it will be the empty set that is now set the a, then b, c;
a b, b c, c a and a b c, a b c.

And the relation here we have considered when it is a poset, the relation is the subset ok;
that means, we have to show p s. And the poset is, poset is I can write A, B such that A,
B or I can write A is a subset or inclusion, set inclusion ok.

212
So, how we can draw? We have 8 elements, and all the elements must be the vertex of
the digraph. So, directly if I draw, then this will be always some upward direction, we
can give so I can draw in this way. See I can give my, the empty set as the bottom. So, I
write my empty set or I write I write this is my null set. So, this is my a, this is my b, this
is my c.

Now, a and c. So, this connection this must be my a, c. Similarly, c and b so this h this
node must be b, c. Then a and b, so this will be a, b; and this will be the a, b, c. So, these
are all my all subsets. And this is the simply the Hasse diagram if I these will be my
Hasse diagram of the poset, Hasse diagram of p s. Relation is the set inclusion and S is
equal to a, b, c. So, this is my poset of that thing.

Now, we can define some here see for this type of diagram always, since it is in upward
or bottom downward direction that is why, we are omitting or we are deleting the arrows
or the direction. So, we can define some maximal element or the minimal element. So,
see which simply which is bottom element that is my minimum, and which is my top
element that is my maximum element. So, how we can define some maximal or
minimal? I can tell some maximal.

(Refer Slide Time: 33:57)

And this is for my Hasse diagram that simply I can tell, there is no element b belongs to
S if you consider a element of the set s. I am telling the poset is the set is with a relation
R, this is my poset. So, such that there is no element b belongs to a so that for so that a is

213
less than b or that relation holds for all a, and this is for all a. So, obviously this is this
gives me my top element. So, this is my top element. Similarly, the minimal element it
will be that there is no b belongs to S such that b less than a, where r I am related say
taking in less than. So, obviously this becomes my bottom element.

So, for the previous example that my phi, then I will set is my minimal element and that
a, b, c the subset a, b, c is my maximal element. This is for my; for the previous or for
the example of the Hasse diagram of the power set S. So, if we just consider some Hasse
diagram at random.

(Refer Slide Time: 37:19)

Say, I have I have some this type of say it is a, it is b, it is c or I can take some. So, here I
can the previous example, we can tell that some it is called some greatest element or
greatest element or the least element. Then I can tell that for this example say for so if
say for figure 1, this is for figure 2. I can tell for figure 1, that for figure 1 that d is the
least element, but there is no greatest element, but no greatest element.

Maximum elements are b and c, but no greatest element. Here for figure 2, so this is for
figure 1. Then for figure 2, no greatest or neither greatest nor least. I can write neither
greatest, nor least, but for our this type of diagram that we have seen in our power set
Hasse diagram that we can tell that if it is a, b, c, d, then a is if a is least, and d is greatest
element.

214
So, with this we finish this talk of Hasse diagram. And again next lecture we will
continue this thing.

215
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 25
Relations and Their Properties (Contd.)

So, in the last lecture we have learnt the partially ordered set and today we will see the
some properties of partially ordered set or poset we called.

(Refer Slide Time: 00:32)

So, the and we will see that how it forms an algebraic structure which is very important
in practical applications; like the information flow or in Boolean algebra called lattices.
So, before we introduce latticed first we see the properties of posets, the partially ordered
set. Before these we introduce a notation normally we used for posets. So, if we
remember that when we have learned the posets the partially ordered set we have seen
that normally the relation with the operation a relation R with operation less than equal to
or the if we consider set inclusion the subset or the divisibility with these operations they
form a poset R is a poset ok. So, I can write that this become this is a poset.

Now, this is different operations. Now, if we use a notation like this it is not always it
represents that it is less than equal to, less than equal to, but we define that R with this
notation is a symbol, this is a symbol that we can use when we discuss the ordering
relation in an arbitrary poset. Now; that means, this relation this can be less than equal to

216
or this can be set inclusion or this can be divisibility or any other operation. This does
not, why we have used the similar type of notation that less than equal to? So, if we write
this thing that we use this notation which is similar to less than equal to because, that
normally the posets are very easy to understand with the operation less than or the
relation; that means, that order set and that is why it is a similar type of thing.

So, now onwards we will be using and this notation to represent an arbitrary put it posets
and we will also use the term less than equal to, but we remember we must note that this
is not always less than equal to; this can be any other operation also regarding one
arbitrary poset ok. So that means, if I write a b; that means, we will be telling that in a
relation in a poset R we will be using the term that a less that b in relation or in poset R
this ok. Now, we see some of the properties of poset. So, this is a convention that we will
be using, now first we see some greatest and least element of a poset.

(Refer Slide Time: 05:45)

So, it define greatest and least element of a poset. Now sometimes if we or define that
sometimes there is an element in a poset that is greater than every other element of the
set. So, such an element is call the greatest element of a poset. Now, we must note that
sometimes we get sometimes not always it exist we must note this term.

So, we can write that this element is unique and this is called the greatest element. So, I
can write that greatest element is unique if it exist if it exists. So, if we call that is the
greatest element if a is the greatest element in the poset S, then I can write for all

217
elements b belongs to S that b is less than a because, just now we have defined the
notation this as the as the as if we always tell this is less than as we have defined or we
have introduced this notation.

So, this is my greatest element. Now, similar way I can define my least element for my
for my list element that again sometimes we get an element an element that is less than
all the elements of the posets.

(Refer Slide Time: 09:16)

So, we can write that if so, an element that is less than element of the poset is called the
is the least element. So, if is the least element in the poset S then I can write then for all
element b belongs to S, a is less than b. And again for least element also that least
element is also unique of a poset is unique if it exist ok. So, it is unique if we take some
example let us see some example that we determine whether the posets below I have
greatest element have greatest or least element.

Now, we know that has a diagram is a representation of poset which is that minimize
diagram. So, I give the Hasse diagram so, I write a Hasse diagram like I give an odd a b c
d. So, this is my figure 1 this is my figure 1 or I give say a, b, c, d e this is one Hasse a
diagram of a poset figure 2 or reverse of the figure 1; a, b, c, d figure 3. I get this type of
a, b, c, d figure 4. Now, we see that for figure 1 it has some least element it has some
least element it has some least element a because, a is less than all elements of b c d. So,
it has a least element least element I will write.

218
(Refer Slide Time: 14:19)

So, figure 1 has least element a, but no greatest element. If we see the figure 2 no least
element no greatest element, here greatest element is a, but there is no least element. So,
for figure 2; for figure 2 has no least element and also no greatest element. Figure 3 just
now we have seen figure 3 has greatest element see, but no least element see if you got 4
figure 4 has figure 4 has greatest element as well as least element here it is it is.

So, figure 4 as greatest element a and least element d this is greatest and least element,
but if it exist not always the greatest and least element exist as we have seen for figure 2
has no least or greatest element. Now, we can define the some greater some lower bound
and upper bound; that means, sometimes.

219
(Refer Slide Time: 17:25)

So, we can tell the upper bound, you can define the upper bound and lower bound. Since,
we have just now we have seen the not always the greatest element or the least element
exist. So, sometimes it is possible we can define like that again here sometimes we
remember sometimes it is possible to find elements that is greater than or equal to all the
elements in a subset A of a poset S of a poset S.

Now, if and this element is called the upper bound greater than all the limits and this is
this element which is the upper bound of a. So, if an element u say u belongs to S then a
is less than u for all a ∈ A because, if we consider a is the subset of the poset and we see
that a ≤ u for all u ∈ S, then u is called the, then u is called the upper bound. And we will
see upper bound is not unique another is upper bound is not unique there may be more
than 1 element in the poset S where these property holds.

Similarly, we can define the lower bound similarly for lower bound we can write for
lower bound we can write an element l belongs to s l is less than a for all a belongs to a
the subset a capital A. Then l is the, then l is called the l is called the lower bound of a,
and again lower bound is not unique lower bound is not unique. So, we get some upper
bound of a sub set a we get some lower bound of a get the lower bound of a subsidy we
take some example. So, that it will be clear how to get the upper bound and lower bound
from the Hasse diagram of a poset.

220
(Refer Slide Time: 22:57)

So, we take an example ok. So, poset it draw the some Hasse diagram give some note
name. So, this is a, b, c, d, e, f, g, h, i we connect this is also some diagram is there. Now,
we consider the. So, this is one poset calculation S and this is the Hasse diagram of this
as a diagram of the poset S. Now, consider the subset a we will consider different subsets
a say for the 1st case I consider A equal to sum we consider a b c and we see that what
will be the upper bound. So, upper bound we called ub is e g h i and lower bound lb is a.

Similarly, if I consider the subset as h i then we see that there is no upper bound because
h and i so, there is no upper bound. That means, we do not get any such element in the
subset a which satisfies the property, but there is lower bound that in this case that lower
bound is lower bound is since it is a h i so, lower bounds are a b c d e g. So, all will be
the lower bounds so, lower bounds are lower bound a b c d e and g all are one.

(Refer Slide Time: 27:27)

221
Now, we define the least upper bound l u b that x is called the least upper bound of A if x
is an if x is an upper bound that less than every other upper bound of A. Since just now
we have seen that there can be more than one elements in the upper bound. So, now, we
are finding what is what is the least element with respect to that relate poset that is less
than then that can be defined as the least upper bound.

So, it is one element only one element. So, lub is I can write so, that is less than every
other bound of a. So, I can write that lub is only one element; that means, if it exist only
one element if it exist because, we have seen that even upper bound may not exist then
least upper bound; obviously, will not exist. And in notation we can write is less than x
when a belongs to A and x belongs to or x is less than z where z is upper bound of A z is
upper bound of A.

Similarly, we can define the greatest lower bound we call normally glb of a and notation
by notation. So, x is the x is the greatest lower bound of A if x is an x is a lower bound
that is greater among or we can write all other greater bounds are I can write such that all
other lower bound are less than a less than x. And I can write in this way simply that y is
the y is glb greatest lower bound if z less than y and z is lower bound of a of A.

(Refer Slide Time: 32:53)

222
Now, with these properties we can define the lattice as the. Now, we can define the
lattices that a partial order set in which every pair or every pair of elements has both least
upper bound we called lub and greatest lower bound called glb is called a lattice. And
lattice is a very important it is algebraic structure and which is application both in as it
has application and information flow from in communication or in Boolean algebra.

So, if I draw a Hasse diagram some examples if we see if we see some examples we
draw some Hasse diagram see it is just now we have seen that both it has both a as lub d
is so, it is a it is a lattice it is a lattice. If I consider I give it is not a lattice since if I
consider b c or d e for d e it has glb is a, but no lub. So, it is not a lattice, but it is it is a
lattice.

(Refer Slide Time: 36:27)

223
So, if we consider that earlier we have considered some power set if we remember the
examples of power set of a S a b c. Then it has always it has some least upper bound and
which is actually if I consider 2 nodes if I consider the power sets. So, lub is the A union
B and the glb is the A intersection B where A B A and B are the nodes of the P(s) power
set or the poset because, we have seen that it is poset and if we remember the nodes are
that empty set then a then b c a b a c b c and a b c and a b c.

So, always this exist the A B and A union B; that means, glb and lub always exist. So, it
forms a so, it forms a lattice it forms a lattice this is somehow other examples that we
have seen that say divisibility.

(Refer Slide Time: 38:20)

224
If we consider examples of some set S and say 3 6 9 is a set and the relation is the
divisibility or the relation we can see is the divisibility this is a poset a. And then we can
see that l u b the least upper bound is nothing, but the lcm of 3 6 9; that means, there
which is a multiple of 3 6 9 and is 36. So, it exist and greatest lower bound is in this case
1 and 3 divides all the elements divides 3 6 9.

So, lower bounds are 1 and 3 so, greatest lower bound glb is 3. So, both lub and glb
exists exist and it forms a lattice so, it forms a. So, we see that earlier the examples we
have seen that posets and that some of the posets with some operations like here we have
seen the division or the power set they forms a lattice. And lattice is a very important
algebraic structure that has uses in information flow in communication and the Boolean
algebra etcetera. So, with this we finish this lecture of the posets and its property and that
how it forms a algebraic structure like lattice.

225
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 26
Recursion

Today we will learn a very important concept of computer science called the Recursion.
And first the very simple concept that what we concept of recursion, that what we mean
by recursion. And how actually it is we define recursively the function, set, sequences
today we will read that thing. And, slowly then we will be going to that how recursion is
used to define relation, how to solve etcetera. So, today we will read that recursion.
Sometimes it is difficult to define an object explicitly.

(Refer Slide Time: 01:30)

So, you can write that sometimes it is difficult to define an object explicitly. But it is
easy to define in terms of itself and these process of defining the object in terms of itself
is called recursion. So, very simple way if I took that this process of defining is called
recursion. Now, we recursion normally we use to define the sequences, the functions, the
sets and later we will use for many real life problems. So, you can write is to define
sequences, functions and sets. These are the three basic things we will see that how
recursion is used. Now, we take one simple example to illustrate the concept of this
recursion.

226
(Refer Slide Time: 04:30)

We take one example ok, we define a sequence of power of 2. How I write? Say I give a
sequence an = 2n. Now, these same sequence since it is power of 2, I can define in a
different way, but I need some initial value. So, what is initial value? Say for n = 0, I say
I have some initial value say n = 0, we know a0 is 20 is 1. So, if this is given then I can
write the same sequence as say an+1 is 2.an where, a0 = 1 and this is defined for n greater
than equal to or n greater than 0; that means, n = 1, 2, 3 like that ok.

Now, see I tell that this is some explicit formula or some expression, explicit formula for
representing a sequence of power of 2, but this is same if I write an+1 = 2.an. Now, how
recursion we have defined that it is a process of defining itself; that means, only as if the
next term n plus 1 we are getting from an and we are writing that as a formula. So, if we
remember mathematical induction this is very similar to that thing because, induction
also we have tried. How one particular term can be represented using the previous terms
either one term or some previous few terms.

So, this induction and recursion that has a relationship and that we will explain now. So,
when we define a sequence recursively so, we write the basic thing that when we define
a sequence recursively. The most important thing is that we have to find out or we have
to specify that how one particular term, how terms are defined from the previous terms
and see this is same as that of a what is we have called the mathematical induction also

227
we have used. So, to prove normally we use mathematical induction for these recursive
definitions of sequences. Now for sets this is for sequences.

(Refer Slide Time: 10:05)

So, if we define sets recursively, recursive definition of set. Here also see we need some
initial element of a set and then we give a relation that how other elements of the set can
be added or how they are related and in that way we can generate the full set. So, we can
write that we can define a set recursively by specifying some initial element and then
provide a rule and for constructing the other elements of the set. And, this rule actually
this rule must be or some recursive way we can define. So, we can define recursively,
you can just write rule for constructing a set recursively.

Now, here also to prove the recursive definition of set we can use we use structural
induction. Since this is a construction; construction of the set so, we use structural
induction. Give one example say as if one element 5 is there so, I get one element a is 5
in a set 5 is one element in a set S. So my, initially my, as if my S, I consider that 5. We
can think as if this is my basis step if I compare from the mathematical induction as the I
can think that this is the basis step. For if I consider my S is say S is {a0, a1, a2, …} like
this are the elements then I can think that basis step as if the for a0 = 5 ok.

Now, we told that one rule recursively I can tell some rule very simple rule if I consider
what is that recursive rule. That recursive rue is I can tell that recursive rule that each
element is again we get the new element by adding 3 from the, with the previous

228
elements. So, as if the next element recursive rule is the each element or we get the next
element we get we get a new element by adding 3 with the previous element.

(Refer Slide Time: 17:06)

So, what is my a1 ? So, I get a1 is 5 + 3 because, a0 was 5 since the first element was
defined a0 was 5. So, I get the next element of the set is 8 + 3 is 11, next element I got
always if the previous element I add and this is I am telling that recursively I get; that
means, I can write sum n plus 1th element I can get with adding 3 with the previous
element.

So, finally, I got my set as if I start with 5 then 8 then 11, 14 like that it will be we will
get in this way. Now; obviously, I could start from an empty set. That I then in that case
it will be a, if I would start with the empty set; that means, if we start we will get the
same thing. So, I started with as if this is my initial element or I could start with an
empty set we get the same set if, but rules will be different we start if we start with
empty set our rule may be we give the same set with different rule.

We get a different set of elements if different rule is different recursive rule we use ok.
Now, we see recursive functions because that is most important that we can define the
recursively define functions.

229
(Refer Slide Time: 20:46)

Now, here always we have two steps when we define recursive function we have two
steps this is very similar to mathematical induction, we give a basis step where we
specify where we specify the value of the function. So, I am considering at 0, then the
recursively defined function must be must have some well defined domain; domain since
it is a function the domain must be well defined and say here I am considering the
domain is set of non-negative integers.

So, I am considering as if 0 at 0 I am specify the value ok. Now, the recursive step now I
have recursive step, this is very similar to our inductive step that we give a rule to define
the function with the set of the non-negative integers as the domain. So, my function is
such or my rule is recursive rule is such it should not violate the domain that we have
defined in the problem as its domain this is very important thing and we must remember.
We take a very simple example of recursively defined function.

230
(Refer Slide Time: 24:26)

Say basis step; so, we take simple say f(0) = 2, here also I am considering for these
example the domain is set of non negative integers. So, f(0) = 2 and the rule the inductive
or recursive step say we define something f(n), f(n + 1) is something 3 . f(n) + 4 ok. So,
now we can find we can find f(1), f(2) like f(3), f(4) and so on so, up to this. So, how
recursively we can do this function we can define. So, f 1 is we can use the relation that
say this is my basis step and this is my recursive step. So, f(1) is 3 . f(0) + 4 = 3 . 2 + 4 =
10 similarly what is f(2)? F(2) is 3 . f(1) + 4 is 3 . 10 + 4.

Similarly, I can do f(3) is f(2) + 4; is 3 . 34 + 2 is 104 then f(4) is 3 . f(3) + 4; is 3 . 1; oh


sorry this should be 4, now 2 because my recursive step is 3 . f(n) + 4 it will be 6. So, we
recursively the definition that we have given that it is defined by itself now we see that
every previous term; that means, if the function the same function we are using only for
the previous term and this is very similar to our mathematical induction. Now, we see
that very simple example that all of you know that factorial in how to compute factorial
n.

231
(Refer Slide Time: 29:04)

So, another example we see recursive definition of factorial n we know that n factorial is
n . (n – 1) . (n – 2) … 3 . 2 . 1. So, this is my explicit formula this is my explicit formula
for factorial n. Now, we can easily define this thing that n factorial is n into n minus 1
factorial. So now, if I define a function that say fact that fact n is nothing, but n factorial.
So, I can write this thing as fact n equal to any two fact n minus 1. See that same
function only with different arguments that is used to define a recursive function and this
concept is actually our how recursively defined function we use here.

So, this is the concept of or this is the way we define the recursive function. And in
computer programming this is a very important role. We will read in the next class, there
are many examples or many problems that are much easier way we can define with
recursion. And, sometimes when we write program the computer programs then
recursion is very important role. We can very easily we can write recursive program
rather than or call iterative program, that we will see in the next classes.

232
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 27
Recursion (Contd.)

So, we are discussing the Recursion and last lecture we have learned how actually we
can define recursively the sequences functions and the sets. Today we will see in details
with some examples that how recursively defined sequences can be formed and what
their applications are.

(Refer Slide Time: 00:55)

First we see the Recursively Defined Sequences. We introduce an integer sequence


which is popularly used in combinatorics and in graph theory it is called the Fibonacci
sequence. So, you introduce called Fibonacci sequence. So, first we see how these
Fibonacci sequence are recursively defined, the recursive definition of.

So, as we discussed last day and we have defined recursively defined sequences
functions and sets; that with some initial values and we can give some rule so that we get
a particular term in the sequence from the previous term or previous set of terms. So,
Fibonacci sequence it is defined that it’s initial condition, the initial condition or say

233
F0=0. F1=1 where F represents the Fibonacci sequence and the recursive definitions are
or you can tell recursive rule; that Fn = Fn-1 + Fn-2.

That means, the nth term of the sequence can be found by adding the previous 2 terms.
So, how we can find the some of the terms using this recursive rule? So, since F0 and F1
are given so if we find that find F2, F3, F4, F5, F6. Then I can apply the recursive rule as
well as we take the initial values. So, F2 is F1 + F0 and F1 is given 1, F0 is 0 so this is 1.
Now F3 is F2 + F1 just now we got F2 = 1, and F1 has the initial condition is given as 1 so
it is 2. Similarly I get F3, F4 already you will got F3, so F4 is F3 + F2 and F3 is 2, F2 is 1;
so this is 3. We got F4 is F3 + F2 and that is 3 + 2 is 5.

Then F5 is F4 + F3 is 5 + 3 is 8, then F6 is F5 + F4 is 8 + 5 = 13. And if I continue in this


way we will be getting the values of the different terms of the sequences. So, in this way
we can define the sequence recursively we can define a sequence. Now we can prove this
sequence; that means, the recursive definition of Fibonacci sequence in conjunction with
the mathematical induction we can prove, we can establish the some of the interesting
properties using the Fibonacci sequences. And which is number of application in
combinatorics as well as graph theory and other as branches of mathematics.

(Refer Slide Time: 09:13)

So, the recursive using the recursive definition of the Fibonacci sequence in conjunction
with the mathematical induction. We can establish a number of properties of these

234
sequences of these sequences. One very simple example we see so we see a property P1
say it the property tells the sum of the squares of the terms of the Fibonacci sequence.

So, just now we have seen the terms are F0, F1, F2, F3 like that the Fibonacci sequence.
And we have an initial condition we have seen that F0 = 0, F1 = 1. And using the
recursive rules we have found out that F2 = 1, F3 = 2, F4 = 3, like that already we have
seen. Now we want to see that; what is the value of the, or the sum of the squares of the
terms of Fibonacci sequence. So, if I write the say for I equal to 1, then it is sum of
squares is F0 square plus F1 square. And this is 0 square plus 1 square is 1 and say I am
writing this is 1 into 1.

Now, if it is I = 2; if I = 2, then sum becomes F02 + F12 + F22. And this becomes 02 + 12 +
F2 is also 1, so, again 12 that is 2 and this becomes 1 x 2. Say I = 3, so similarly I can
write F02 + F12 + F22 + F32 is 02 + 12 + 12 + my F3 is 2 so 22. So, this becomes 6 is 2 x 3.

Now, if I continue in this way F22 + F32 + F42 again this becomes 02 + 12 + 12 + 22 + F4 is
3. So, 32 and this is 9 + 6 this is 15 this becomes 3 x 5. Now if we observe the results or
the sum of squares for different values of I. What we see that we can write that it is for I
= 1; 1 x 1 so this becomes F1 x F2 because my F1 and F2 both are 1.

Now, my F2, F3 is 2; so I can write. So, I can write this thing as F1 x F2 ; I can write this
thing as the F2 x F3. I can write this thing as the F3 x F4. This as the F4 x F5 so we give we
get a pattern.

235
(Refer Slide Time: 15:33)

So, we can frame the formula that we can write that the conjecture or the result is that we
can write the conjecture that for all n ∈ Z+, the positive set of positive integers. The sum
of squares of the Fibonacci terms that up to n terms if I write this is Fi2 and that becomes
Fn x Fn+1. So, this is first we see the property that what will be the sum of squares of in
Fibonacci terms and we get this formula.

Now we can prove now we can prove this result by using the recursive definition and
the principle of mathematical induction. As in the last lecture we have described that
recursive definition is closely related with the mathematical induction. Because the
recursive rule that is framed from the concept of mathematical induction. Now how we
can prove that thing.

So, we will be using the mathematical induction. So, if I get the proof so first thing is
that as the, we have want to apply mathematical induction. So, we have to write the basis
step. So, for basis step we that for n equal to 1 we take assume n equal to n equal to 1
then the conjecture becomes the n1, F12 or should write the similar way as it is written
that I = 0 to 1.

Fi2 = F02 + F12 and from the initial conditions this is 02 + 12 is 1 and that I can write that
1 x 1 is F1 x F2. Since we know that F2 is also 1, since F1 = 1 from initial condition initial
value or condition we can write. And F2 = 1 so my conjecture is true for the basis step n
= 1.

236
(Refer Slide Time: 19:47)

Now, we see the how we can prove the recursive step now to prove the recursive step we
use mathematical induction. So, we assume that the conjecture is true for i = n; that
means, for i = 0 to n, Fi2 = F02 + F12 + F22 + Fn2, this equal to Fn x Fn+1.

Now, if we can show that this conjecture is true assuming that it is true for i = n the
conjecture is true for i = n + 1. So, for i = n + 1 we have to show that conjecture is true if
we can show then 0 to n + 1. And this is Fi2 square so I can write this is F02 + F12 + F22 +
… + Fn2 + Fn+12. Now this is from F02 to Fn2 I can replace by this summation i = 0 to n,
Fi2 + Fn+12.

Now, already according to that principal of mathematical induction it is the conjecture is


true for i = n, so I can write this is Fn x Fn+1. And the next term is Fn+12. So now, if I take
Fn+1 common, then this becomes Fn + Fn+1. So, Fn+1(Fn + Fn+1) is according to the
definition of Fibonacci sequence this becomes n + 2. So, here I use the recursive
definition of here we use the recursive definition of Fibonacci sequence and we use the
principle of mathematical induction.

So, this is Fn+1; F is for i = n + 1 it is true, it is true. So, I can write that the property for n
belongs to, for all n belongs to the set of positive integers that summation i = 0 to n, Fi2 is
Fn x Fn+1 this we can the proof. And in this way in this way I can prove many such
properties for this Fibonacci sequence. Now we observe or some the importance of the
basis step or the initial condition.

237
(Refer Slide Time: 24:41)

So, how we define that Fibonacci sequence? We define the Fibonacci recursive
definition that we have given the Fibonacci sequence the recursive definition of
Fibonacci sequence that with the initial condition F0 = 0, F1 = 1.

The sequence is Fn is Fn-1 + Fn-2. Now if we change the only the basis step so this is my
initial conditions or the basis step I can write this is my basis step or my initial condition
of the sequence.

So, if I just change this the even if the rule is recursive rule is same then it will generate
some new sequences so this is my recursive step. Now one such new sequence we call
that are the Lucas sequence we see that Lucas sequence even if the recursive steps are
same. So, here the recursive rule or step recursive rule or recursive step is same as that of
Fibonacci sequence. So that means, if we can write that represent this thing as a L, Lucas
sequence as L then Ln is Ln-1 + Ln-2.

But we change the basis step basis step is changed we write the basis step is changed, or
I should tell that initial conditions are changed, initial conditions are changed. So, initial
conditions we write that L0 = 2 and L1 is same as that of Fibonacci F1, is 1. Now if we
see the sequences we see the sequences and we write this is my basis step say I can, I can
find out that L2 which is 0 + L1, this is 2 + 1 = 3. L3 is L1 + L2, L1 is 1, L2 is 3, so this is
4.

238
L4 is L3 + L2, so this is 3 + 4 is 7. So, we see that terms are even the recursive rules are
same as that of Fibonacci sequence, but the terms are different. Here L2 is 3, L3 is 4, L4 is
7 and the terms are different. So, if we can if we prepare the list we see the, we can
compare the sequences; the Fibonacci sequences sequence and Lucas sequence.

(Refer Slide Time: 29:47)

You can if we compare the values we see that if we can put n we give Ln and we get give
the Fn and we see the different values of n. Say for n = 0, 1, 2, 3, 4, we take some more
values 5, 6, 7. And we can see Ln is 2 because it is given the initial conditions then 2 + 1
= 3, 3 + 1 = 4, 4 + 3 = 7, 7 + 4 = 11, 11 + 7 = 18, 18 + 11 = 29. And here the initial
conditions are different for Fibonacci it is 0 and 1. So, it is 1, 1 + 1 = 2, it is 3, then it is
5, then it is 8, 13 like that. So, what we see that that this is my Lucas number and this is
my Fibonacci number.

See even the so conclusion is even the recursive rule or the recursive definition is same;
same since the initial condition or initial terms of the sequences are different they
generate different sequences. Now since the recursive rule is same only the initial values
are different. So, there are there is a close relation between the Lucas numbers and the
Fibonacci numbers. So, we can see some; one property that again like.

239
(Refer Slide Time: 33:27)

We have seen earlier only the Fibonacci property. So, one property we have seen that
where we give either relation this gives some relation between Fibonacci sequence and
Lucas sequence. I write one such property as the see if I take the sum of Fibonacci
numbers I take Lucas number is i equal to, I take a simple property that I can write the
Lucas number say nth term of the Lucas sequence Ln, I can write it is Fn-1 + Fn+1.

So, if I see the list of sequence quickly we can see that my basis step is L0 = 2, L1 = 1, so
I can write and the recursive definition if I give recursive definition of Lucas number.
We know that Ln is Ln-1 + Ln-2. So, I can write that it is I can find that L2 since L2 is L0 +
L1. And we have seen already the numbers are 3 etcetera ok. And I can write 3 as 1 plus
2 and if you remember that this is F1, I can write F1 + F3 is 2.

Because if we remember the Fibonacci F0 = 0, F1 = 1, F2 = 1, F3 = 2, then F4 = 3 like


that. So, what is my L3, L3 is L1 + L2 and L1 is 1, L2 is 3. So, this is 4 and I can write that,
this is 4 is 3 + 1 that means, F2 + F4. If I continue in this way L4 is L2 + L3 and this is my,
L2 is 3 plus L3 is 4 this is 7 and I can write that this is F3, 2 + 5, F3 + F5.

So, I can write this is 2 + 5, this is F2 is 1 + 3, this is also 1, plus F1 is 1, F3 is 2. So, I can
see that the property holds. And the similar way we can write that. So, we can see that
property holds for that Ln is, Ln is Fn-1 + Fn-2. And the similar way we can we can give the
proof also.

240
(Refer Slide Time: 38:59)

We can see that for basis step if it is for n = 1, let my L1, or for n = 2, if I see that n = 2,
L2 is L0 + L1 is 2 + 1 = 3 = F1 + F3, 1 + 2. So, it is true and for recursive step assume for
assume it is true for n assume it is true for n. So, Ln = Fn-1 + Fn-2 true; so, for i=n+1 what I
can show Ln+1 is Ln + Ln-1.

Now, I can apply the strong form of mathematical induction here we can use strong form
of mathematical induction. So, that for Ln, Ln-1 for both we can apply the conjecture and
then for Ln, it is Fn-1 + Fn-2 and for Ln-1 it is Fn-2 - Fn. So, if I take together the for Ln, it is
Ln, is L0 + L1, L - 1 + F and n + 1. This is L - 1 + Fn+1 for n – 1, it is n - 2 and n.

So, this becomes if n – 1, Fn + Fn+2 is Fn+2 and n + n - 2 and n - 1 and n - 2 this becomes
Fn and this becomes Fn+2. So, which is the Fn+1 - 1 + Fn+1 + 1 so it is proved; so, we see
that how recursively defined sequences can be defined and for new sequences. And how
we get the properties; how we can prove the properties using the mathematical induction
as well as the recursive definitions of the sequence.

241
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 28
Recursion (Contd.)

So, in the introduction of Recursion we have seen or we have learned that how actually
recursively defined functions are constructed. Now, today we will see that thing with an
example that how the recursively defined functions are constructed and their properties
are used.

(Refer Slide Time: 00:49)

Now, in the last lecture we have seen the recursively defined sequences. Now we will see
the how it is though we define that functions recursively ok. Now, we take one example
then examples illustrate this thing. Now, we take the example of Ackermann’s function
and this can be defined this is some simplified form of the general Ackermann’s function
and it is defined as the say A(m, n) all first we give it is defined in two steps. So, first
A(m, 0) is A(m – 1, 1) for m = 1, 2, … for all integer values.

And the second step is A(m, n) is A(m – 1, A(m, n – 1)), for m = 1, 2, … like that. See
this is together these two steps are actually my recursive rule this is my recursive rule
and the initial values the if I take the initial condition initial condition this is A(0, n)=n+1

242
and this is for n = 0, 1, 2, … like that. So, this is my so together these initial condition
and the recursive rule the Ackermann’s function is defined.

And say it is of theoretical importance because that it is the rapid growth of the values of
the functional values of this Ackermann function. And it appears in many algorithms
when we compute the time complexity it appears. That is why it is an importance. So, the
theoretical importance is so it has theoretical importance it in computing; the time
complexity of many algorithms. And this is mainly due to it is mainly due to it is rapid
growth and this is mainly utilized to do that thing. Now, we see that how t,he for some
fixed values of m and n how it is evaluated using or how it is computed using the
Ackermann’s function say.

(Refer Slide Time: 06:27)

So, we can write to compute we can call this is Ackermann’s value for different values of
m and n. See we one we see that how to compute A(1, 1), this is A(1, 1). So, if we apply
the recursive rule we get A, m – 1. So, here my m = 1 n = 1. So, if I apply m - 1 this
becomes m - 1 this becomes 0, and A m - 1 A.

So, if you see that thing m – 1, A(n, m – 1). So, we write in the next step at A(0, A(1, 0)).
Now, that A 0, and if I apply in this way this becomes A 0 then A(0, 1). So, now if I
apply the second step the initial condition that A(0, n) then we get A(0, 1), A(0, 1) = 2
since A(0, 1) = 2. Now A(0, n) is n + 1 so, this becomes 2 + 1 = 3 since A(0, n) is n + 1.

243
So, in this similar way we can get that my A(2, 2) similarly we can get is A 7 or A(2, 3)
is 9 etcetera. Now, the similar way as we have done for recursively defined sequences.
Here also we can give some property for recursively defined functions and we can use
we can prove using mathematical induction.

(Refer Slide Time: 10:21)

So, one such property we see; we give you a property its P1 use induction to show that
A(1, n) = n + 2 for n = 0, 1, 2, … like that. Now, since it is induction so we can give the
solution by taking the basis step and the recursive step. So, we see the basis step say for
n = 0, this is A(1, 0). This becomes A(1, 0) and A(1, 0) is if I apply the rule then this
becomes A(0, 1) which is 2 and this equal to 0 + 2; that means, it is true. So, basis step is
proved.

Now, if we see the recursive step we see now the recursive step. Now, we assume that it
is true for n assume that it is true for the result is true for n; that means, A 1 in equal to n
+ 2 is true. Now, we have to show that for n + 1, is equal to n + 1 also it is true. So, for i
= n + 1, I can write A(1, i) is A(1, n + 1) that if I apply the recursive definition of
Ackermann’s formula. So, this becomes A(0, A(m, n – 1)) so 1 n.

Now, according to the principle of mathematical induction that A(1, n), this conjecture is
already true and that value equal to n plus 2. So, this becomes A 0 this becomes
A(0,n+2). When A(0, n) is n + 1 so this becomes n + 3; that means this is equal to n + 1

244
+ 2. So that means when i = n + 1 when i = n + 1 this is n + 1 + 2. So, this is properties
proved.

So, that what we see the totally similar way that the recursively defined functions the
recursively defined sequences that we can frame the recursive formula. And then with
the formula can also be proved by using the mathematical induction and the recursive
definition of the sequences or the function.

Now, we can see that how we can define the recursive or we can define recursively the
sets and structures. In the introductory lecture of recursion we have seen with some
examples, but now we see that how it is actually framed.

(Refer Slide Time: 15:43)

So, recursively defined sets and structures. So, recursively defined sets that we can start
thus with the empty set. And then we will define a specific rule and we will generate the
new elements so this is the main concept.

So, the definitions specifies or we can write t,he that it recursively defined set other than
the elements specified in the basis step. It can be empty set like it can be like it is it can
be empty set or some trivial values and the elements generated by the recursive rule. We
take one very simple example and we illustrate that how the sets are constructed
recursively.

245
So, consider a subset is of the set of integers defined recursively as follows. So, I can
write that since now we know that it has it must have two step. So, basis step is say the
instead of empty set I take one element 5 and these 5 belongs to S and what is my
recursive step recursive step that if x belongs to S and y belongs to S then x + y belongs
to S. So that means all new elements will be generated by this formula. So, this is my
basis step this is my recursive step and this is my recursive rule. So, my recursive rule is
this.

So, as already I mentioned my set S consist only the initial element or elements defined
by basis step; that means 5 and the newly generated elements by the recursive rule. So,
what the set becomes.

(Refer Slide Time: 21:21)

So, if I tell that new elements that generated elements generated after 1st application of
recursive rule. Then though x is here only 5, I have only one element so I can think x = 5,
y is also 5. So, the newly generated element is 5 + 5 is 10 so this is the new element.

So, after the first application this becomes 5 and 10 ok. Then after the second application
so after first application of recursive rule we can write (R R) as if this is recursive rule,
then after 2nd application I can write my S = {5, 10, 15, 25} because now x = 5, y = 10.
So, the new element is element is 5 + 10 = 10 + 5 = 15.

246
Now, x can be 10, y can be 10; so x + y becomes 20. So, if I now proceed in this way the
finally, what will get that S is the multiple of S is multiple all the multiples of 5. I get S is
a set for all the multiples of 5. So, one set we can generate by using this type of recursive
definition.

(Refer Slide Time: 24:49)

Now, we take another example that how it is used for generating string. So, first I give a
definition I give the definition of string. Let the sigma star of strings are alphabet set
sigma. And they can be defined that generated from the alphabet set. And they can
recursively or they can be defined recursively as follows. See the basis step is and define
the basis step say lambda belongs to sigma star.

Defined lambda is the empty string lambda is the continue no alphabet containing no
alphabet ok. What will be my recursive step? See if w belongs to sigma star and x is an
alphabet; that means, x belongs to the my alphabet set then new string can be generated
as w x belongs to sigma star ok. Now, if we with this definition if we take the example.

247
(Refer Slide Time: 28:13)

Where the example with any alphabet set the fixed alphabet set. So, let the alphabet set
be {0, 1}. I have only two symbols ok. And my lambda is the empty set is the empty set,
I write empty string containing no symbol how we generate that what will be the set.

So, the initial set is I can write sigma star is lambda. Then first application after first
application of the recursive rule that sigma star becomes the set {λ, 0, 1} ok. Then after
second application of the recursive rule I get sigma star is the empty set {λ, 0, 1}, then w
x we if we remember the recursive rule the w x belongs to sigma star. So, here x is {0, 1}
so, I get {0 0, 0 1, 1 0, 11}.

Now, after 3rd step 3rd application again it will be concatenated. So, I will get with
strings of length up to 3; that means, {0, 1, 0, 0 0, 0 1, 1 0, 1 1}. And now I can with all
these I can append z 0 so, this is 0 0 0, 0 0 1, 0 1 0, 0 1 1. Same thing I can now do for
these one symbol so, this becomes 1 0 0, 1 0 1. Then 1 1 0, 1 1 1 and in this way I can
continue. So, this is the way how actually we can do that thing. Now, this is how sets are
defined in are defined recursively and with new sets are constructed.

248
(Refer Slide Time: 32:39)

So, it has an application in computer science and in mathematics it is these recursively


defined application sets and structures. I have number of applications this number of
applications in defining different data structures in defining number of data structures.
And it is the importance same graph theory say if we can define tree as a graph, then this
trees all different type of trees that can be generated.

All type of trees can be generated using this recursive definition of structures. So, what
we have read that particularly the set the functions the sequences for that if we have
some initial values. And we can give a recursive rule and then by applying the recursive
rules that we can construct or we can generate the new sets as well as that new functional
value of the terms of the sequences using this recursion very easily. And it has a number
of applications particularly in combinatorics in graph theory in defining data structures.

And with this we finish the how recursively defined sets functions subsequences can be
constructed along with the concept of principle of mathematical induction.

249
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 29
Recursion (Contd.)

We have learned the Recursion and Recursion we have defined it as a process of defining
an object with itself. We have learned the function, sequences and sets and structures
how they have recursively defined. Now, today we will read the recursive algorithm
which is a very important and elegant way to solve problems.

(Refer Slide Time: 01:01)

So, you can define that recursive algorithm is an algorithm that solves a problem by
reducing to an instance of the same problem with smaller inputs. So, we defined a
recursive algorithm; it is an algorithm that solves the problem by reducing it to an
instance of the same problem with the smaller inputs. Now, if we remember we have
defined the recursive function a function. If we remember recursive function that is a
function that invokes itself; now very simple way we can tell the recursive algorithm is
an algorithm that contents a recursive function.

So, since already we know the recursive function and recursive function that invokes
itself. So, an algorithm that contains a recursive function we will call that is a, or in this
way we can frame a recursive algorithm. So, what is the approach to write or to frame a

250
recursive algorithm? So, approach is so to frame or how to frame or to design a recursive
algorithm. Since, just now I mentioned that recursive algorithm contains a recursive
function. And, since we know now how to form a recursive function then automatically
that will the algorithm will call itself.

So, we can define in this way that a problem in this class is decomposed into a number of
subproblems. It can be one or more than 1 sub problems of the sub the nature of
subproblems are the same as that of the original problem. So, I can write into a number
of some sub problems of the same type. Then each subproblem is again decomposed into
a number of simple sub problems until it gives a, or it yields a sub problem that can be
solved in straightforward way. So, the approach is nothing, but divide and conquer
method.

(Refer Slide Time: 08:38)

So, I can tell that recursive algorithm solves the problem in divide and conquer method.
So, that approaches the divide and conquer method that one problem it divides into a
subproblem, but nature is same it is of same type. And, again each subproblem another
same type of subproblems is and until we get a sub problem in such that as, if it matches
with a given condition or it can state straightforward way I can get the solution. Then we
add all the solutions of the subproblems then finally, we the solution of the subproblems
are combined to get the solution of the original problems.

251
So, now we describe the method of recursive algorithm design by with a number of
simple problems. So, first we see our one example of one example one very simple
example of recursive algorithm, that how to compute the factorial of a positive integer.
Example is computing of compute the factorial of positive integer. Now, if we limit
remember the recursive function then how to compute the factorial? All of you know the
definition of factorial that we know the definition that in factorial is n(n – 1)!. Since, we
know the definition of factorial that it is n(n – 1)(n – 2)…; the product of all integers up
to 1.

So, this is same as it is up to (n – 1)(n – 2)… then it is nothing but, the (n – 1)!. Now, if
we see the nature that when we are computing the factorial n that n! is n(n – 1).... That
means, if I write a function then as if this function with smaller inputs because, (n – 1) is
less than n with smaller inputs. I can frame a function, and, recursive algorithm contains
this type of function a recursive function or algorithm if we write that contains this
recursive function that will form a recursive algorithm.

(Refer Slide Time: 04:05)

So, how we use that algorithm, if we write the factorial you write a factorial or
computation computing factorial of n. So, we can write my input is n and n is an integer
greater than equal to 0 and output is n!. So now, I can write if I give the function name
the factorial(n) then, if n = 0 then return 1 else return n*factorial(n - 1).

252
So, we see that here the, this is the function is factorial function is n! and we have written
when we are computing, that thing the function n*factorial(n – 1) which is of same type
with smaller inputs; that means, (n – 1) is less than n. So, it satisfies the definition of the
algorithm that has it the same the original problem is decomposed into a subproblem
with smaller imports. So, this is a simple example of computing factorial n which is a
recursive algorithm.

(Refer Slide Time: 16:53)

Now, we see another example say we compute power. So, we compute an, where a is
non-zero real number and n is a non-negative integer. Now, we know the a0 is 1, we
know. So, when n = 0 it will return 1. So, for n = 0 it will because 0 equal to 1, for other
values of n, I can write an x an-1. So, as if when we will compute we want to compute an.

It can be decomposed into an-1 ; that means, if I write a function to computer to the power
n then the similar function with inputs as n – 1, a, n - 1; that means, that since n - 1 is
smaller than it. So, with smaller inputs I can frame another function of same type. So,
one algorithm that contains a recursive function and it will be recursive algorithm. So,
very simple way if I can write, I give the name that function is compute power.

So, it is a give compute power and my inputs are a n, where a is non-zero real numbers
and n is non-negative integer. Now, I can write that if n = 0 then compute power I can
write returning, I can write compute power a, n = 1 else compute power a, n = a into

253
compute power a, n - 1 that is a function with smaller inputs I can write. So, this is a
recursive algorithm.

(Refer Slide Time: 21:29)

Now, how we can prove that it is giving a correct result; that means, proving recursive
algorithm correct. Now, if we remember that when we have raised the recursive function,
the way we have proved that the recursive function gives a correct result and it is using
the mathematical induction. Now, if again if we see that the two simple examples that if
n = 0 return 1. So, as if this is my terminating condition; that means, there is there is
some condition that what the algorithm will stop otherwise it is return in into factorial n -
1.

So, I can think that this is my basis step n = 0 then return 1; that means, for n = 0 it gives
some value. And, otherwise that I am writing a recursive step which actually contains my
recursive function. If I see the next example again it is same that if n = 0 it return 1.
Because, all of we know that that a0 = 1. So, this is equivalent to my basis step because,
for n = 0 it is giving 1. And, then computing power that is a recursive step and again this
step contains the function and it is a recursive function because it is compute power n.
And, then it is decomposed into a function which required the inputs r, a, n - 1 and my n
- 1 is smaller than n.

So, those the same way we have proved the recursive function gives correct result, the
same way we can tell that the we can tell that we can prove the recursive algorithm

254
correct. So, here also there is some basis step just now what we have seen. Here also
there is some basis step which is actually for some primitive values of input or primitive
values of input results the output. And, in respect of recursive algorithm we can tell this
is nothing, but my terminating condition; that means, when the function can be computed
straightforward way when we stop.

So, this is my terminating condition. Then with what is my inductive step or recursive
step? So, this is my recursive step or inductive step. It is that the algorithmic next step
that contains the recursive function. So, for the previous example of computing power I
can tell my basis step that for n = 0 ok. So, I can write for compute power n my basis
step is basis step is n = 0, a0 = 1. And, what we have written that if n = 0 then return 1 or
compute return 1 or compute power a, 0 equal to 1 or I can write if n = 0 return 1. So,
this is my return 1. This is my terminating condition.

(Refer Slide Time: 27:47)

And what is my recursive step? My recursive step is that compute power a, n is a into
compute power a, n - 1.

255
(Refer Slide Time: 28:16)

Now, if I use mathematical induction so, if we assume for i equal to n the result is true;
that means, here result is true. That means, that is the recursive step recursive step gives
the correct result gives the correct result; that means, my compute power a n gives an this
is my correct result. So, for i = n + 1 for i = n + 1 using mathematical induction this
compute power a, n + 1 is a into compute power according to that algorithm this
becomes a, n. Now, for using my mathematical induction this is equal to an since, the
result is true we have assumed.

So, this becomes into an and this becomes an+1. So, for compute power a, n + 1 this is
also an+1 and this result is correct. So, here also we see that recursive algorithm also we
can prove using mathematical induction. This is very obvious because, the way we have
defined the recursive algorithm that algorithm contents a recursive function and the
recursive function proving we have used that mathematical induction. So, if we can
prove in this way the same thing. Now, another very popular example or of computing
Greatest Common Divisor the GCD using Recursive.

256
(Refer Slide Time: 31:11)

We can write recursive algorithm, that I gave my third example as the computing a
compute greatest common divisor; normally called gcd of two integers a and b and a < b.
Now, we can write the compute gcd function as the compute gcd a n a b, just if we write
that is if a = 0. Then compute gcd(a, b) = b else the recursive step compute gcd(a, b)
equal to compute gcd(b module a, a).

So, this is nothing but all using the computing gcd using Euclidean all algorithm. So,
computing gcd using Euclidean algorithm, see if I take an example of say am I want to
compute gcd(5, 8); 5 < 8. So, I can write gcd(5, 8), I can write gcd(8 module 5, 5). This
becomes gcd(3, 5), then according to the algorithm this becomes gcd(5 modulo 3, 3). It
says gcd(2, 3), then this becomes gcd(3 modulo 2, 2).

257
(Refer Slide Time: 34:30)

If I continue then 3 modulo 2 is this becomes gcd(1, 2) is gcd(2 modulo 1, 1). So, this
becomes gcd(0, 1) and now gcd(a, b) = 0. So, this is equal to b so this is 1. So, this is our
Euclidean algorithm and we can get now, see here the way we have written this is that
compute gcd(a, b) and this is compute gcd b mod a. So, actually this is with my smaller
inputs, this is my every time we are getting that recursive function with smaller inputs,
this is my recursive function with smaller inputs. So, we can compute gcd or recursively
so, this is one recursive algorithm for computing gcd.

And, with this example we see that it is nothing, but the implementation of Euclidean
algorithm. And, in this way we can frame the simple some simple examples I have given
that how we can design, how we can develop some recursive algorithm. Well, which
actually there is some basis step in algorithm form; we can write that is my terminating
condition. And, the recursive step that is my which contains the recursive function; that
means the same function with smaller inputs.

Now, we will continue with some bigger examples that how to frame or how to design
the recursive algorithms in my next class.

258
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 30
Recursion (Contd.)

So, we are discussing about the Recursive algorithms. In the last lecture we have learned
how to frame or how to design small recur recursive algorithms, where mainly we have
considered the algorithms which contains some recursive function.

Now, today we will see a different type of algorithms we will continue the discussion on
the recursive algorithms only, but today we will consider different type of algorithms not
that algorithms containing recursive function they know. So, we can write recursive
algorithm for our to solve the problems.

(Refer Slide Time: 01:07)

So, we know that searching is a very important and important technique where the
problem is that we have a n number of elements and n number of unordered elements we
considered unordered elements say a1, a2, a3 up to an and given element is x. So, one
element we searched or a given element is x. Now, the problem is that searching the
problem is that we have to search or we have to find out whether x is in this list or not
this within this a 1 to n elements.

259
So, linear search what we do what is the approach? The linear search that we compare x
with each element of the list starting from a1, a2, … an. And if so, we compare x with
each of the element of the list a1 to an. Now, if at the; that means, x is compared to a1
then if not then if it is not equal, then x is compared to a2 in this way we will go to at the
ith state we will compare x with ai.

Now, if it is equal then if x is equal to ai then i is the location where i is the location of x.
So, this is the is a positive search i, x exist in the list, but if x is not equal to y if x not
equal to ai then we increase the index of the list which is i list by one; that means, i
becomes i + 1. And we will compare and we compare x with ai+1 and then again we will
continue that whether x = a + 1 or not and the same thing will go. So, this is our
approach of linear search this is my linear search approach.

Now, see here there is no mathematical function involved what last day the or last lecture
we have discussed mainly the factorial in or to find out the GCD or to find out the now
power a to the power n when the algorithm contents the one recursive function. So, here
no mathematical function is there, but these we can write this approach or this algorithm
we can write a recursive algorithm to solve this problem of linear search. So, we write
the function of linear search.

(Refer Slide Time: 07:11)

We give the name that say lin search the function name is lin search and the inputs are i,
j, x. Where i, j, x are integers here i, j at the index of the list or the indices of the list and

260
x is the element to be searched. Now, if ai at the ith stage. So, ai = x then we can write
that location is i. Else if ai not equal to x then we will compare the two indices; that
means, if i = = j; that means, my full list as is already compared and then we do not get
the element x in the list. So, we can write that location equal to 0. Else we can write that
may lin search i + 1, j, x. So, this is my recursive step this is my recursive step.

See that my function is lin search on the inputs are i, j, x and if it is not equal to ai then I
have increased my index i + 1 and j. So, actually this is smaller number of inputs the way
we have defined the recursive algorithm and then we again we call the same function;
that means, the function in books itself with smaller inputs. So, this is the recursive
function of lin search the linear search ok. So, we can easily we can write the linear
search algorithm.

(Refer Slide Time: 10:43)

Now, if we consider the binary search, then we can write the binary search. So, quickly
we see that what is the approach what is our approach see again we have a list of n
elements, but in this case the elements are ordered list. So, inputs are here the input
inputs is a ordered list; that means, it is a sorted array or sorted list ordered list of n
elements. So, ordered list of n elements and right this is a1, a2, a3 up to an.

Now, here we find a middle element find the middle element as a mid equal to floor or
firstly, we see the middle location and then we will get the. So, we see first the location
the middle. So, it is (i + j) / 2, where i and j are the minimum and maximum index of the

261
list indices of the list. And this is a floor function we normally we defined say floor n is
the greatest integer less than or equal to n. See if it is ceilings 7 then it is equal to 7, but if
it is ceiling 7 by 2. So, it is 3.5 sorry so, this is a floral floor 7 by 2. So, this becomes
greatest integer less than or equal to n here n = 3.5 so, this becomes 3.

So, I get a mid is an integer. So, that I get a mid is an integer value and now I can find
the middle element as the mid. Then I will search or I will shortened my list first I will
compare x if x is the element we searched then I will compare x with compare x with a
mid.

(Refer Slide Time: 14:49)

Now, if x equal to amid then my location is mid then location is mid; that means, I got the
element x exist in the list. If x not equal to a mid and we get x less than a mid since my
input list is a sorted; that means, my x if it lies then it must be within the first half of the
list. That means, now if I consider this is a1, a2, a3; now I got a mid I have computed and
then an.

So, if x less then amid; that means, x must lie between the first half. So, x lies here x lies
here if it exist in the list; that means, if when x less then; when x less than a mid and if x
not equal to amid and x greater than amid, then if I consider the sorted list like amid to an
then my this lice in the right half of the list since it is a sorted.

262
So, these becomes x lies here; that means, x greater than amid, z greater than amid. And see
then we will search if I want to write a procedure that recursive algorithm say bin search
I give the procedure name the bin search then originally if it is i, j, x this is my element.
Then if it is x less than amid; x less than amid then and say my where my mid is say floor
(i+j) / 2. Then for the first case when it is less than I will be my bin search will be bin
search will be that i. Now I have shortened the list to be searched as ceiling sorry this is a
floor function (i+j) / 2 x.

So, it is for smaller inputs, now if x greater than amid the second case, then my bin search;
bin search will be because it is in the right half of the list. So, it becomes floor i + g / 2 +
1 and j x. So, what we see that the way we have defined the recursive algorithm that the
function in books itself with smaller inputs. Now, we see the size of inputs become lesser
it is first this is the same function and the input size here the original list is actually
halved it is partitioned into 2 and this is my left halved that i from j it becomes that
(i+j)/2.

Similarly, when it will be in the right half when x greater than amid then this is again the
right half; that means, mid plus one mid is (i+j)/2 floor of that. So, this plus 1 to j x again
this is the function. So, the function invokes itself with smaller inputs. Only thing here
instead of function I can write my algorithm so, this is here I can write the algorithm
invokes itself with smaller inputs. So, this is the way the recursive function of binary
search we can frame. So, now if we write the binary search algorithm that we give the
name the some bin search and the inputs are same as i, j, x.

263
(Refer Slide Time: 20:49)

Only here one thing we must note that it is a, i, j are the indices are the minimum and
maximum indices of the ordered list; that means, sorted in any decreasing in order or in
increasing order the ordered list and x is the element to be searched.

Now, first we have to find out we find out the mid the value of mid the middle value we
give the name as the variable name as mid it is floor (i + j) / 2, then we compare that if x
is equal to the middle element which is amid. Then location equal to mid; that means, we
get the element x in the list location equal to mid.

Else if we give that x less than; that means, if it is not equal to amid then we search
whether x is less than amid, x is less than amid and i less than m; that means, whether it is
in the first half i less than mid ok; i less than mid. Then I will call bin search as already
we have seen i with the smaller inputs; that means, it will be i mid minus 1; that means,
my first half, the left half and x.

Else if it is not if I do not get the element in the first half then else if will check that x
greater than amid; that means, if x not less than amid then x must be a mid greater than amid
and j greater than mid; that means, my right half. Then I will call again bin search and I
will call again bin search with smaller input, but this time it will be mid + 1 then the
index j and x. Else if I even if I do not get any of the comparison is true; that means, it is
not amid it is I do not get that x less than amid and i less than mid or x greater than amid then
which is the x does not exist in the list; that means, location = 0, then I get location = 0.

264
So, here also we see that first this is my recursive algorithm with the input i, j, x if it is
not the middle element then my list where we are searching the x element the given
element x that we are we are invoking the same function with the smaller inputs i and
mid - 1. So, this is the smaller input set some smaller inputs because my j instead of j we
are taking we are taking mid - 1.

Similarly, when therefore, the write up we are considering again this is the smaller
inputs, it is a same function we are invoking because it is in the right half. So, mid i
becomes mid + 1 and j. So, here that j becomes mid - 1 so, lesser inputs here i becomes
mid + 1 so, again it is that. So, the both the cases the length of length of the list is
reduced to half. So, it becomes the smaller inputs. So, it is a recursive algorithm.

Now, we see a different type of now recursive algorithms, but again we have learned that
as a recursive function we have seen that Fibonacci numbers we know now the Fibonacci
sequence.

(Refer Slide Time: 27:25)

If we remember that we know the Fibonacci sequence as see if I give f0, f1, f2, … fn is up
to nth Fibonacci number where f0 = 0, f1 = 1 and we can write that fi is fi-1 + fi-2. So, it
depends on the previous two elements.

Now, we can compute or we can write a recursive function for computing the Fibonacci
numbers we see that how we can. So, that thing; so, we write the function we give the

265
function name as say Recfibo to compute and give that to compute the Fibonacci
numbers recursively. We can write to compute the nth Fibonacci number say number
recursively and I give the name as say Recfibo(n) because it is a nth Fibonacci number.
So, if n = 0, since I know as the initial condition f0 = 0.

So, I can write that Recfibo(0) = 0 it is given. Else if we see whether n = 1 then also the
it is given that Recfibo(1) = 1. Else so, it is if it is not then else we write the recursive
step that Recfibo(n) is equal to Recfibo(n – 1) + Recfibo(n – 2). So, this is my again this
is my recursive step; this is my Recfibo(n); this is in my with smaller inputs so, this is
my recursive step.

(Refer Slide Time: 31:05)

Now, if we see the an example; that means, if I want to compute that compute f4 or say f5
just if I draw that the way it is computing we know that f4 the recursive step is f3 and f2.
Then when it is f3 is computed again it is f2 and f1 it is f2 is f1 and f0. Now, since the, and
see f2 is f1 and f0, see my f0 and f1 are given; that means, we can compute straightforward
way. So, these are the things I know since because f0 = 0 is given and f1 = 1 is given.

Now, but at each stage of these say like f2 here f3 here I need an addition because it is f2
is f0 + f1 I know because my f2 is, f2 is f0 + f1. So, for these case I need 1, 2, 3, 4 I need
some for addition. Now, if I quickly remember the numbers if I write the numbers that f0
= 0, f1 = 1, f2 = 2, f3 = 3, f4 = 5, f5 = 8 and so on.

266
Now, see when we are computing f4 when we are computing f4 I need to compute f4 we
need 4 additions that we can write to compute; that means, it are 4, this 4 I can write as
say f4 - 1 because, f4 is 5, f0 is 0, oh sorry I have this is it we known this is this sequences
f0 is 0, f1 is 1, f2 is 0 + 1, f3 is 2, f4 is 2 + 1 = 3, and f5 is 5 and so on.

So, I have 4 when we are computing this becomes f5 - 1. So, this becomes when we are
computing this becomes if 5 - 1 for addition. So, in general we can write to compute; to
compute fn we need fn+1 minus 1 number of additions if we quickly do the for f5.

(Refer Slide Time: 35:07)

Then this becomes f4, f3, f3, f2, f2, f1, f1, f0 here it is f1, f0 this is becomes f2, f1, f1, f0. So,
here also we see we will stop computing when this becomes f0 or f1, f1, f0. So, in this case
I need 1, 2, 3, 4, 5, 6, 7. So, to compute f5 we need 7 additions; that means, which is 7 is
equal to f6 - 1 is 8 - 1 is 7. So, just now what we have seen that to compute a pen
recursively to compute fn the Fibonacci number recursively we need fn+1 minus 1 number
of additions ok.

Now, if we write a function where we want to find out the Fibonacci number iteratively;
that means, to compute fn iteratively we need simply n - 1 addition. So, for n greater than
equal to 1 always that fn+1 - 1 is much greater than n - 1. So, what we conclude from here;
that means, we conclude that not always the recursive functions are good that means it is
not efficient.

267
(Refer Slide Time: 38:07)

So, we can conclude that recursive algorithms recursive algorithms are not efficient
always; are not efficient always because, for this problem of computing Fibonacci
number we see that iterative program better than the recursive program. But, we will use
recursive algorithms because many times these are f not only efficient it is implemented
much easier way; that means, we can write the code even if it is not efficient. So, even it
is not efficient many time for some problems it is easy to write the code or to write the
algorithms not only that and it can be implemented very easily efficient way although the
complexity is not good.

So, that is why the recursive algorithm is very important in computer science and for a
set of problems actually only recursive algorithm is the solution. So, we will see that how
we can find out this efficiency of the complexity when we write that the recursive
algorithm. That means that analysis of algorithm is analysis of algorithm is much easier
when we write a recursive program, when we write a recursive problem or recursive
algorithm recursive algorithm.

So, in the next class or next lectures we will see that how we can using the recursive
algorithms we can do that thing.

268
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 31
Recurrence Relations

So, we have read the recursion and the recursively defined sets, functions, sequences and
we have also learned that how to design the recursive algorithms. Today will read the
Recurrence Relation, which is very much related to this recursion. And will see that, how
given a sequence that each term is related to others and how we can get a explicit
formula, how we can get a recurrence relation with that thing and how to solve or what
do you mean by solution. So, will do that framing recurrence relation and solving
recurrence relations will read the recurrence relations.

(Refer Slide Time: 01:20)

So, first we define a recurrence relation, I can write that a recurrence relation for the
sequence, we have earlier read the sequence or recursively defined sequences. So, for the
consequence a0, a1 to an having n number of sequence. It is an equation that relates an to
certain of its predecessors and the predecessors are a0, a1 up to an-1.

So, recurrence relation gives a relation that how an is related to its predecessors. Now we
have already read many sequences where this relation exists. So, one popular example is
that Fibonacci sequence, how we define that Fibonacci. So, for Fibonacci sequence we

269
know that nth Fibonacci number f n nth Fibonacci number is an or fn, fn is fn-1 + fn-2 and
some initial conditions are given that f0 = 0 and f1 = 1.

So, this is an example of a recurrence relation because, fn is related to its predecessors,


the fn-1 and fn-2 with some addition and these are my initial conditions. So, this is an
example of recurrence relation, we taken example of compound interest, how to compute
the compound interest, we take one example.

(Refer Slide Time: 05:17)

Example 2, see person invests rupees 10000 at the rate of say 15% interest, which is
compounded annually. Now we want to find out the total amount at the end of nth year.
So, we can write the amount that the at the end of nth year, we can get that An is An-1 that
amount that at the end of n - 1 th year plus the interest; that means, it is 15%. So 15,
(0.15) x An-1. So, I can write this is (1.15) x An-1. So, here An relates to only 1
predecessors An-1 in this wait (1.15) x An-1. So, this is a recurrence relation, this is a
recurrence relation.

Now, if I take that n = 3, see n = 3. So, A3 is (1.15) x A2, I can write 1.15 into again it is
1.15 we want. So, this is square, A1 is (1.153) x A0. Now what is my A0 ? Because at the
beginning it in 10 rupees 10000 was invested; so, it is 10000. So, I can write that it is
1.153 x 10000. So, I can generalize this thing as that An = 1.15n x 10000 and we call this
is a explicit formula, this is an explicit formula or of n. So, this is my recurrence relation,
where the nth term, how it is it gives a relation, how it is related to the predecessors and

270
it gives directly; that means, it is a function of n explicit formula. Now, we have read the
recursive algorithm also.

(Refer Slide Time: 09:48)

So, the same for the same example, I can write the recursive algorithm that, I can write
the function that if it is compound interest n; that means, at the end of nth year. Now if
n=0; that means, it is my initial condition or the terminating step then return 10000 else it
will return that compound interest delete 1.15 into compound interest n - 1.

So, with this simple example, you see that what that we get the recurrence relation
explicit formula and this recurrence relation; that means, the recursive step that if we
give a code of that then it gives you as the recursive algorithm on that thing. Now, we
take another simple example, but it is very important when will see the will try to solve
the recurrence relation.

271
(Refer Slide Time: 11:50)

So, earlier we have read one example of set that say let Sn be the number of subsets of an
n element set then how can I give a recurrence relation for a set, if we remember that see
Sn be the number of subset then Sn-1 is the number of subsets of an n - 1 element set.

So, let initially I have, let we start with the set, we start with the set having n - 1 element.
Now if I get 1 element to that set. So, that it becomes an n element set then what will be
the number of subsets? So, the number of subsets, or of a set having n elements, I can
write this equal to the number of subsets having n - 1 elements subsets of a set having n -
1 element plus, if I add one more element to all the subsets of this n - 1 elements; that
means, this is if I let the nth element be let the nth element be a or an.

So, number of subset of a set having n - 1 element, which is without a and here I can
write the number of subsets of a set having n - 1 element with a, this is with a. Now
clearly this is my Sn-1 and this is also Sn-1 only difference is here, in these subsets a was
not there and in this subsets S is there. So, this becomes 2 Sn-1. So, Sn = 2 Sn-1, this is my
recurrence relation, this is my recurrence relation.

272
(Refer Slide Time: 17:23)

Now, we can get the explicit formula also for this example, if I start with that Sn = 2Sn-1
is 2 x 2 Sn-2 is 2 x 2 x 2 x Sn-3. In that way, if I continue I will be getting that 2n, which is
here 23 x Sn-3, this is actually 23 x Sn-3. So, I can get 2n x Sn-n is 2n is 0, and or S0 is 1,
which is the empty set, this is 2n.

So, Sn is 2n and this is my explicit formula, for the number of subsets Sn is the Sn is the
number of subsets of a set having n elements. So, we see that how we can frame the
recurrence relation and we get a explicit formula actually, this explicit formula is called
the solution and the solution that which satisfies the sequences, we get. Now we get
another example we see.

273
(Refer Slide Time: 19:19)

So, we find the number of the bit n bit strings, find the number of n bit strings that do not
contain 1 1 1 say, a particular bit pattern is not there then how to solve or how to get this
number. So, let the solution is let S n be the number of n bit strings that do not contain 1
1 1 pattern. Now we want to find out the recurrence relations actually here, that example
will be that find the find the recurrence relation, because first we try to frame the
recurrence relation, how to frame the recurrence relation.

So, our problem is find the recurrence relation, where for the number of n bit strings, but
we write for the number of n bits string that do not contain 1 numbers. Now let Sn be the
number of n bit strings then; obviously, Sn-1 be the n - 1 bit string that do not contain 1 1
1. And then similar thing, where is n - 2 is n - 3 like that then how we can get because,
recurrence relations we have defined that a particular term, how it is related to it is
predecessors; that means, here how Sn how Sn is related to it is predecessors bit Sn-1, Sn-2
and so on.

Now, how we can find Sn because, it should not contain 1 1 1. So, I can get Sn. So, I can
get Sn that will found that that it is the strings the number of strings that begin with 0,
number of strings that begin with 0 because, it they do not contain 1 1 1. So, if it begins
with 0. So, then it will not contain the 1 pattern then number of strings that begin with 1
0 then also it is violated number 3 is the number of strings that begin with 1 1 0 says that
1 1 1, it does not consider.

274
So, I can write that expression that Sn, I can write Sn = Sn-1. For the first case, then Sn-2 +
Sn-3 then what will be my initial conditions? My initial conditions will be S1 = 2 since,
only 1 bit S1 that it will it can be only 0 and 1. So, it is 2 then what will be my S2? S2 will
be 4, because these will be 0 0, 0 1, 1 0, 1 1. Similarly, I can get S3 = 11, I can get S3 = 7
because here, it will be 0 0 0, 0 0 1, 0 1 0, 0 1 1, 1 0 0, 1 0 1 and 1 1 0, but 1 1 1 will not
be here, these will not be here because so, it has 7.

So, the initial conditions that S1 = 2 S2 = 4 and S3 = 7, I get the recurrence relation that is
n = Sn-1 + Sn-2 + Sn-3. So, I can frame the recurrence relation for Sn, which is the, which
represent the n bit string that do not contain 1 1 1. Now we can see that a different type
of examples normally, it is very important that we call that a codeword enumeration.

(Refer Slide Time: 27:15)

So, we take another example of codeword enumeration. Say a code a valid codeword so,
a valid codeword is a some n bit word having decimal digits with even number of 0’s.
So, it is defined like even number of 0’s, now we have to find the codeword. So, let an be
the number of valid codewords then, how we can get a relation or a recurrence relation?
So, I can write that an and here also I can get set, how we can get the recurrence relation
of the n or how we can found the number of valid codewords? So, it can be the first
word, first letter or the first digit can be other than 0. So, there are 9 such digit, digits can
be there.

275
So, 9 ways I can do that thing, we can do and how many such we can get. So, this going
to be 9 an-1, because n - 1 is a again a valid code word; that means, we consider n - 1 is
the n - 1 bit words having even number of 0’s and other way other things, we can get that
the total number of codewords. So, if I can add a0 total number of code words having n -
1 bits. So, total number of codewords with n - 1 bits minus an-1, the valid codeword. So,
it will give me the total number of it will give me the total number of invalid codewords,
the total number of invalid codewords with n - 1 bit.

Now, if we add 1 digit the nth digit say the nth digit as 0 then I will get a valid codeword,
I will get a valid codeword. So, I can tell that these 9 an-1 and these total number, what
will be that number? We can we can see that, these number total number will be the
actually give me the n. Now, what is this number? This number will be we know that
since, I have 10 digits. So, these will be 10n-1 is the total number of codewords minus
valid codewords is n - 1. So, this is number of a invalid codewords, this is invalid code
words with n - 1 bit and n th bit we add a0.

(Refer Slide Time: 33:49)

So, n becomes a n is 9 an-1 + 10n-1 - an-1 and this gives me 8 an-1 + 10n-1, this is my
recurrence relation then what is the initial condition? This is my recurrence relation. We
can get that for a 1 the initial condition is that a1 = 9 and a2 = 81 + 1. So, 100 is 1 that we
can validate that it is equal to 82. So, you see a different type of examples and how we
can frame or how we can design the recurrence relation for those problems; that means,

276
given sequence that how a1 term is related to the previous terms. So, next class we will
see, how it can solve the recurrence relations.

277
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 32
Recurrence Relations (Contd.)

So, we are discussing about the Recurrence Relation and mainly the how to design the
recurrence relation. Now, if we remember that when we have read the recursive
algorithm then some examples, we have seen mainly the Fibonacci sequence that if we
write the recursive algorithm to compute the nth Fibonacci number, we have seen that
the recursive algorithm is not efficient because, it took much more number of additions
than the iterative algorithm.

But there were many examples even the recursive algorithm is not efficient, then also we
use recursive algorithm or recursion. Since, there are many problems where we can very
simple way, we can give a solution procedure; that means, we can give algorithm; that
means, the recursive algorithm is much easier to solve the problem. And we will see
today this type of problems. So, first we read our tower of Hanoi problems.

(Refer Slide Time: 01:59)

So again, we continue the recurrence relations and first we see some of the problems
where, how we can frame the recurrence relation then one such example is this is the
tower of Hanoi. So, tower of Hanoi is a puzzle first, we explain the problem. So, it is a

278
puzzle consisting of 3 pegs mounted on import. And n number of disks of different sizes
of sizes with holes in the center.

Now, it is assumed there is some restriction of placing the disks on the peg, that what is
that restriction that it is assumed that if a disk is on a peg, only a disk with smaller
diameter can lie can be placed on it on the top of the previous disk; that means, always
the smaller disk will be on the top. Now the problem is to transfer the disks that are
stacked on one peg to another peg by moving one disk at a time and we can use the third
disk for this purpose ok. So, this is my, the problem is this. So, first we will frame a
recurrence relation for this then say this is one puzzle and solving this puzzle is very
difficult if when n is very large.

(Refer Slide Time: 07:33)

So, if I again explain properly, say I have 3 peg say, this is first peg second peg, third peg
and in the first peg the n number of disks are there. So, in this way I can draw you say, I
have to shift these all these disks from the problem is to shift or transfer all the disks to
from peg 1 to peg 3. And, we can use peg 2 and the restriction is I should tell the
restriction that always lower disks or smaller disk having disk with smaller diameter.

So, you can I can tell smaller disks, smaller disk will be on top even during the transfer,
we must follow this restriction. We must follow this restriction you see if I have only 1
peg, if I have only 1 peg then what I will do that on simply, I will say, I have only 1 peg
then simply, I will transfer this thing to peg 3. So, I need only 1 move ok. So, if I write

279
then number of moves, it is 1, but if I have even if I have to then also I have to first I
have to if.

(Refer Slide Time: 12:05)

Now, say I have say I have 3 pegs. So, I have to then first I remove the larger one 2, 3
then the smaller one was the larger one here then this smaller one into 2 then the smaller
one from 2 to 3. So, I need 1 move then it is 2 move then it is 3. So, I have 1 move first
here 2 here 3 move. So now, when the number of disks are small numbers say 1 disk, 2
disk, 3 disk then in this way, we can shift that thing, we can transfer all the disks from
one peg to another. But, if n is a very large number then it is very difficult to write this
type of probe and if we want to write a program then it is very difficult to write that thing
then first thing is that how to solve or what will be the number of moves required, if all
the disk I want to shift from 1 to 3.

So, what will be the output? So, to get a solution for this type of problem actually
recursive approach is very easy to understand and to represent, what will be doing? So,
our approach should be that if I have n number of n number of disks and already we have
seen that form on disk, it is very easy when in greater than 1, we solve in 1 disk problem,
what is that thing as if the, we will transfer the largest disk here.

So, I need 1 1 move for this and these remaining n - 1 disks remaining n - 1 disk, I give
this number to shift. So, this is my 4 n - 1 disk, I will give and then I have for this, I have
a larger disk. Here says, if I have a larger disk and then I will ship this n - 1 disk to here.

280
So, again this is some n - 1 disk moved to here then all n disk should be should are
shifted from 1 to 3. So, here actually are we get giving yet as if these are my these are
my n - 1 disk and this is my the largest disk that was at the bottom of the peg 1. So, we
solve n - 1 disk towards here 1 and here 1.

So, twice and explicitly move 1 disk that is the largest disk. So, this will give me the
solution. So, what is a recursive approach that we know that if n = 1, for n equal, n equal
to 1, I need only 1 move that already I have explained here, I need only 1 move and our
approach is it is a recursive way of solving or recursive algorithm that as if we solve n -
1. This problem twice that means, in my, the largest is first moved to or since at the top
the first n - 1 disks are moved from 1 to 2. Then the largest disk is moved to 1 to 3 and
the n minus disks are moved from 1 to 2 and the n - 1 disks are moved to 2 to 3 then we
will be getting the solution that all n disks are moved from 1 to 3.

So, this is the our approach to solve the problem it is I think it is very much clear that if n
is very large even, if it is n is 10 then it is very difficult to move this type of thing rather
as if we assume that that when I have 10 number of disk as if the smaller number of this
say for 9, it is already solved; that means, we can move in this way we can do that thing.
So now, how we can give the recurrence relation for this problem? So, the recurrence
relation that just now what I told that we have to solve n - 1, this problem to us. So, the
solution is if we represent let C n be the number of moves required to transfer n disks
from peg 1 to peg 3 using peg 2.

So now, we can write the way we have given the solution that Cn is twice, we solved the
n minus 1 to Cn-1 ; that means, and 1 explicit move, what is this 2 Cn-1? This 1 Cn-1, you
can write 1 Cn-1 is the number of moves to transfer n - 1 disks from peg 1 to peg 2 and
another Cn-1 is number of moves to transfer n - 1 disks from peg 2 to peg 3. So, I can tell
this is my 2 Cn-1, I can tell this is my 2 Cn-1 and this 1, this 1 is for move this is my
explicit move to transfer the largest disk from peg 1 to peg 3. So, this is one rick this is
my recurrence relation for tower of Hanoi problem.

So, this is my recurrence relation. And it is very much clear that much easier way, we
can represent this thing then once I get this thing and since I know the initial conditions
also what are my initial conditions, what is my C1, if I have only 1 peg? Number of
moves required is 1. So, C1 is 1, now I can even I can get an explicit formula for this.

281
(Refer Slide Time: 24:53)

So, I know the recurrence relation Cn is 2 Cn-1 + 1 with C1 = 1 then I can write 2 to Cn-2 +
1. So, plus 2, plus 1, then again this is to square Cn-2 + 2 + 1 then it is 2 q Cn-3 + 22 + 2 +
1. So, in this way if we proceed then we will be getting 2n-1 Cn-n-1 + 2n-2 + 22 + 2 + 1,
because when we are getting 23 it is Cn-3 and it is 22. So, it is I am putting as n - 1. So,
this becomes n - n - 1.

So, this becomes 2n-1 C1 + 2n-2 up to 22 + 2 + 1. So, this becomes since this is C1 = 1. So,
this is 2n-1 + 2n-2 + … + 22 + 2 + 1; that means, it is I am getting that n number of terms
and this we know the answer it is 2n-1 / 2 - 1. So, this is 2n-1, see we have started with the
recurrence relation. So, this is my just now, we got the recurrence relation of solving tor
of an eye problem, this is my recurrence relation and just if I continue iteratively then we
get the solution also and this is my explicit formula for the number of moves to transfer n
number of disks from one peg to another.

So, this is the solution for tower of Hanoi problem or you can write that this is my
solution of tower of Hanoi problem and this is a solution. So, solution is one that it must
satisfy the sequences; that means, if n = 1, if I get n = 1; that means, only 1 peg then 2n-1
becomes 21-1 that is 1. So, we know that from peg 1 to peg 3 only 1 move is required for
n = 1, it is only 1 move, say for n = 2 then 22-1 is 3 move, we have already seen that if it
is a 2, if we remember that so if I have 2 peg.

282
So 1, first the largest will go here 1 smallest will be go here and then again smallest will
go here. So, I have I have 3 moves. So, it satisfies the relation for any number of pegs.
So, these will give me the solution this is my solution of tower of Hanoi problem and
what you see that it means if I now take the recursive approach or the recursive
algorithm then actually, it is much easier to handle this type of problem.

(Refer Slide Time: 30:08)

Now, we take another example. Let I have, let there be n numbers then how many ways
the problem is that how many ways and we have to first write the problem we have n
numbers. And, we have to compute the product of this n numbers see numbers are a0, a1,
a2 say n - 1 and then I take I can take n + 1 number and I can put here n. Now at the
product at a time product is done for 2 numbers, say ai and ai+1.

Now the problem is problem that how many ways to parenthesize the product of n + 1
numbers, we try to explain or with some example let there are that there will be 5
numbers, I will get phone numbers then it will be easier to give that thing numbers say
a0, a1, a2, a3. Now, we can parenthesize to compute the product like I can parenthesize a0,
a1, then a2 then a3 then I can do a0, a1, a2 then a3, I can take a0, a1, a2, a3 and then I take
the product I can take a0 then a1 then a2, a3 or I can take a0, a1, a2 then a3 first and then.

So, these are the 5 ways, I can the 5 ways we can parenthesize to compute the product,
when we have phone numbers a0, a1, a2, a3. So, my problem is that how many ways to
parenthesize the product of n + 1 numbers. Now, if we observe that the product or the

283
parenthesizing the numbers, when it is only 4 then we see that as if we take that we are
solving the problems with a lesser numbers then it is much easier to do their thing, say
we take this thing is a0, a1, a2.

So, as if a 3 is the number 1 number left and this is that when there are 3 numbers is a0,
a1 into. So, we first complete the product of this 3; that means, it gives that if 3 numbers
are there instead of 4 then it gives that how many ways, we can parenthesize and then we
add 1.

(Refer Slide Time: 38:13)

So, if in this way, we can we can do then my solution will be I can write my solution. So,
let Cn be the number of ways we can parenthesize to compute the product of n + 1
numbers ok. And just now, we have seen that we have if it is C3 like one example, we
have taken that if it is C3 = 5 for n = 3. So, if some recursive approach, we apply then we
can write that we can write Cn is C0.Cn-1 as if only one element, we have taken and then
C1.Cn-2, C2.Cn-3 then the reverse order Cn–2.C1, Cn-1.C0; again, we just see the way we
have done is a0, a1, a2, a3 and this is the way we have taken it a0, a1, a2, a3 the reverse
thing. Similarly, here it is reverse and this is only one that is a0, a1 into a3.

So, I can write this thing as sum of K = 0 to n – 1, CK and Cn-K-1. So, this gives a
recurrence relation. So, already we have seen that for n = 3 that C3 = 5. So, we can put
here that n = 2. So, what is my C3? So, my C3 is K = 0 to 3 - 1 is CK Cn-1 is C2. So, this
gives me that is C0 Cn-1 and then keep save me, the 10 minus of n – 1, n - k – 1; I write.

284
So, first thing is that K = 0 and n = 2. So, this becomes 2 - K – 1, C0, C1 + C1 C0, the C2
C0 C1 + C1 C2. So, we can get in this way, we can actually satisfy that we can that our
solution must satisfy the recurrence relation.

(Refer Slide Time: 45:05)

So, what we have read in this lecture that we see that some of the problems like tower of
Hanoi like tower of Hanoi problem or this parenthesizing numbers to get the product,
that recursive approach is efficient. In that sense that, recursive approach to get or to
solve the problem is easy to understand and even for it is much difficult to write
algorithm iteratively.

So, we have seen that some examples particularly tower of Hanoi problem we have seen.
An approaches first will apply some recursive our approach, then we find out the
recurrence relation, find out a recurrence relation. We have seen that how to get the
recurrence relation and next we will be for some simple examples, we have shown that
how to get the explicit formula, which is nothing, but the solution of the recurrence
relation.

So, the next is to get the recurrence relation or get an explicit formula for the recurrence
relation which is nothing, but the, which is the actually the solution of the recurrence
relation. So now, we learnt that how to solve the recurrence relation. So, in this class we
have read how to frame or how to design the recurrence relation for a given problem.

285
And to get the solution, we will we have to learn that the different techniques that is used
to solve the recurrence relation.

286
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 33
Recurrence Relations (Contd.)

So, in the last lecture we have read the read how to frame the recurrence relation and
today we see how what are the different techniques to solve the recurrence relations and
already we know that solving recurrence relation means to get an explicit formula; that
means, if the nth term of the sequence that is related to the predecessors; that means, it
gives then how it is related to n only that is the explicit formula.

(Refer Slide Time: 00:59)

So, the solving recurrence relations what are the different techniques we used. So, first
we see very simple type of recurrence relation, we will use first the iteration, first we will
see that how we can use iteration to solve that thing. Second, we will see that how to
solve the linear homogeneous linear homogeneous recurrence relation with constant
coefficient.

So, first we see the how we can apply the iteration to solve recurrence relations we take
one very simple examples of sequence say, I have a recurrence relation with an = an-1 + 3
and I give that a1 equal to, initial condition is a1 = 2. What is iteration? That I can again
replace an-1 by n - 2 + 3. So, I get an-2 + 2 x 3.

287
Again I can replace n - 2 by an-3 + 3 and so, this becomes 3 x 3. So, in this way if I
continue I can write n - 4 + 4 x 3 and if I continue, I will be getting an-n-1 + (n – 1) 3, this
is a1 + 3 (n – 1). Now I know a1 = 2. So, this becomes this becomes 2 + 3 (n – 1). Now
see we started with a recurrence relation this is my recurrence relation given a simple
recurrence relation, I have taken this is my recurrence relation and if I just iteratively, we
proceed we replace each term by it is predecessors the relation, we apply I will get the
relation that here n depends on the predecessors n - 1. Here n depends here, I get the an is
here, I get n = 2 + 3 (n – 1).

So, this is my explicit formula or the solution this is my solution of the recurrence
relation because it depends only on n or I can tell this is explicit formula.

(Refer Slide Time: 05:51)

Now, already we have read one example of the number of subsets of a set, if we
remember that the example that we have given the if Sn be the number of subsets of an n
element set then we have framed the recurrence relation like Sn = 2 Sn-1 to Sn-1. Now if I
apply iteration. So, this is my recurrence relation again, this is my recurrence relation.
Now if I apply an iteration. So, this becomes 2 Sn-2, 2 Sn-2 which is 22 Sn-2. Again I can
apply, 22 x 2 Sn-3. So, this becomes 23 Sn-3, in this way I can apply this is 2n Sn-n = 2n S0,
which is 2n x 1, because for 1 element S0 means empty set, this is only 1 subset the set
itself.

288
So, I gave that I get that a cenacle the solution is the Sn = 2n. So, this is my solution and
we apply iteration. So, apply the method of iteration. Now, this Sn = 2n, this solution we
get when my recurrence relation is Sn = 2 Sn-1. So, this is a very important thing for very
primitive solution that, we will be applying or we will be using this solution, when we
will use or we will try to solve by a linear homogeneous equations.

So, we remember we must remember this solution, we must remember this Sn = 2n and
the recurrence relation is Sn = 2 Sn-1, we remember. Now we will give the solution
technique for solving linear homogeneous equation with constant coefficient.

(Refer Slide Time: 09:32)

So, first we define the linear to give the definition of linear homogeneous recurrence
relation of order K ok.

So, a linear homogeneous with constant coefficients is an equation of the form the
following form. Write that n equal to C1 an-1 + C2 an-2 + C3 an-3 + … + CK an-K, where CK
not equal to 0, because it is of equation with order K and here the K initial conditions ,we
need the K initial conditions as if a0 = C’0, a1 = C’1, … then aK = C’K and here this C0, C1 I
give the is equal to C’0 otherwise both are C0, C1, … Ck.

So, these are make an initial conditions and this C1, C2, … Ck or the are constant K
number of, K constant coefficients. So, we defined that linear homogeneous recurrence
relations like that.

289
(Refer Slide Time: 12:59)

Now already, we have seen that Sn = 2 . Sn-1, this is a recurrence relation and I tell this is
a recurrence relation of order 1 and this is a linear homogeneous recurrence relation or
the Fibonacci sequence fn = fn-1 + fn-2 here, constant coefficient is 2, 2 is the constant
coefficient.

So, as if we can write 1 . fn-1 + 1 . fn-2. So here, this is a linear homogeneous recurrence
relation of order 2 and 1 is the coefficient constant coefficients are 1 1 1 are the constant
coefficients, it is linear since the power is 1. Now if I write n = 3 an-1 an-2. So, this is not a
linear homogeneous a recurrence relation or if I write an - an-1 = 2n. So, this is not a
recurrence relation not a recurrence relation. Since there is no relation here that, where
the nth term depends on the predecessor like that or if I write n is say 4n . an-2. Again,
this is a recurrence relation, but not with constant coefficient because, here coefficients
are 4 n is not a constant. So, it is a recurrence relation it is a recurrence relation with not
constant-coefficient, not constant coefficient.

So now, it is clear that normally with linear homogeneous equation with constant
coefficient, what we understand. Now we take an example, that for solving linear
homogeneous relation.

290
(Refer Slide Time: 17:56)

So, we take an example for solving. So, solve an = 5 an-1 - 6 an-2 initial conditions given is
a0 = 7 and a1 = 16 ok. So, we see the solution. So, first thing this is the linear recurrence
relation homogeneous with constant coefficients 5 and 6 are constants.

So now, let the solution is of the form say Vn = tn, see if we remember that recurrence
relation of Sn = 2 Sn-1, we got the solution that Sn = 2n. See this simple form that, we are
using here since here, it is of order 1 and it is a linear homogeneous recurrence relation
of order 2. Now the solution we have taken as if the of the form is tn ok. So, this is the
technique normally, we use to solve the linear homogenous recurrence relation. So, Vn is
tn. Since for the first order solution, first order solution we get solution, we have Sn = 2n
as I mentioned for the recurrence relation Sn = 2 Sn-1.

So, we have taken this form. So now, if I put here then I get I get Vn is 5 Vn-1 - 6 Vn-2, I
put the solution since Vn = tn this is the form. So, this is my form tn = 5 tn-1 - 6 tn-2. So, I
get t2 = 5 t - 6, if I divide the both sides by tn-2.

291
(Refer Slide Time: 22:12)

So, I get the equation t 2 - 5 t + 6 = 0. So, I get (t – 2) (t – 3) = 0, I get t = 2 and t = 3, I get


two solutions that t = 2 and t = 3. So, we have 2 solutions here say it is S and T. So, I can
write Sn = 2n (when t equal to 2) and Tn = 3n; that means, t = 3.

So, our general solution that like the general solution form is I get the bS + dT. So, I can
write the solution Un = b Sn + d Tn and we remember the initial condition conditions are
a0 = 7 and a1 = 16.

Now, we have to find out the constants b and d.

(Refer Slide Time: 24:28)

292
So, it continue this is continued. So, we put the initial conditions the initial conditions are
so again, you just write Un = b 2n + d 3n and a0 = 7 and a1 = 16. So, we put the values. So,
7 = b 20 + d 30; that means, b + d = 7 and 16 = b 21 + d 31 or 2 b + 3 d = 16.

Now, we can solve if we solve and we solve. So, solving equation 1 and 2, we get b = 5
and d = 2. So, we get that Un = 5 x 2n + 2 x 3n; that means, my solution is solution is we
have taken an. So, an is 5 x 2n + 2 x 3n.

So, I get an explicit formula or the solution of an. So, this is my solution of the recurrence
relation, we have taken the recurrence relation, if we see that an 5 an -1 - 6 an-2 solution of
that an = 5 an-1 – 6 an-2. So, this is the solution technique of solving the linear
homogeneous relation. Now we have given the techniques actually, we can write the
same techniques in a form of a theorem.

(Refer Slide Time: 27:47)

So, I give that if I state the theorem that you can write the statements for second order
ok. So, this be a second order linear homogeneous recurrence relation with constant
coefficient.

Now, if S and T are 2 solutions then we get then U = bS + dT and b and d are constant
coefficient. Now solution of recurrence relation, we get this gibster is this also a solution
of recurrence relation. Now if r is a root of t 2 - C1 t - C2 = 0. Since, we have considered a
second order recurrence relation then the sequence rn for n = 0, 1, 2, … is a solution.

293
So, if a is the sequence defined by a0 = C0, a1 = C1 and r1, r2 are the roots with r1 not
equal to r2; 2 roots are different then there exists b and d earlier, we have taken that bS +
dT that an = b r1n + d r2n , n = 0, 1, 2, … as the solution is the solution of the second order
equation.

So, the example I have taken and the theorem statement is the if we follow the example
that theorem statement is written as if this is the procedure or the technique that we
follow to solve the linear homogeneous recurrence relation. So, this is stated in a
theorem and the same thing we have explained with an eczema example. So, next
lecture, we will see the other techniques of solving recurrence relations.

294
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 34
Recurrence Relations (Contd.)

We are discussing about the different techniques for solve solving Recurrence Relations.
In the last lecture we have learnt that how we can solve the linear homogeneous
recurrence relation with constant coefficients, and also the simple technique of applying
iteration how we can get the explicit formula of the recurrence relation; that means, the
solution of recurrence relation.

Today again we will see read the how to solve the recurrence relation that are linear
homogeneous recurrence relation with constant coefficient, but when the roots are equal
because last lecture we have seen when the roots are not equal. So, we will continue the
solving recurrence relations.

(Refer Slide Time: 01:21)

And we will see today, how we can solve the linear homogeneous recurrence relations
with constant coefficients when the roots are equal. So, first we read the theorem. So, let
an = C1 an-1 + C2 an-2 a second order linear homogeneous recurrence relation with constant
coefficient. Yes C1 and C2 are the, but here the roots are with equal roots are equal. Last
lecture what we have done that the roots are unequal.

295
So, we can consider that the solution as if we consider that solution is of type Vn = tn
then we get the equation as t2 - C1 t - C2 = 0 and the root is both the roots are equal to r
since the roots are equal. So, both the roots are equal to r. Then the solution is, then the
solution is of the form is an = b rn + d n rn, where n = 0, 1, … like that.

So, if we remember that when the roots are not equal unequal roots, the solution is of the
form b rn, d rn it is of the form this. Now we will see that that here if the roots are equal it
is an b rn + d n rn. So, how we can first we prove that theorem. So, here mainly we have
to show that if r to the power n if rn is a solution, then n rn is also is also a solution ok.
Now, since r is the only root one root since r is the only root and the recurrence relation
the equation is a second order recur recurrence relation and it is a second order
recurrence relation.

So, we can write that t2 - C1 t - C2 = (t – r)2 because both the roots are equal to t2 - 2 r t +
r2. So, this I give equation 1. One thing we write here since last theorem we have seen
that this t is coming from the that as if the solution is Vn = tn is of this form.

(Refer Slide Time: 08:17)

Now, from equation 1 what you see from equation 1 that C1 = 2 r, C1 = 2 r and C2 = - r2.
If we equate the coefficients of the left hand side and the right hand side of the equation.
Now we have to show that if rn is a solution then n rn is also a solution. So, we take that
one solution with C1, C2 as the coefficient that C1[(n – 1) rn-1] + C2[(n – 2) rn-2] this is
equal to we put the values of C1 and C2.

296
So, this is equal to 2 r [(n – 1) rn-1] + … C2 is – r2; so, - r2 [(n – 2) rn-2]. So, this becomes
rn x 2 (n – 1) - rn x (n – 2). So, if I take rn common, then (2 n - 2 - n + 2). So, I get n rn. So
my, if I take the same convention that my solution u will equal to b rn + d n rn these are b
and d are two constants, are two constants.

And we can take that U0 = C0’ and U1 = C1’ that type of constant. So, what we prove that
that n rn is a solution. So, if we see the theorem that this is a second order linear
homogeneous recurrence relation with constant coefficients y with equal roots equal
roots, then we get that n rn is a or I give the solution as Un = b rn + d n rn. Now, first we
see one example we see one example.

(Refer Slide Time: 12:15)

We take the find the solution of the following recurrence relation. Relation is dn = 4 (dn-1
- dn-2) coefficients given d0 = 1 and d1 = 1. Now if we take since it is linear homogeneous
recurrence relation of second order, we can consider the solution is of the form solution
is of the form Vn = tn.

So, we get that t 2 - 4 t + 4 = 0. So, (t – 2)2 = 0. So, I get t = 2. So, here the both the roots
are equal. So, my solution is of the form. So, I get if it is we take the convention because
t = 2. So, my con Sn equal to I can take Sn = 2n and Tn = n 2n from the previous theorem
just now the theorem we discussed. So, my solution becomes U=b Sn+ d Tn=b 2n +d n 2n.

297
Now, we put the d0 = 1 the condition we put d0 = 1 and d1 = 1 in this equation 1. So,
putting the initial conditions d0 = 1 in equation 1, d0 = 1 and d1 = 1 in equation 1 we get,
b 2n + d n 2n.

(Refer Slide Time: 16:01)

So, we get b . 20 + d . 0 . 20 = 1 where n = 0, d0 = 1. So, I get b this becomes 0. So, b = 1.


Now, if I put d1 = 1 then b . 21 + d . 1 . 21 = 1; that means, I put n = 1 and d1 = 1. So, this
becomes 2 b + 2 d = 1 already I we got b = 1, b = 1. So, 2 d = 1 - 2 b = - 1 so, d = - 1/2.

So, I get the solution that my solution is d n equal to, I get the solution d n = b 2 n + dn 2n =
2n – 1/2 . n . 2n = 2n - n . 2n-1. So, this is my solution of the given recurrence relation this
is my answer. Now, in the theorem we have considered the second order we have taken
the second order equation. So, if we increase the order; that means, in general form if we
take the solution of k order.

298
(Refer Slide Time: 18:47)

So, the general form that is the solution of linear homogeneous recurrence relation of
order k with constant coefficient and when the roots are and the roots of multiplicity m;
so, for second order equation we have seen that both the roots are r. So, I can trick the
value like now I can write that my equation becomes tK because it is a order K, - C1 tK-1, -
C2 tK-2, … - CK = 0.

And we will be getting the roots are or the roots or roots of multiplicity m or r is the, I
write the r is the root roots of multiplicity m. Then the solutions are rn, n rn, n2 rn in this
way of multiplicity m. So, I get nm-1 rn.

So, for second order recurrence relation, we have already seen the solution is an = b rn +
d n rn. Similarly for third order n, we will be getting that an = b rn + d n2 rn like that and
you can continue when the order will increase. So, this is the general form we get. Now
so, we have read the two type of solution techniques that mainly for solving recurrence
relation linear homogeneous recurrence relation, with constant coefficients when the
roots are equal or the roots are not equal.

Now, we see that some linear homogeneous recurrence relation earlier we have seen that
how to frame the recurrence relation or as a recursive function also, now we see that how
we can solve those recurrence relation. So, one such equation is our Fibonacci sequence.
So, we know that. So, I take the example.

299
(Refer Slide Time: 25:07)

I take this example of solving linear homogeneous recurrence relation. So, this is relation
is called; so, solving recurrence relation for Fibonacci sequence ok. We know the
sequences fn = fn-1 + fn-2, and for n greater than equal to 3, I write f1 = 1, f2 = 1. So, if I
put that the equation or the solution is of form b n = 2n we get, first we take fn - fn-1 - fn-2
= 0. So, I get t2 - t - 1 = 0.

So, if I put (- b +- √(b2 - 4 ac)) / 2 a. So, this t becomes 1 +- , (b2 - 4 ac) becomes 5
divided by 2; 2 x 1. So, t = (1 +- √5)/ 2. So, I can write the solution fn equal to I know
that b Sn + d Tn and here I can write Sn = (1 + √5) / 2 and Tn = (1 - √5) / 2. So, this
becomes is equal to b((1 + √5) / 2)n + d((1 - √5) / 2)n. Now if I put the initial conditions
f1 = 1 and f2 = 1.

300
(Refer Slide Time: 28:19)

So, first I put of the initial condition f1 = 1 and f2 = 1 we get we get b ((1 + √5) / 2) + d
((1 - √5) / 2) = 1 when putting f1 = 1; that means, n = 1 and b ((1 + √5) / 2)2 +… n = 2;
so, ((1 - √5) / 2)2 = 1; that means, I put f2 = 1; that means, n = 2. So, if I solve these 2
equation; some solving we get we get b = 1 / √5 and d = - 1 / √5 solving the log 2
equations.

So, I can write fn = 1 / √5 ((1 + √5) / 2)n – 1 / √5 ((1 - √5) / 2)n. So, this is my solution.
So, this is my solution of the explicit formula for solution or the explicit formula for
Fibonacci numbers. You can write Fibonacci sequence of Fibonacci number that is
Fibonacci numbers.

This becomes Sn is ((1 + √5) / 2)n, ((1 - √5) / 2)n ok. So, we have seen that theorems that
how to solve the linear homogeneous recurrence relation when both roots are equal or
the roots are different, when we have considered second order recurrence relation and we
have seen some of the examples like the Fibonacci number, how to solve these
sequences. So, next lecture we will see how we can solve the non-linear or linear non
homogeneous recurrence relation.

301
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 35
Recurrence Relations (Contd.)

So, we are discussing about the solution of Recurrence Relation, how what are the
different techniques to solve recurrence relations. In the last 2 lectures we have
discussed, how to solve the linear homogeneous recurrence relation with constant
coefficients when roots are equal or roots may not be equal.

And with the second order equation or second order equation or second order recurrence
relation, we have read that how with examples that how we can solve that thing. Now
today we will see now how we can solve linear, but non-homogeneous recurrence
relation with constant coefficients.

(Refer Slide Time: 01:11)

So, we will be reading the solving linear non-homogeneous recurrence relation with
constant coefficients. So, first we see that: what are the forms of non-homogeneous
reconciliation. If I remember that my linear homogeneous recurrence relation was an is
C1 an-1 + C2 an-2 + C3 an-3 + ... If it is of order k, then Ck an-k this is my linear homogeneous
recurrence relation. Now if I add a F(n) here, then this becomes an, this becomes a non-
homogeneous recurrence relation linear since the power is up each term is 1.

302
But we have then what are the; what is the solving techniques of this linear non
homogeneous reconciliation? Now see up to this part it is same this is my linear
homogeneous part this linear homogeneous recurrence relation with constant coefficient,
only here this is the non homogeneous part that is a F(n) has come. Now this F(n) this
can be of the form different form F(n) can be 2n, F(n) can be of say 3n or F(n) can be n2
+ n + 1 or it can be any other that which contents of n say 2n + 1.

So, this type of, this function can be there. So, how we can solve this thing? Now see
here that linear non homogeneous recurrence relations then I have two parts. If I consider
that an I have a, it I have a linear homogeneous part, I have a linear homogeneous part
from the above equation we see and we have a F(n) part, F(n) part. Now so, every
solution is of the form or I can write first every solution has two parts; one is the solution
of a particular solution. That means, two parts, one is the solution of non homogeneous
part, we call this is the particular solution we call these as a and second is that solution of
the associated linear homogeneous part linear homogeneous part. Normally we call this
as a homogeneous solution, we call it is as the homogeneous solution.

So, as if the recurrence relation or the equation has two part; one is the linear
homogeneous recurrence relation with constant coefficient plus this F(n) that is as if this
is a particular function it has two part. And when will get the solution, solution is also
two parts that solution of non-homogeneous part; that means, for F(n) this is called
normally the particular solution and the solution of the associated linear homogeneous
part, we call the homogeneous solution. So, we can write that we have the recurrence
relation.

303
(Refer Slide Time: 08:56)

So, every solution every solution is of the form, that an equal to an particular n p plus in h
there are two parts. So, where an(h) is the solution of associated linear homogeneous
recurrence relation and an(p) is the particular solution. So, actually an(p), I can write an(p) =
C1 an-1(p) + C2 an-2(p) + … + Ck an-k(p) + F(n). So, you can write that if my solution bn, I can
write an(p) + an(h). So, now, with some examples we see that or how we can find out the
particular solution and the homogeneous solution of a non homogeneous recurrence
relation linear non homogeneous recurrence relation.

(Refer Slide Time: 12:49)

304
So, I take one took one example it first we take a simple example. We take an example
that solve an = 3 an-1 + 2n and the initial condition is a1 = 3. So, the homogeneous linear
homogeneous part is, I can write that an equal to, I can write the linear homogeneous part
as an = 3 an-1 and the F(n) the function of n is as a 2n ok.

Now already we have seen that the solution of these an = 3an - 1 ; if I remember that our
number of subsets opposite if we remember quickly that Sn = 2 Sn-1. When we have we
have framed the recurrence relation of a number of subsets of a set having n elements,
we got that this is my recurrence relation and the solution by applying the technique of
iteration, we got the solution is Sn = 2n that we can we can remember.

So, it is of the same form; Sn = 2 Sn-1 here n = 3 an-1. So, the solution I can write, the
solution it is of the solution is of the form an = α 3n. Since here there is only one linear
part was there only linear homogenous part, but this is a hybrid type here it is a linear
homogeneous part as well as one function of n is there. So, I take one coefficient alpha,
but the solution is has is of the form 3n, that I can get from my, that simple recurrence
relation that already we have read we absorbed also iteration. So, this is of the form this.

Now I have F(n) = 2n so, that I can write the particular equation. So, this is linear
homogeneous part and the particular solution for the particular solution I can write the p n
= Cn + d; it is of the form because it is 2n simply. So, I can write that Cn + d, I can write
3 because my equation is 3n - 1 + 2 n.

So, it is 3 (C(n – 1) + d) + 2n. If we remember that the way we have done an-1(p), an-2(p),
but here I have only one first order equation. So, I have only one term. So, I have given
this term (C(n – 1) + d) + 2n because I have considered it is the solution is of form Cn +
d since my function F(n) is 2n. So, if I write then Cn + d, Cn + d = 3Cn - 3C + 3d + 2n.

So, if I write 2 Cn, 2 Cn + 2 n = 3 C - 2d. So, I can write this equation as n x 2 C + 2 if I


take here plus 2 d - 3 C = 0 since C n + d is a solution. So, what I get here? C n + d is a
solution. So, as if this is C and this is my d. So, I can write that since C n + d is a
solution. So, this it will be a solution then to C + 2 = 0 because this is equal to 0. So, 2 C
+ 2 = 0; that means, C = - 1; C = - 1 and 2 d - 3 C = 0; so, d = 3C / 2 = - 3 / 2. So, I get
the coefficients I get the 2 coefficients C and d, C = - 1 and d = - 3 / 2. So, what is my
particular solution?

305
(Refer Slide Time: 20:44)

So, my particular solution that an(p) = C n + d. So, equal to - n - 3 / 2. So now, we have to


find out that my solution total solution that an I can get an is - n - 3 / 2 + α 3n, because α3n
was my solution for homogeneous linear homogeneous part. So now, we can put in this
equation, we can put the put the initial condition a1 = 3 that was the condition. So, I get if
that means, n = 1. So, for n = 1, I have 3 = - 1 - 3 / 2 + α 31. So, 3 α = 4 + 3 / 2 is 11 / 2.

So, I have α = 11 / 6. If I put a1 = 3, this is 3, this is - 1 - 3 / 2 + α 31. So, α 31 is 4 + 3 / 2,


I think it is 11 / 6. So, now, I can write my solution the final solution is - n - 3/2 + 11/6,
3n. So, this is the solution this is the solution of that given linear non homogeneous
recurrence relation. You now we see another example where, the function of n is of
different type and we see that how we can solve that thing.

306
(Refer Slide Time: 25:22)

So, we take another example, and I write that find all solutions of the recurrence relation
is 5 an-6 + 6 an -2 + 7n. So, we see the solution the way we have done; first we see the
linear homogeneous part for the linear homogeneous part. So, we know that if we put the
form of Vn = tn that type of solution then we get, since it is a second order linear
homogeneous that homogeneous part; that means, this is an = 5 an-1 - 6 an-2.

So, I get t2 - 5t + 6 = 0, and this becomes (t – 2) (t – 3) = 0. So, t = 2, t = 3. So, my


solution becomes that an = α1 2n + alpha α2 3n what earlier we have done that b is n b Sn
+ dt n. Here is n = 2n if we remember that earlier we have done that, Sn = 2n and Tn = 3n,
I have given earlier that solution is that bs n td n that α12n + alpha α2 3n.

So, this is my linear homogeneous part. Now, we see the, you see the of particular
solution see here that over for the for the particular solution. So, my function is F(n) = 7n.
So, I get my particular form an = C x 7n some constant, this is of the solution is of this
form. So, if I write that C 7n, np = 5 an - 1. So, there I get C 7n - 1 - 6 C 7n - 2 + F(n) 7n.
So, if I divide both sides by 7n - 2, I get C 72 is 35 C - 6 C + 72. So, this becomes 49 C -
35 C + 6 C = 49 that gives C = 49 divided by this is becomes 20 C = 49. So, C = 49 / 20
so, this is my particular solution.

307
(Refer Slide Time: 31:18)

So, my final solution becomes. So, my final solution it has 2 part that an = an(h) + an(p) and
that becomes that α1 2n + α2 3n + (49/20) 7n. So, C is (49/20) 7n. So, this becomes (49/20)
7n.

Now if I get some conditions like then I can find out I can find out α1, α2, you can find
out α1 and α2 from a given from the given initial conditions. Since it is a second order
linear homogeneous equation so, I need at least 2 conditions to find out α1 and α2. So,
there must be 2 conditions to find out α1 and α2 and solving those equations, I can get the
solution.

So, once we get the ones we get the values of α1 and α2, we get all the solutions of we get
all the solutions of though given recurrence relation. So, we have learned that how to
solve the linear non homogeneous recurrence relation. Mainly non homogeneous
recurrence relation has 2 part the homogeneous part. Homogeneous genius part will be
solving the similar way we have handled the linear homogeneous recurrence relation and
only for the function of n part that we will get the particular solution and the technique
we have just now illustrated. So, with this we have we finished the lecture of the solving
recurrence relations.

308
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 36
Counting Techniques and Pigeonhole Principle

Today, we will read a Pigeonhole Principle which is an elementary, but very important
commentarial principle. We can use to solve a variety of problems and the problems
using arrangement.

(Refer Slide Time: 00:47)

So, the study of arrangement is of object is an important part of discrete mathematics.


So, we write Pigeonhole Principle. The study of arrangements of objects is an important
part of discrete mathematics. We can face many arrangement or many counting problems
in terms of arrangement, I am for ordered or unordered arrangements and there we can
use this pigeonhole principle to solve the problems. So, this is very elementary, but very
important counting techniques or the principle that we use for counting or in
combinatorial problems.

So, I can write the introduction that we can; we can phrase many counting problems in
terms of ordered or unordered arrangements. And pigeonhole principle is an elementary;
I can tell this is a combinatorial tool that can be used to solve a variety of counting
problems associated with arrangements.

309
So, very simple way if I tell this principle that, the term is pigeonhole. So, as if a lot of
pigeons fly into not too many pigeonholes, then each pigeonhole must contains more two
or more than two pigeons. So, very simple form I can tell this term, that from where this
pigeonhole terms are coming.

So, simple way if I use this term that the principle about pigeonhole, in very simple word
if I tell. I can tell that, if a lot of pigeons fly into not too many pigeonholes, then at least
one pigeonhole will be occupied by two or more pigeons. And this simple rule or
principle, we can apply and we can solve an interesting problems or we can conclude
surprising way, that conclusions are sometimes it very surprising though simple.

(Refer Slide Time: 08:59)

So, first we in a simple form or more mathematically, we try to state the pigeonhole
principle. A simple form we tell, you can write the statement as a theorem. So, if n plus 1
objects are put into n boxes, then at least one box contains two or more of the objects.

So, the earlier statement I made, there here these n objects are similar to the pigeons and
the box are the pigeonholes. So, how we can prove? So, statement is n plus 1 objects are
put into n boxes, then at least one box contains two or more of the objects. So, if we
prove, the proof is very simple. So, if each of the n box contains at most one of the
objects, then the total number of objects is at most n. Because there are n boxes we have
considered.

310
Now, since we start with n + 1 objects. So, we have still one more object to put in some
box. So, clearly the box where we put this n plus 1th object or the last object or the last
one that contains two objects and it is proved.

(Refer Slide Time: 14:07)

So, here we have; we have considered that each of the n boxes; if each of the n boxes
contains at most one of the objects. Otherwise, that if we do not consider this that at each
box contains at least one, then automatically that one of the n box; one of the n boxes
must contain two or more than two objects.

Now, here something we must see that, this pigeonhole principle it does not guarantee in
finding the one of the box, which contains two or more than one objects or it does not
guarantee to identify the box or how the boxes are arranged like that? It only states that,
the arrangements are such that one of the boxes; at least one of the boxes contains toward
more than two objects. And, but with using these simple statements, we can solve a
number of problems of different classes of problems.

Now, the problems or the problems we have stated or the principle, we told sometimes
we called pigeonhole; sometimes it is also popular as shoe box problem, that what the
objects as I already mentioned the objects are pigeons and the boxes are pigeonholes.

Now, this problem can be of say coloring problem ok. Say, so instead of; so, here
actually we can write that these objects, I can tell these objects are same as that of

311
pigeons and boxes are similar to pigeonholes. Now, instead of putting objects into boxes,
I can consider as a coloring problem, then I can consider these as a coloring problem say,
coloring of balls or coloring of objects, then I can think that coloring problem that we
have to consider color the coloring of n balls; oh bit rewrite, coloring of objects with n
colors; n number of colors.

And, we can tell that, the pigeonhole principle asserts that if n plus 1 objects are colored
with ‘n’ colors, then at least two objects have the same color. So, here the pigeons and
the pigeonholes are different, as if the pigeonholes are the colors and the pigeons are the
objects.

So, when we try to solve the problem using the pigeonhole principle, that first we have to
identify that which are the, or which objects we are considering as the pigeons and which
objects are considered as the pigeonholes. Since, our pigeonhole principle tells about the
relation between the pigeon and the pigeonholes. So, we have to identify this thing. Now
as I mentioned that a number of problems or a variety of problems, that can be solved
using pigeonhole.

So, in this lecture we try to classify the problems that we use, that one class of problems
that can be used by or that can be solved by using pigeonhole. First we consider a very
simple problem that normally we solve using pigeon. And these classes of problems we
are telling as if these are some application or different application classes. So, this is one
application 1 we are taking.

312
(Refer Slide Time: 21:55)

Say, we are giving some one example we are taking, say example 1. Say, among 13
people, there are two who have the birthdays in the same month. So, first we identify
who are the pigeons and who are the pigeonholes. As, if here we have in year we have 12
months. So, here as if the months are the pigeonholes and the people are the pigeons.

So, I have I have 13 people; so we have 13 people that means, is it 13 pigeons and that
we have to put into in 12 months. And, we have 12 months that is 12 pigeonholes. So, 13
pigeons we have to put 12 pigeonholes or I can write, this is similar to that 13 pigeons fly
to; fly into 12 pigeonholes, which is same as that of or 13 people will be assigned to 12
months, according to their birthday.

So, according to pigeonhole principle that one month must contain two people. So, I can
write according to if we apply pigeonhole principle. So, according to pigeonhole
principle at least one month, because one pigeonhole contains two people, so one month
is associated with two people who have the is associated with two people who have their
or different way I write at least is one month whose, but they are in the same month.

(Refer Slide Time: 28:17)

313
Now, the similar problem I can take with under application 1, I can take another example
say, among the set of 8 students at least two were born in the same day of the week.
Similarly, here the pigeons are the students and the pigeonholes are the; so, 8 students I
can think that 8 pigeons and assigned to 7 days in the week; so 7 days, which is 7
pigeonholes.

And, so, according to pigeonhole principle, at least two students, because if I consider at
most one student in one day they are born in one day of the week, then the eighth one
must be in one of the days where already we have considered that some other student has
was born. So, two students were born in the same day.

(Refer Slide Time: 32:03)

314
This is another similar but slightly different; so, I am writing as a application 2 say the
problem is there are n - married couples. How many of the 2n people must be selected in
order to guarantee that one has selected a married couple.

So, we can directly apply pigeonhole principle. So, apply pigeonhole principle and as if
we consider n people or n pigeonholes or boxes (Refer Time: 34:11) write n pigeon
holes, considered n pigeonholes, and one corresponding to one people or to each of the n
couples to one couple. Now if we select n plus 1 people and put each of them in one
hole, then some pigeonhole contains two people.

(Refer Slide Time: 36:11)

That is if we consider, a pigeon as a couple; a married couple, then we select in two ways
either we take n husbands or n wives, and the and clearly the n plus 1th people will form
the form a couple; will form a married couple.

So, this problem directly gives this is accounting that, because my question was that how
many? Now, question was that how many of the 2n people must be selected and the
answer is that n plus 1, if we select n plus 1 people then we can get a married couple. So,
this is one, we have seen that application 1 and 2 that is two classes of problem very
simple type of problem, that we can solve using pigeonhole principle.

There are other principles related to the pigeonhole, that are similar to that the statements
that we have met. And, that we can write as a that in a different form that we can tell;

315
one is, I can write that if n objects are put into n boxes and no box is empty, when each
box contains at least one object; contains exactly one object.

(Refer Slide Time: 39:33)

Same thing; same statement, I can write that, if n objects are put into n-boxes and no box
contains more than more than one object, then each box has an object in it. So, normally
these are the three statements or the or three statements that are used for the pigeonhole
in simple form; these are the pigeonhole in simple form, that we use to solve the some
arrangement problems or the counting problems.

So, here the main principle is that, we have to; we must identify given a problem, we
must identify the pigeons the objects, which are same as that of pigeons and their number
and their numbers this is one and the pigeonholes; pigeonholes and their number. And,
then some analogy between the pigeon and the objects and the pigeon holes and the
objects and then apply pigeonhole principles, and then we apply pigeonhole principle; in
any one of the form. One we have given as a theorem one and these are two other
different ways we can state the pigeonhole principle.

So, here these lecture very simple problems; one class of simple problems as an
application one and application two, that we have read that, how to solve using
pigeonhole. In the next lecture, we will see some mathematical or numerical problems,
how we can solve using pigeonhole principle.

316
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 37
Counting Techniques and Pigeonhole Principle [Contd.]

So, we are reading the Pigeonhole Principles and how this principle is used to solve the
counting problems or the arrangement problems related with the counting. And very
simple applications we have seen in the last lecture. Today we will see that how
numerical problems can be solved using pigeonhole principle.

(Refer Slide Time: 00:55)

So, we will read the applications of pigeonhole principle and solving numerical
problems. So, you see today another 1 type of applications we call the applications 3. We
take some example and with these example we explain how pigeonhole is used here. So,
one mathematical problems we take that given m number of integers say a1, a2, a3 up to
am, we have proved that there exist integers k and l with the restriction that 0 ≤ k < n ≤ m.
Such that ak+1 + ak+2 + up to al is divisible by m.

In other words, I can tell there exists consecutive is in the sequence a1 to am whose sum
is divisible by m. So, this is a number theoretic problem that I have a sequence of
numbers m numbers a1, a2, a3, … am and they are exist some integers k and l. So, that
ak+1, ak+2 to al; that means, there are consecutive numbers between k and l which is

317
divisible by m, we have to prove this thing. And this we will see that if we use
pigeonhole principle very simple way very easily we can prove these thing ok. So, how
to solve? We have the solution procedure.

(Refer Slide Time: 05:49)

Solution: we consider the consecutive sums. So, consider I write m sums; m number of
sums of consecutive numbers of the sequence having m numbers having m numbers.
Since the sequence has m numbers say sequence is the sequence is a1, a2, a3, … am. So, if
I consider the consecutive sums then also now it will be m sums. So, sums will be say
first sum is only 1 2 consecutive numbers now I have a1 + a2, I have a1 + a2 + a3. Then I
have a1 + a2 + a3 + a4 and if I consider that up to k, then this sum is a1 + a2 + a3 + up to
ak, then it is a1 + a2 + a3 + … + am; in these way if I go then a1 + a2 + a3 up to am. Since I
have m numbers in the sequence so, I have m number m sums; since we have m numbers
in the sequence so, we have m sums or sums of consecutive numbers.

Now, if we have to show that the consecutive sums of the numbers between k and l is
divisible by m. Now we divide each of the sums by n.

318
(Refer Slide Time: 10:15)

Now, suppose we divide each of these m sums by m and consider the remainder. If the
remainder of one of the sums is equal to 0; that means, then that sum is divisible by m
and it proves the problem statement.

Now, we consider that none of the sums are divisible by m. So, there are m number of
remainders so, I write there are m remainders. Now since we are dividing the sums; since
the sums are divided by m and we have assumed that there is no sum which is divisible
by m; that means, that is no remainder or no 0 remainder.

(Refer Slide Time: 15:49)

319
So, the remainders of this divisions when the m number of sums are divided by m the
remainders can be 1 to m minus 1 that can be that is 1, 2, 3 up to m - 1; that means, there
are only there are m - 1 number of remainders m - 1 number of remainders. So, I have m
- 1 numbers of remainders and if we remember and m numbers of sum.

So, if we apply pigeonhole principle what I mentioned that first we have to identify
which objects I am considering as pigeons and which objects I am considering as the
pigeonhole. So, here if we apply the pigeonhole here m numbers of sum; that means, m
sums are the pigeons and m minus 1 remainders are the pigeonholes then according to
the pigeonhole principle that there will be two sums which have the same remainder.

So, if we apply pigeonhole principle there will be two sums which have the same
remainder when divisible by m. Since there are m sums and m - 1 remainders so, m sums
each sum is divided by m. So, there must be two sums which have the same remainder
when divisible by m.

(Refer Slide Time: 19:51)

So, let the two sums of the same remainder when it is divided by m. One is the a1 + a2 +
a3 up to ak this is one sum, another is a1 + a2 + a3 + … + ak + ak+1 + ak+2 + … + al where
we assume that k is less than l as it is given in the problem statement that case if we
remember that it is given that k less than l.

320
So, now if we subtract because they have the same remainders let the let the remainder
be r it is the same remainder. So, I can write the first sum a1 + a2 + a3 + up to ak as if
these equal to I can write b x m + r or b is my b is the quotient when the first sum is
divided by m let this sum I can write as if Sk and as I can write this sum is as the Sl. So, I
can write my Sk is a1 to ak is b.m + r.

Similarly, I can write Sl is a1 + a2 + a3 + … + ak + ak+1 + ak+2 + … + al is C m + r ; C is


the quotient and in both the cases the r is the same remainder be r when Sk and Sl is
divided by m. So, if I now subtract these equation 1 and equation 2.

(Refer Slide Time: 24:07)

So, subtracting so, subtract equation 1 from equation 2 we get Sl - Sk this is my Sl - Sk is


a1 + a2 + … + ak and these equal to. I can write that b. m + r of l - ak. So, this is my C m
+ r – (b m + r) or if I can write that a1 plus up to ak and these a1 + … + ak these will
cancel.

So, I can get ak+1 + ak+2 + … + al equal to here r will cancel so, these becomes (C-b)m.
So, since C and b where C and b are quotients so, they are integers. So, since C and b are
quotients and integer. So, ak+1, so, I can write ak+1 + ak+2 + … + al is divisible by m or in
other words or we can tell that the sum of consecutive numbers from k to l, k+1 to l, I
can write from k+1 to l; that means, from ak+1 to al is divisible by m.

321
So, it is proved. So, quickly if I see that my problem was that we had m numbers in the
sequence and we have to prove that ak+1 to al; that means, some consecutive a s in the
sequence whose sum is divisible by m. And what we have done we have taken some
consecutive sums we have given the name as sum S1 to m consecutive numbers of the
sum that S1 to Sk ; that means, S1 equal to, I can tell S1 equal to as if I can write S1 = a1,
S2 = a1 + a2, S3 = a1 + a2 + a3 similarly I have Sk = a1 + a2 + a3 + up to ak and since I have
m numbers so, I have m such sums.

So, we have m sums and sums are S1, S2, S3 up to Sk. Sl I have sums S m so, m number of
sums. Then we have divided each sum by m, if any one of the sum is gives a remainder 0
when it is divided by m then it proves a statement. So, here this is one thing that if the
remainder of one of the sums is equal to 0 then it proves. Now we assume this is where
our general proof starts that we assume we consider that none of the sums are divisible
by m. We have taken then m number of remainders; since we have considered that none
of the sum is divisible by m.

So, I have m number of, m - 1 number of remainder that is from 1 to these are the these
are my these are my remainders these are my remainders now I have m - 1 number of
remainders and m number of sums. So, identify the sums as the pigeons and treat
remainders as the pigeonhole. So, there are m sums and m - 1 pigeon m number of
remainders like pigeonhole. So, two sums must have same remainder when it is divided
by m and these two sums we consider as if Sk and Sl.

So, Sk and Sl is a1 to ak sum of a1 + a2 + … + ak, Sl is a1 + a2 + … + ak+1 up to al since it is


written k < l. So, we will consider since it is the same remainder. So, I consider when Sk
is divided by m the quotient is b is the quotient when Sk is divided by m and C is the
quotient when Sl is divided by m.

So, we can write that this sum equal to b. m + r and this is C. m + r, then we subtract
equation 1 from 2. So, Sl - Sk I get that C. m + r + (b. m + r) and these will cancel. So,
these becomes ak+1 + ak+2 up to al is C – b. m since C and b are quotients. So, there they
must be integer. So, C - b is integer. So, C - b is integer and I can write ak+1 + ak+2 up to al
is divisible by m. So, it is proved. So, now similar type of numerical problems we can
write another numerical problems.

322
(Refer Slide Time: 33:37)

That I give some application 4 or we can just illustrate these thing with an example
application 3 we illustrate with an example. So, consider the sequences has say 7
numbers; that means, on the sequence is; that means, m equal to 7 consider the sequence
as the sequence is say 2, 4, 6, 3, 5, say 6.

So, if I take the consecutive sums the way we have done I have since I have m = 7. So, 7
sums are I take S1 = 2, S2 = 2 + 4 = 6, S3 = 2 + 4 + 6 = 12, S4 = 2 + 4 + 6 + 3 = 15, S5 = 2
+ 4 + 6 + 3 + 5 is 20, S6 is 2 + 4 + 6 + 3 + 5 + 5 = 25, and S7 is 2 + 4 + 6 + 3 + 5 + 5 + 6
= 31.

So, we have these are my 7 sums. Now if I and none of the sums are divisible by 7. So, I
write that none of the sums is divisible is divisible by 7. So, if I take the remainder so,
our sums are these if I take the remainder remainders are when it is remainders when
sums are divided by 7.

So, I take Si/m remainders are 2, 6, 5, 1, 6, 4, and 3. Now we see that two cases the
remainders are same why because I have I have remainders can be only from 1 to 6.

323
(Refer Slide Time: 38:29)

Since here the remainders can be remainders can be 1, 2, 3, 4, 5, 6 since I am dividing by


7 and number of remainders are number of remainders since I have number of 7 sums a
7.

So, these are my pigeons these are my pigeons and these are my holes. So, what I get the
two sums are the same reminder and they are S2 / m they are S2 / m and this is 5 / m. So,
just now there, but we have proved that S2 by S2 and S5 have the same remainder same
remainder that is equal to 6 when divided by 7 divided by 7 that is equal to m ok.

So, S2 and S5 so; that means, a3 + a4 + a5 must be divisible by 7, now we see what is a 3
a4 a5. So, my a3, a4, a5, is 6, 3, 5. So my, this 6 + 3 + 5 = 14 and clearly 14 is divisible by
7. So, with this example we see that what just now we have proved with pigeonhole
principle that problem we have proved and we give some illustration some examples
these it is an illustration with an example and it gives a correct result.

So, we see that numerical problems and counting problems or more minutely I can tell
that counting problems related with arrangements that can be solved using pigeonhole
principle. And we see one class of problems that can be solved using pigeonhole
principle we in this next class. We will see that other classes of problems that can be
solved using pigeonhole.

324
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 38
Counting Techniques and Pigeonhole Principle (Contd.)

So, we have learned the Pigeonhole Principles, the simple form and last lecture we have
read some of the applications; the different type of applications that we can solve using
pigeonhole principle. Today again, we will continue to solve problems using pigeonhole
principle in strong, in simple form. So, we see again some simple applications that we
can solve.

(Refer Slide Time: 00:55)

One such applications; mainly we are discussing the numerical problems so, see some
applications. So, write the problem that again this is a number theoretic problems that
from the integers 1 to 200; we choose 101 integers.

Now, we have to show that among the integers chosen, these are 101 integers that we
have chosen. There are 2 integers such that one of them is divisible by the other. So,
again I repeat the statement, problem statement that we have 200 integers 1 to 200 and
we choose any 101 integers. We have to show that among these 101 integers, there are
always 2 integers such that one will be divisible by the other.

325
So, we will try to solve this problem using pigeonhole principle in simple form. So, first
we see one property of elementary number theory. So, by factoring out as many tools we
can; we know that property is that any integer can be represented, we see that any integer
can be written as, see if the integer is N. Then this is 2 K x a; that means, K number of 2’s
we have taken from N; from the factor of N and a is one odd integer.

So, here where K greater than equal to 0 and a is an odd integer. So, first we see that for
small integers, what are the values of K and a. So, if N =1; then, I can write that K = 0; a
is 1, since 20 x 1 is 1. Similarly, if N = 2, I can write that K = 1 and a = 1 since 21 x 1 = 2.
So, it is valid.

(Refer Slide Time: 06:35)

Now, for all primes; that means, when N is prime number, we get that is when N is prime
that N = 2K x a. That means, here K = 0 and a is odd. So, N is prime, I should write other
than 2 because other than 2. So, a is odd number and for all even numbers. So, for other
integers even or odd, other integers even or odd, we can write or we can represent N as 2
to the power K x a ok; where, a is odd number for even. We must get at least 1, 2; that
means, power of case in that case greater than equal to 1.

So, now which we consider some odd integers from 1, 3, 5 to 199 since my numbers
given are 1 to 200. So, how many odd integers are there in 1 to 199? So, there are there
are 100 odd integers from 1 to 199 that it can take any value of these from 1 to 199, I can
take a value. To say we choose 2 numbers 2 integers say N1 = 2r x a and N2 = 2s x a.

326
Now, since there are 100 odd integers, now if we choose 101 integers; then, there must
be 2 integers for which the a value is same. Here, we applying pigeonhole principle.

(Refer Slide Time: 11:59)

Since we have 100 odd integers; that means, 100 different values of a that can be treated
as a pigeonhole and the 101 integers chosen from 1 to 200 that we can take as the
pigeons.

So, 2 integers have; so 2 integers have the same a value and that 2 numbers we have
taken N1 = 2r x a and N2 = 2s x a. So, if r > s; then N1 is divisible by N2 or if s > r; then
N2 is divisible by N1 so, we prove that there exist. So, it is proved that there are 2
integers among the chosen 101 integers from 1 to 200 such that one is divisible by other
and we have applied the pigeonhole principle. This is where we have applied the
pigeonhole principle to show that thing. So, this is one class of numerical problems that
we can solve using pigeonhole principle.

327
(Refer Slide Time: 15:59)

Now, we see another type of applications, where that some geometrical problems where
we can apply normally the pigeonhole principle to solve or to show some statements to
be true. So, we take a very simple problem that prove that any 5 points chosen within an
equilateral triangle of side length 1; there are 2 points whose distance apart. That means,
the distance between these 2 points is at most half. So, this is a geometrical problem. We
have a equilateral triangle and we have to show that always there are 2 points within
these equilateral triangle that the distance between these 2 is at most half. So, we see the
solution. I draw a equilateral triangle. So, ABC is a ABC is an equilateral triangle and we
have to prove that there are 2 points in between in the interior of ABC that whose
distance at most half ok.

So, now we break up the interior of triangle ABC into 4 regions, say give DEF. So, these
are the DEF at the midpoints of AB, BC and AC. So, this AD = BD = 1/2 and for other
sides also this is true. Now these regions I can write the 4 regions like R1 is the interior
of ADE of triangle ADE. So, this is my R1 with the points on DE; with all the points on
the side DE, but excluding the point 2 points D and E, excluding the points D and E.

Then, I take R2 is triangle BDF. So, this is my R2 triangle BDF. Then, I take triangle R3 ;
again, this is the interior of triangle DEF, all points including the points on DF and EF;
DF and EF and excluding the point DEF excluding DEF. I have another region R4; I take
another region R4. I write here R4 is CEF triangle CEF. So, we get 4 congruent

328
equilateral triangles; that means, the interior of ABC now becomes 4 regions; R1, R2, R3,
R4. So, if I consider any 2 points.

(Refer Slide Time: 24:07)

Now, I can write that interior of ABC, triangle ABC is broken up into 4 regions R1, R2,
R3, R4 which are 4 congruent equilateral triangles. Now, if I consider any 5 points in the
interior of triangle ABC.

So, they must be in the points; must be in the regions R1, R2, R3, R4. Now, if we assume
that 4 among these 5 points, 4 points among these 5 points are 1 in each of the 4
triangles. That means, that 4 points we assume that 1 point is here; 1 point is here; 1
point is here and 1 point is here. So, the remaining points, the 5th point now if we put
that must be in 1 of the triangle of this 4 triangles.

So, the 5th point when it is put or it is placed, it must be one of the, must be in one of the
regions R1, R2, R3 or R4; that means, that means in any one of the triangle that ADE that
BDF, DEF and CEF; that means, one triangle must contain 2 points. So, one triangle
contains 2 points and the distance between these 2 points is at most half since my BD
DE, these are half and these triangles are also the equilateral triangle. So, the distance is
half.

So, we prove that there are always 2 points we get in the interior of equilateral triangle
ABC whose distance is at most half. Now we consider one-third application.

329
(Refer Slide Time: 30:47)

So, this is a problem. So, I write the problem that in a room there are 10 people, none of
whom aged is a older than; how can I write? No, none of whom is older than 60 and we
assume that ages are whole number; ages are whole number.

So, everyone is none of whom is older than 60; that means, every ones age is less than
equal to 60, but the age each of whom is at least 1 year old. Now we have to prove that
there can be always 2 groups of these people with no one, no common people such that
the groups of people such that the sum of whose ages are equal, ages are the same. That
means, I have 10 people in a room and ages are each one is not older than 60; none of
them is older than 60.

So, we can always make 2 groups. So, the sum of the ages of 1 group is same as that
some of the ages of the other group, we have to prove these thing. So, now if we since 10
people are there and none of whom is older than 60; 10 people are there and none of
whom is older than 60. So, I can write that the total ages cannot exceed if I take the sum.
So, total ages; that means, ages of ages of all 10 people cannot exceed 60 into 10 equal to
600 and similarly the total ages must be greater than 10 because everyone is at least 1
year old; so, greater than 10.

So, since we are taking the ages as whole number. So, the ages the sum of ages lie
between the sum of ages between 11 to 600, which is greater than 100 and we are taking

330
a whole number. So, I can consider that 11 to 600 and that will be 590’s of 5 there are
589 different sums; age sum I can take the age sum.

Now, if I consider that as if 10 people as if the 10 numbers. So, what will be the total
number of sums? The number of sums I can write the age sums since, I am taking the
sum of ages, number of age sums that can be formed since there are 10 people 2 to the
power 10 minus 1 that can be formed. With 10 people is 210 - 1 this is equal to 1023. So,
now, I can apply the pigeonhole principle.

(Refer Slide Time: 39:29)

So, these 1023 as if the number of the number of age sums, number of sums or number
of age sums I am telling these are actually my treated as the pigeons. And the sums of
ages these 589 are the number of sums that may have occur, number of sums that may
occur. So, and these are treated as a pigeonholes.

So that means, among these 1023 that we can get more than 1 group; so, more than 1
group since 589 is less than 1023. So, more than 1 group among these 10 people have the
age sums equal. So, we get always at least 2 groups whose total sum of ages are same.
So, always we get 2 groups whose total sum of ages are same.

So, see this is a different type of problem and we can apply pigeonhole principle and we
can prove that or we can see that we can solve the problem or we can prove the
statement. Now, we have read the pigeonhole principle in simple form and the mainly

331
the applications that we can solve using this Simple form of pigeonhole principle. In the
next lecture, we will read the Strong form of pigeonhole principle.

332
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 39
Counting Techniques and Pigeonhole Principle (Contd.)

So, we have learned the Pigeonhole Principle in Simple form. Today, we will read the
Strong form of Pigeonhole principle or sometimes we call this is the generalized
pigeonhole principle and how it is applied to solve the different type of problems. So,
first we see the pigeonhole principle in strong form.

(Refer Slide Time: 00:48)

We write that as a theorem to give a theorem 2 because theorem 1 was the pigeonhole
principle in simple form. So, I write let of q1, q2, q3, …, qn are integers on in positive
integers. If the total number of objects say q1 + q2 + q3 + … + qn - n since I have n
number of n positive integers I have taken +1. These many number of objects are
distributed or are put into n boxes. Then, the theorem tells or the strong form of
pigeonhole principle that then either the first box contains at least q1 number of objects
or the second box contains at least q2 objects and so on. I can tell that the nth box
contains at least q1 objects.

So, I have these many positive integers, I have written q1, q2, q3, …, qn; then, q1 + q2 + q3
+ qn - n + 1 these many number of objects if I want to distribute among these n boxes.

333
Then either the first box contains at least q1 objects or the second box contains at least
the q2 objects and so on. In this way, I can tell that the nth box contains at least given
objects. Now, how we can prove these thing; how to prove the ok?

Now, suppose we distribute the total objects that is q1 + q2 + … + qn - n + 1 this total


objects; these number of objects into n boxes; among n boxes,

(Refer Slide Time: 06:23)

If the distribution is such that for each I = 1, 2, 3, … n, the ith box contains fewer than
less than qi objects, fewer than qi objects. That means, the distribution is such that each
box or say the ith box gets less than q i objects; that means, q1 the first box that is the first
box gets fewer than or lesser than q1 objects; the second box gets lesser than q2 objects
and so on.

So, what will be the total number of objects, if each box get lesser than the objects that q
ith objects? So, I can write the total number of objects in; so, the total number of objects
in all the n boxes such that our distribution is like everyone that every box gets fewer
objects is equal to say q1 - 1; at least 1 less than q1. Similarly, q2 - 1, q3 - 1 plus qn - 1 and
this becomes q1 + q2 + … + qn - n since there are n boxes. So, this type of I have n terms.
Now if we add, so this is the total number of objects in the n boxes.

So, now if we add 1 more objects; one more object to be distributed; one more object to
be distributed among these n boxes.

334
So, my total number of objects become, objects = q1 + q2 + … + qn - n + 1 that the last
object that we have added and the distribution we have done or we have assumed that
each box, see these each box contains fewer than qi; that means, here ith box contains
here we have considered that qi - 1. So, when we have added 1 object.

(Refer Slide Time: 12:08)

So, that object must have gone from the object. So, the last object distributed that must
be added, anyone among these any one of the boxes among these n boxes. So, if it is ith
box, if it is the ith box where the last item last object is put; then, the objects in the ith
box becomes earlier it was qi - 1. Now I have added 1. So, qi and - 1 + 1 and that is equal
to qi. So, the ith box contains at least qi objects; where, i is 1, 2, …, n. So, it proves the
statement in the strong form of pigeonhole principle.

335
(Refer Slide Time: 14:50)

Now, we see what are the other different way we can state the strong form of the
pigeonhole principle. Now before that one since we have told that many times the strong
form of pigeonhole principle is called the generalized form. So, we see that we can get
the simple form from the generalized form or the strong form; how we can get the simple
form?

So, for simple form of pigeonhole principle, see if we put that q1 = q2 = q3 = … = qn = 2;


then, what are the total number of objects? So, total number of objects to be distributed
among n boxes is 2 + 2 + 2 + … n terms, since I have n boxes then minus n + 1. So,
these becomes 2n + n - n + 1 = n + 1.

So; that means, n + 1 objects. Now these becomes n + 1 objects distributed into n boxes
and each one will get 2 or more than 2; that means, at least 2, since my qi; q1, q2, … is 2.
So, in a strong form it tells that qi; here qi is 2. So, it gets at least each box contains at
least 2 which is equal to that q1, q2, actually qi.

So, it is same as that of our simple form of pigeonhole principle and what last day we
have mentioned last lecture that when we have discussed the simple form that we can
take this thing as a also a coloring problem.

336
(Refer Slide Time: 18:26)

So, in terms of coloring problem, we can tell that if q1 + q2 + … + qn + n - 1 number of


objects or colored with n colors and each one each object is colored with 1 color. Then,
from the generalized principle, we can tell that there is an i, such that there are at least qi
objects of the ith color.

So, in coloring problem, we can when we have to find out the number of colors or
minimum number of colors to be is required that we can apply our pigeonhole principle.
Now, we see that this is all coloring problem. Now, we see what are the different other
form, we can write or we can state these generalized pigeonhole principle. You can write
one let in a what in the strong form or in the statement of the strong form of pigeonhole,
if q1 = q2 = q3 = … = qn = r.

That means, I can write that if r + r + up to n; that means, nr - n + 1, these objects are put
into n boxes. Then at least since now all boxes have the same capacity and that is equal
to r; then, at least 1 of the boxes contains r or more of the objects. So, in one form we can
write.

Now, if I think from the elementary mathematics point of view, then also the strong form
we can write a similar type of statement as that of our generalized pigeonhole principle.
So, I can write that from elementary mathematics.

337
(Refer Slide Time: 24:11)

That if the now we take the average ok; average of all q1 + q2 + … +qn objects. So, if the
average of in the number of objects I am taking some non negative integers, n non-
negative integers and I am giving that integers are m1, m2 up to mn and average is if the
average is greater than r - 1; that means, that is (m1 + m2 + … + mn) / n. This is my
average and this is greater than r - 1.

Then, we can write that at least one of the integers is greater than or equal to r. Now,
some other way another form I can tell, I can write that if the average is less than r + 1;
that means, (m1 + m2 + … + mn) / n < (r + 1). Then, at least 1 is less than then we can
write then at least 1 of the integers, at least 1 of the integers is less than r + 1.

So, the statement of strong form or generalized pigeonhole principle now we are writing
for the elementary mathematics for we are applying that thing for or elementary
mathematics and already for simple form we have seen the that how numerical problems
are solved using the pigeonhole principle.

338
(Refer Slide Time: 28:20)

And that I think this is same as that of I can write, that if the average of n non-negative
integers m1, m2, …, mn is equal to r is at least equal to r is at least equal to r; then, at least
1 of the integers among m1, m2, …, mn satisfies that mi n integer mi ≥ r.

So, this is what we see that simple elementary mathematics that if the objects we write as
the integers and we can easily write that thing. Now, we see one application. We see one
application of strong form. It is a very common problem, we write first the statement that
a basket has 3 type of fruits or is being arranged out of 3 type of fruits say apples, banana
and oranges.

Now, problem is that, what is the smallest number of pieces of fruit that should be kept
on, that should be put in the basket so that there are either at least 8 apples or at least 6
bananas or at least 9 oranges will be there. So, as it is we can apply here q 1 the strong
form of pigeonhole principle. Here q1 is 8, q2 is 6, q3 is 9 and I have 3 different types of
fruits.

So, the total number of objects or total number of fruits would be that to be distributed is
q1 + q2 + q3 - 3 + 1. So, these becomes 8 + 6 + 9 - 3 + 1 = 24 - 3 = 21; 21 fruits. So, we
need 21 fruits. So, we need 21 pieces of pieces of fruits and this is my answer.

So, directly we can we can apply the strong form of pigeonhole principle to solve these
type of problem. So, with this we finish the concepts of pigeonhole principles, the simple

339
form; the strong form and some of the applications that how we have how we can solve
using this principle that we have discussed. And next lecture, we will see again that how
some different type of problems, we can apply the pigeonhole principle.

340
Discrete Structure
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 40
Counting Techniques and Pigeonhole Principle (Contd.)

Today we will read, an important counting technique called the Inclusion Exclusion
Principle. That we our last lecture, we have read the pigeon hole principle and today we
will see that, how inclusion exclusion can be used to count the number of sets or number
of elements in a set or some other real life problems.

(Refer Slide Time: 00:49)

If we recall the addition principle of counting, then suppose we have a set is so, we recall
the addition principle. Suppose, we have a set S and that is partitioned into n number of
subsets, say S1, S2, S3 up to Sn, these are the n number of subsets.

Now, the number of objects if I want to count, number of objects in S, that can be
determined by simply adding the number of objects in each of the subsets, by finding the
number of objects in each of the partition or subset and adding the numbers; that means,
the cardinality of S; the number of objects in S is the cardinality of S1, cardinality of S2
up to the cardinality of Sn.

341
Now, this is true, because the addition principle works. Since, I have considered these Si,
that it is a partition, that is, it is partitioned; that means, each Si is a partition. And the
definition of partition is such that, they do not the objects do not overlap partition; that
means, the objects do not overlap. So, one object in the set S will be in only one of the
subset Si.

So, this principle works because each object in the set S exists only in one of the subsets
one of the subsets say Si. So, the main point is that here, the objects do not overlap and
simply addition principle will work.

(Refer Slide Time: 06:11)

Now, the inclusion exclusion principle comes from here. So, if the objects overlap; that
means, when a set S is partitioned into a number of subsets, then I should tell that not
partition, because partition definition is that, that the objects do not overlap; so, a number
of subsets such that the object may overlap. Then, if we want to count the number of
objects in the set S, then we will apply inclusion exclusion principle.

So, simply we write that, counting objects in the set S, when the objects overlap I am
into the subsets of S, that is S1, S2, …, Sn, then we have will be, then inclusion exclusion
principle is used.

Now, we see that, how it works. So, this is actually we can write this is a general
circumstances of counting the number of objects in a set; so, here the main thing is the

342
objects overlap ok. Now, we see one simple example before we give the theorem of
inclusion exclusion I take one example of counting. Say the example is to count the
number of integers between 1 and 600 is inclusive, which are not divisible by 6.

Now, we can solve this problem indirectly, what we can do? I have to count that, which
are not divisible. So, if I can count that very easily, that which are the numbers are;
which are the integers between 1 and 600 that are divisible, then simply from 600 that
number if we subtract will be getting that, what are the number of integers that cannot be
divisible by 6.

So, this is some indirect way of counting the numbers. So, we count indirectly that is, we
will find the number of integers divisible by 6 and then, we subtract that number from
600. Since, from 1 to 600 there are 600 integers are there.

So, what are the numbers that are divisible by 6? So, number of integers divisible by 6
among 1 to 600, is simply 600 / 6 = 100. So, there are 100 integers among 1 to 600 that
are divisible by 6; so, number of integers that are not divisible by 6 = total number of
integers 600 - 100 (that are divisible by 6) = 500 and this is my answer.

So, this is some indirect way of getting the solution. And inclusion exclusion principle
tells exactly this thing, this is a technique of indirect way of finding a solution.

(Refer Slide Time: 13:00)

343
So, see we this we consider a we consider a set S, set S and A is a subset of S. Now, if
we and A is a subset of S, if we try to find out the number of objects in A, then we can
indirectly we can write that, the number of objects that are in A.

I can write, the cardinality of A is cardinality of S minus the cardinality of A


complement; A complement is the or cardinality of A complement, I can write that, the
number of objects that are not in A; the number of objects that are not in the subset A of
S.

So, if I want the reversing; that means, that the number of objects which are not in A;
that means A complement, I can write |S| - |A’|, the cardinality of cardinality of A and
this simple principle is actually the is used in inclusion exclusion principle. So, we shall
formulate the inclusion exclusion principle before that, we let the, we define that one set
having some properties.

So, let S is a set as we have already considered and P1, P2. So, let is S is a, S be a finite
set and P1, P2 are 2 properties, that each element of S may or may not possess. Now, say
we wish to count the number of objects or elements in S that have neither that neither
possess the property of property P1, or property P2; or property P2. With these examples
or these illustration, we try to frame the inclusion exclusion principle.

(Refer Slide Time: 18:32)

344
So, let A1 be the subset or S that possess; that means, each of the elements of A that each
of the elements of A possess property P1. Similarly, A2 be the subset of S for each
element of the property P2. So, then, A1 bar we can write that A1’ be the subset that do
not have the property P1.

And similarly A2’ be the subset that do not have the property P2. So, that |A1’ ∩ A2 ’|, the
cardinality of this set will give us the number of elements or of S that do not have the
property either P1 or P2; see, what we want to get our problem is that, we used to count
the number of elements of S that neither possess property P1 or property P2.

So, clearly that |A1’ ∩ A2 ’| will give us that number of elements of S that have property
neither P1 or P2. So, how we can get that thing? So, I can write that, |A1’ ∩ A2’| that is the
total element S minus which have though the elements number of elements which are
property P1, then number of elements which have property P2.

Now, there exist some elements which have both the property and we have counted twice
that number, because once we have considered in A1, the number of elements which are
property P1, in A2 also; we have considered number of property number of elements
which are property P2.

So, some the numbers or the elements which have both the property, that we have taken
twice; so, we must add that number that which are which are both property A1 and P1 and
P2 and that means, that is |A1 ∩ A2|.

Since I write, why we have done since we have counted twice the number of elements
which have both the property which have both the property P1 and P2; P1 and P2 Once we
have considered in A1 once we have considered A2; so, that is why we have again we
have added the intersection of A1 and A2. So, and this is actually gives us the, our
inclusion exclusion principle.

So, this is indirect way of counting this is a indirect way of counting; that means, we
count the number of elements which have property P1 and which have property P2 or
which have property both. And then, we are finding that numbers we are getting that, the
number of elements which do not have the property P1 or P2 that is, A1’ intersection A2’.

345
(Refer Slide Time: 25:56)

So, now, we write the statement of exclusion inclusion principle; so, I give the write as a
theorem so, this is theorem of inclusion exclusion. So, we write the number of objects of
a set S that have none of the properties P1, P2, … , Pn is given by.

So, just now the example are with only two properties we have seen, we are trying to
generalize that principle. So, it will give us that |A1’ ∩ A2’ ∩ A3’ ∩ … ∩ Am’| the
cardinality of that equal to the cardinality of the set S minus the number of elements
having each property.

So, I can write that some of that Ai; i is from 1 to m, I am adding that, sum of the number
of elements which have at least two property; that means, Ai ∩ Aj and if I extend that the
way we have done, then we should consider the summation when I consider 3 properties.

So, I consider that Ai ∩ Aj ∩ Ak and then you must have add the number of properties
with 4 and in this way, if I continue if I continue then, I will be getting that (-1)n since, I
am generalizing this thing. So, either it would be plus or minus and then all that is A1 ∩
A2 ∩ up to Am.

So, I can write that here the first sum, here the first sum is for all one combination is over
the all one combination; that means, the number of elements which have only one
property, either P1, P2, … sum Pi, then the second sum 1 to m. The second sum is over

346
the all 2-combinations all the 2 combinations say i and j; I have written i and j of this i, j
are from 1 to m.

Third combinations is i, j, k; I should write the 3 combinations of i, j, k of 1 to m and so


on.

(Refer Slide Time: 32:22)

Now, if we see that for m equal to 3 so; that means, if my there are only we consider 3
properties so, if we consider 3 properties; that means, there are three subsets, that is m =
3 and say A1 set having property P1, A2 subset having property P2, A3 having property P3
and like so on; and the only 3 I am considering.

Then, though my inclusion exclusion principle becomes that which have neither property
P1, P2, P3 so, that is |A1 ’ ∩ A2’ ∩ A3 ’|. And this becomes S minus summation. So, this
becomes A1 plus A2 one combination so, this is one combination of all A3. Then, I
should take all 2 combinations so; that means, |A1 ∩ A2|, then |A1 ∩ A3|, plus |A2 ∩ A3|;
and 3 combinations; so, 3 combinations are |A1 ∩ A2 ∩A3|.

Now see we have how many terms in the right hand side, that we have 1, here I have 1
term, here I have 3 terms, here I have 3 terms, here I have 1 terms. So, number of terms
is 1 + 3 + 3 + 1 is 8, I can write this is as a 23. Since, I have considered m equal to 3
since my m = 3 or we have considered 3 subsets of these properties.

347
So, if we can generalize I can get that if I have, if we have, if m = 4, then similarly we
can write or here that number of terms will be 2m, equal to 24 = 16 terms in the right hand
side.

(Refer Slide Time: 36:07)

And if we can continue this way, I can write that |A1’ ∩ A2’ ∩ A3’ ∩ A4’|; that means,
which have neither property P1, P2, P3, P4 and I can write the cardinality of phase; that
means, the total number of objects then I can write the |S| - (|A1| + |A2| + |A3| + |A4|).
Then, two combinations I have to add |A1 ∩ A2|, |A1 ∩ A3|, |A1 ∩ A4|, then |A2 ∩ A3|, |A2
∩ A4| and |A3 ∩ A 4|.

I should take 3 combinations, then |A1 ∩ A2 ∩ A3| + |A1 ∩ A2 ∩ A4| + |A2 ∩ A3 ∩ A4| +
|A1 ∩ A3 ∩ A4|. Then the 4 combinations, |A1 ∩ A2 ∩ A3 ∩ A4|.

So, I have here one term, here I have 4 term, here I have 6 term, here I have 4 term and
here I have one term. So, total terms becomes is 1 + 4 + 6 + 4 + 1 is 16 is 24 since, m = 4.
So, in this way indirectly we can calculate or we can find out the count or the number of
elements in the subsets having sum properties or what earlier we mentioned even, it we
can find out if it is that having not that properties; that means, either this is |S| - |A’| or it
can be |A’| is |S| - |A|.

So, this is our inclusion exclusion principle and later when we will read the
combinatorics, how to count the numbers in different for different types of problems,

348
there we will apply this inclusion exclusion principle and this is a very easy way to count
the numbers and this is a very important counting techniques.

349
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 41
Combinatorics

Last few lectures we are discussing about the different counting techniques. And today
we will start the Combinatorics which again is a counting techniques and a special type
of counting techniques that we will cover under this lecture.

(Refer Slide Time: 00:52)

So, combinatorics is normally concerned with the arrangement, arrangement of a set into
patterns satisfying some rules. So, I can write that in general, it is concerned with the
arrangement of a set into patterns and normally satisfy some of the rules.

Now normally we have two general types of arrangement, we or the type of problems
we handle. One we call that existence of arrangement that two types. In general two
types of arrangement we consider; one is called the existence of arrangement see when
we are concerned with some or we want to make some arrangement satisfying some
property. So, first thing is whether at all it is possible or not; that means, whether the
arrangement exist. Now if it exist then under what condition or what are the necessary
and sufficient condition that the arrangement should exist. So, this is called the existence
of arrangement.

350
So, in short we can write that it is about the whether such an arrangement is possible.
And this satisfying rule then tells under or what are the sufficient; what is the sufficient
condition necessary and sufficient condition that the arrangement exist. So, that is why it
is existence of arrangement.

Another type of combinatorics problem, we called enumeration or classification of


arrangement. So, if the arrangement exists then normally many different ways, we can
get this arrangement. Now we have to or sometimes we may want to know that which
one is the best possible way that we get the arrangement, then we call this is the
enumeration. So, we can write that if some arrangement is possible then maybe several
ways that we can get this thing, several ways.

Then what is the best possible way or what are the total number of ways or what are the
total number of ways we can or different ways we get the arrangement? Now normally
most of the arrangement problems that we can divide into mainly two different ways that
we make the arrangement.

(Refer Slide Time: 07:32)

So, what are the two different ways that, one is the count the number of ordered
arrangements or sometimes we call the selection so, that is also ordered, so ordered
selection. Now this also, so these ordered arrangements or ordered selections that we can
do in two different ways; that means, we are selecting some objects from a set of objects
and this set can be of two different type.

351
What are those type? One is that without one is without repeating any objects, other is
we consider repetition; that means, with repetition of objects. Similarly, that the another
type that we can write the count the number of unordered arrangements or unordered
selections of objects and from the set that which have the same property either without
repeating any objects or with repetition of objects. Now, normally these arrangements of
or selections in which order is taken into consideration; that means, here this first case
that order, it is the ordered arrangement; that means, order is considered and order is
considered and this type of arrangement we called permutation.

So, while order is considered; that means, the first case we call this is permutation. And
the second type, see this is that unordered arrangements or unordered selections, so, here
order is irrelevant. So, second here order is irrelevant and we take this is as a, we define
this thing as a combinations. So, normally we arrangement either ordered or unordered
and the problems that we or the counting problems that we will be handling that either
these ordering considering the order of the arrangement or we can ignore the order, then
it is called the permutation and combination.

So, another point that what we have seen that both the cases whether it is permutation or
whether it is combination, we have, we can do to is; that means, it is either it is without
repeating any objects or with repetition, both the cases and that we take a set we can
define a set or a multi set.

(Refer Slide Time: 13:12)

352
So, now, we said we know that say set say it is a set of say 4 elements {a, b, c, d}.
Normally, these are distinct elements so, these a, b, c, d; we take wherever these are
distinct elements. Now, we can take this type of set say where these a is appearing more
than one, say I have 2. a, say I have 1. b, I have 3. c and say 4. d. Then we define this
type of set as the multi set and same set we can represent like that here a appears twice.
So, I can give the 2 numbers of a, 1 number of b element, c type of elements that 3. c and
4. d.

So, if I write S; so, here s is a set of 10 elements where a appears 2 times like that the 1
time and this one. Now we will also consider the permutation of multi set and the
permutation of combination of multi set. So, we will also consider the permutation and
combination of multi set.

(Refer Slide Time: 15:54)

So, first we see the permutation of sets ok. Before we give the definition first we see one
simple example. I take a counting example say how many odd numbers are there
between 1000 and say in 9999? This is a simple counting technique. Now without
considering any formula, etcetera how we can solve this? See there are, I have 4
positions since it is a 4 digit number. So, it is a 4 digit number or numbers are 4 digit. So,
it has, there are 4 places say I have unite place, 10, 100 and 1000 place ok. So, since it is
odd number. So, this unit place number, unit place number can be only 1 / 3 / 5 / 7 or 9.

353
So, since it is odd number. So, first, we see that there are five different ways the unit
places can be there. So, I take the unit place numbers can be 5 ways. Now if I consider
that there will be no repetition; that means, each number appears each digit say
restriction what I earlier I mentioned that some properties satisfying some property. Now
say I am a giving some restriction that each digit appears one each.

Now what will happen? That unit place; that means, then one odd number that I have
given that among 1, 3, 5, 7, 9; we have to neglect that thing. And then these thousand
numbers they can be this thousand places, number can be only 1 to, 1 to 9, because 0
cannot be there, but these hundred place numbers and tens number they can be anything
from 0 to 9, they can be 0 to 9; they can be 0, 1, 2, 3 up to any number from 9.

So, I can put a thousand that number, I have already taken in unit place that I have to
discard from 1 to 9. So, there will be some thousand places will be thousand places,
place I have 8, 8 ways, I can give this. Now then I have to consider either or hundred
place then I have to neglect from 0 to 9 there are 10, there are there will be 10 digits.
And then already I have consider 1 for unit and 1 for thousand. Since, I have restriction
or these are the property to be maintained.

So, I can put that 8 ways 2 since there are 10, 2; I have neglected then for ten places,
there are 7 ways. So, what are the result that I can get is 5 x 8 x 8 x 7 and these are the
different way I can make this number. See I do not know, I have not used any formula,
but this is something called counting techniques and some ordering is there and also
some property to be maintained here. So, how we can make this thing as a permutation
ok? First I give that how what is the idea or how we frame the permutation of numbers?

(Refer Slide Time: 21:56)

354
So, I write let r be a positive integer. Then by r permutation of a set of a set S of n
elements, set of n elements is an ordered arrangement. Earlier, we have mentioned that
thing that permutation is an ordered arrangement of r of the n elements. So, if I take say
example let the set S is a three element set {a, b, c}. Now what are the different ways I
can take? Say if it is a 1 permutation; 1 permutation; that means, how many ways I can
take 1 element.

So, there will be three 1 permutation, I can tell there will be three 1 permutation. What
are those that a, b or c then how many are 2 permutations; that means, from the three
elements set I can take two of two elements at a time; that means and some it is ordered
arrangement. So, I can take a, b, c. So, I can take ordered ab, I can take bc, I can take ca.
Now since, it is ordered I can take in this direction cb then ba then ac.

So, there are six 2 permutations. And there can be 3 permutations also; 3 permutations
also. Then I can take from a three element set 3 permutations is abc. Since, it is ordered
bca, cab and again some ordering can be different cba then bac then acb. So, again there
are six 3 permutations ok. And no 4 permutation is; no 4 permutation is possible, no 4
permutation; since, 4 > 3 here it is a three element set or I can write that in this case r >
n.

355
(Refer Slide Time: 25:43)

So, now we define normally the permutation, we define this r permutation of n element
set, we define as a P(n, r). So, P(n, r) is the number of r permutation of a n-element set. If
r greater than n then P(n, r) = 0 then we can easily, I can write that P(n, 1) = n, because
one element each time. So, for that example, we have seen that P(3, 1) three elements set,
1-permutation that is P(3, 2), 2-permutation that is 6 again P(3, 3) that is 6.

(Refer Slide Time: 27:09)

So, now, I can give the theorem, for n and r positive integers with r less than n. We can
write the (n, r)-permutation of n element set that P(n, r) is n x (n x 1) x (n - 2) up to the

356
our (n - r + 1). Now, how we can prove? The proof is the way the example we have done,
say choose r permutation from n elements.

So, I as if, I have that r places. So, for the 1st place I can write the first I can take n
different ways, I can choose the n different ways, I can choose my object. Then it is
already it is one is chosen. So, for the 2nd I can take n - 1 ways, for 3rd it is n - 2,
because already 2 have chosen. So, in this way the r element the rth one, I can take n - r -
1 ways. So, by multiplication principle I can tell that my, that is defined as P(n, r) this is
n x (n x 1) x (n - 2) x … x (n - r + 1). Though exactly the same, the simple example that
we have done from that how many way, how many numbers we can get from 1000 to
9999.

So, now we can write in this way this is n x (n x 1) x (n - 2) x … x (n - r + 1). And I can
multiply that (n – r), then (n - r – 1) up to 3, 2, 1. Then I did divide this number by this
that (n – r) what I introduced there (n - r – 1) x … x 3 x 2 x 1. So, this is that the from the
definition the numerator is nothing, but my n! and the denominator is (n – r)!, because n
into up to, we can multiply n x (n – 1) up to 1.

So, what I get my P(n, r) I get my I write. So, I get my P(n, r) is n! / (n – r)! what earlier
normally we know this is the permutation rule. So, simple for simple set, we get this is
my permutation and if P(n 0), I can write always this is 1; and P(n, n) is n!.

(Refer Slide Time: 31:47)

357
Now, if I quickly see one example that what is the number of ways to order 26 letters of
the alphabet so, that no 2 vowels that a, e, i, o, u occur consecutively. So, I have I can
write that this is nothing, but I have 5 vowels.

So, I have 5 vowels and 21 consonants. So, 21 consonants, I can take for consonants, I
can place 21 factorial ways and vowels. Since, this is the restriction for vowels that no 2
vowels occur consecutively. So, as if this 21 consonants if I place, say this is these are
the consonants say 21, so, as if these are my black are my places of vowels. So, there are
22 places; 22 places for vowels.

So, 5 vowels I can put in 22 places. So, you can write these are my consonants and just
now the formula we read. So, vowels we can put that P(22, 5), because I have 22
positions and 5 vowels I have to put there. So, they way this is 22! / (22 – 5)!

(Refer Slide Time: 34:56)

So, if I continue then my total number should be 21! x 22! / 17! So, this will be my, this
is my result. So, instead of manual counting now I can, I the permutation formula, I can
use to solve this type of problem. So, it is very easy way that are some difficult
problems, counting problems when the ordered arrangements are considered, we can use
permutation formula to solve those problems.

358
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institutes of Technology, Kharagpur

Lecture – 42
Combinatorics (Contd.)

So, we have read the Permutations of a set and what do we mean that our Permutation of
a set of n elements. Now this lecture, we will read the combinations of set.

(Refer Slide Time: 00:43)

As already I have defined that normally that permutation combination, they are
concerned about the counting of ordered or unordered arrangements. So, this is the
combination is concerned when we count counting techniques for un-ordered
arrangement. So, it is consult for unordered arrangement.

Now, we first define that what do we mean by these combinations of a set. So, let r be a
non-negative a non-negative integer. Now, by an r-combination of a set of n elements,
what we understand is this is an unordered selection of r of the objects or elements of a
set of n elements or n objects; a set of n elements. Now the, it differs from permutation is
that unordered selection ok.

So, I can write that from the concept of set the definition of set. So, I can write that r
combination of since it is unordered. So, I can write the r combination of S having n

359
elements is a subset of S; where, S has out sub or subset of S having r elements and these
S has so r combination of S. S has where S has in number of S has n elements or S is an
n element set; S has n elements.

So, this is since order is not concerned order is irrelevant. So, I can tell simply this is an r
element subset from the set S of n elements. So, if one simple example if I take say S has
4 elements ok. S has 4 elements {a, b, c, d}; then, what will be the 3 combinations I can
take? I can write the 3 combinations; that means, I have to take the subsets having 3
elements from this 4 elements set S.

So, 3 combination of S, these are equal to this I can tell this is {a, b, c}; I can write {a, b,
d}; then, it can be {b, c, d}; then, it can be {a, c, d}. So, these are the 4; these are the 3
combinations. So, this is the difference from the permutation.

(Refer Slide Time: 06:36)

So, normally we denote the combination these r combination; r combination of n


elements we denote as nCr or sometimes that n choose r, then sometimes we write in
these way also. So, the according to their definition, I can write that nCr = 0 if r > n
because not possible that among that n element set, I can choose a r-combination; subset
of subset having r elements and r greater than n. So, it is not possible.

360
So, this is equal to 0. I do not have any such subsets. Then, I can write 0Cr is actually 0
that if r > 0. I can put nC0 = 1, if I think only the way we have defined as if only the
empty set I am taking subset; then n C 1 only one element set, since I have n elements.

So, this is n then n C n that is the set only. So, this is again 1 ok. So, this is according to
that according to my definition; the way we have defined to the definition of
combination or r combination of n elements ok.

(Refer Slide Time: 08:52)

Now, we try to find out the formula and we give it we write a theorem. Write for 0 ≤ r ≤
n; then P(n, r) that in permutation of r; r permutation of n elements P(n, r) is r! x nCr.

So, I can write the nCr is P(n, r) / r! Already we know that P(n, r) is n factorial divided by
(n – r)! So, I can write. So, this is my we know thus these are my n, r-combination of n
elements. Now how to proof; how we can give a proof. See now, we know the r
permutation of n elements and that is an ordered arrangement or order selection.

So, we start with the ordered selection and see how we can make the ordered selection.
So, let S be a n element set. So, now, each permutation of S arises exactly one way; what
are this? I choose r elements from a set for a set S and since it is the ordered
arrangement, I am considering permutation.

So, I can write arrange the chosen r elements in some order. So, from the definition of
permutation, I can write this thing. Now, we see that how we can write. So, though if we

361
see the first one, choose r elements from a set S. So, this is nothing but my definition of r
combination of n elements.

(Refer Slide Time: 12:35)

So, the first one that choose r elements from a set S having; choose r elements for set S
having n elements is nothing but my nCr. This is nothing but my n chooser and the
second one that arranged. So, the arrangement is ordered arrangement in some order. So,
that I can write that is my permutation. So, second one I wrote that ordered arrangement.

So, according to the definition, I write that is nothing but my P(n, r). Now, here this P(n,
r) is r! or sorry a P(r, r) is r! P(n, r) if it is r element, it is. So, if it is P(n, r) if it is P(r, r);
then means from. So, I can write this is my r factorial. Now, we know that P(n, r); P(n, r)
we know that already we have got this is n! / (n – r)! So, I can write that my nCr is
P(n,r)/r!

See you can I have written S this nCr is I can write that this is P(n, r) / r! or actually I can
I should write this thing first P(n, r) is r! x nCr because two steps; I have written choose r-
elements for a set S and array is the chosen r elements array is the chosen r elements
means this is P(r, r) ordered arrangement is P(n, r).

So, r for r element for r element it is P(r, r) and that is r! So, P(n, r) is r! x nCr. So, in nCr
is P(n, r) / r! and P(n, r) already we have got n! / (r!(n – r)!). So, this is our expression for

362
the combination; r-combination of a set of n elements. So, I got this thing. Now, we see
some problems with this combination.

(Refer Slide Time: 16:56)

First, we see some simple example. How we can use this formula of nCr ok? Say I have
25 points are chosen in a plane in a plane. So, that no three of the points no three of them
among these 25 points are collinear. Then, the counting problem is that how many
straight lines we can draw to do, they determine with these 25 points. Then, also we can
find that how many triangles we can form with these 25 points having this property that
no three of them no three points are collinear.

So, first thing is this is a pure counting problems and there is no ordering. So, un-ordered
arrangements. So, you can give the solution. The first one that straight lines. So, no three
of them are collinear. So, with each two points we can draw a straight line.

Now I have 25 points. So, I have to the problem, I can think that that two combination of
25 elements. So, this is 25C2 = 25! / (2! x (25 – 2)) and this becomes 25! / (2! x 23!) this
equal to (25 x 24 x 23!) / (2 x 23!). So, this becomes 25 x 12 is 300.

Now, how many triangles we can give since no three points are collinear? So, with any
three points we can draw a triangle. So, I have 25 points and we have to choose three
points any three points, the total number of combinations are simply that means, any
three points we can write with.

363
25
Any three points one triangle can be drawn. So, this is simply C3. Again, the similar
way. So, this becomes 25 x 8 x 23 is 4600. So, we can see that how directly we can apply
the formula of the combinations.

(Refer Slide Time: 22:51)

Now, we can the theorem we got that nCr is n! / (r! x (n – r)!)

So, I can write a corollary that if I write nCn-r that is I am giving r = (n – r). Then, I can
write n! to (n – r)! and (n – r) is (n – r)!. This becomes n! – (n – r)! and this becomes r!
So, this is equal to nCr. So, the corollary is that nCr is nCn-r. So, I can give this thing also.

(Refer Slide Time: 24:09)

364
Now, we take another example take some 8 letter say how many 8 letter words can be
constructed using 26 letters or alphabets set, if each word contains either 3 or 4 or 5
vowels. So, the problem is that I have to frame a 8, 8 letter word and from the 26
alphabets that a to z and the restriction or the properties satisfying the property see we
can remember that in the definition of when we started with the definition of permutation
and combinations that it the, some a ordered or unordered arrangements satisfying some
property.

So, here it is the, it contains either the each word contains either 3, 4 or 5 vowels. So,
first I consider the three vowels case. So, the case, case 1, I am taking that word contains
the words contain containing 3 vowels. Now since there are 3 vowels. So, in this case
there will be 3 vowels and 5 consonants. So, in the 8, 8 letter word.

So, I can in 8 letter word, 3 vowels can be chosen. How many vowels? 3 vowels can be
chosen. Say 8C3 ; that means, say if I take in this way say as if this is a 8 letter word 4, 5,
6, 7, 8. So, these 3 vowels that I can put in 8; 8C3 different ways. So, I can choose here.
So, 3 vowels can be the vowel can be here; the it can be here; it can be here.

So, 3 vowels I can put this is my, this is the way. Now since there is since there is no
restriction that of repetition. Since there is no restriction about that, that how many times
I can choose; how many times about the occurrences of vowels. So, there are 5 vowels.
So, I this can be I can keep 53 because I have 3 vowels and there are 5 different vowels.

So, I can put this place. Then the remaining 5 places. So, we have we have 21 constants
consonants and there are 5 places for them. Since, 3 places already vowels are there and
there are 5 places for them and that we can put I have 215. These many ways I can put
the consonants.

365
(Refer Slide Time: 31:16)

So, the case one that what we are telling that for how many ways that are we can go 3
vowels or the number of words having 3 vowels, I can write. Number of 8 letter words
with 3 vowels, this is equal to I got this is the 8C3 ways I can put the three vowels. Then,
since there are 5 vowels and 3 positions; so, 53. So, I can write that this number equal to
8
C3.

Then, 53 x 215 places. Now, if we just extend the idea that when number of 8 letter words
with 4 vowels. So, I can write. So, if these will be 8C4. Since now I can choose 4 vowels
from 8 letters 8C4 positions there are 5 vowels; 4 places, 54; 21 consonants rest of the rest
of the 4 places.

Because I have 8 places; so, this is my rest of the 4 places. Now I have number of 8 letter
words with 5 vowels is 8C5, the similar way. Then, it is 55 and this becomes 213. So,
now, I have that addition principle because my question was that either 3 or 4 or 5. So,
the total number of words having 3 or 4 or 5 vowels this is equal to the ok; I have to add
because with 3 vowels 8C3 x 53 x 215 + 8C4 x 54 x 214 + 8C5 x 55 x 213.

So, this is my answer. So, the, for unordered arrangement for accounting problems, we
can use a combination like that. Now sometimes we require this, what will be the total
number of combinations.

366
(Refer Slide Time: 35:37)

That means if I now consider the a from a set of set of n elements; set of n elements set.
Then, the way we number of way we choose the elements say I can start with that as if I
start that 8C0 choose n, 0 elements; I can choose 1 element; I can choose 2 elements; I
can choose 3 elements … In that way I can choose up to n elements. That means, the
these sum tells about the total number of elements that we can total count that we can
choose the elements from a, n elements set. I can choose 1; I can choose 2 at a time or 3
and these will be my S, 2n.

Sometimes we write this thing as a theorem also. We can we can write this thing as also
a theorem and we can prove this thing. If we if from the definition only actually we can
prove this thing that this is this is my the total number of ways or ways we can choose
elements from a set is with n elements and this is my say actually this is my left hand
side tells that thing I can choose 1, 2, 3, … like that. What my right hand side tip very
simple way, I can think if I have we have n elements n elements and as if I am making
two partition.

So, whether these n elements and I will be taking some combination or not. Now, that
means, if it goes to this combination I am giving 1. If it does not go, then I am putting 0;
that means, if it goes to combination 1; if it does not go, I can take it is 0. So that means,
if it is in I this is nothing but the all possible ways I can write the thing as 0, 0 like this if

367
I have 3 I can tell that it is 0 0 0 or I can write that all possible way if it is only n equal to
3, I can write 000, 001, 010, 011, 100, 101, 110 and 111.

So, these are the way; that means, these I have not chosen any combination. Here only
these element goes to combination; and these element goes to combination; and these.
So, these are all possible way that we can take the combination; that means, whether and
here see we have covered when n = 3, we have actually covered all the combinations
here and all of we know this is just if we can think in this way. This is a binary
representation. So, it is a as if the invariable n bit binary representation.

So, I can write this is 23. So, when this will be some for n elements for n elements I can
think we know that these count is 2n. So, if the RHS we can think that as if these n
elements and whether I take the combination or not; that means, if it is goes to that
combination partition I am just we are thinking like that; we are defining in this way.

Then, this RHS is nothing but 2n RHS is nothing but 2n and the LHS is actually it gives a
total number of ways we can choose elements from a set to n elements with n elements
and this is definition wise according to the definition the LHS and RHS are same. So, I
can put this thing. So, I can treat this thing as a, this thing as my proof. Sometimes, we
take this as this property as if this as a theorem and then, we use this relation for solving
some of the combination problem.

368
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute Technology, Kharagpur

Lecture – 43
Combinatorics (Contd.)

So, we are discussing the Combinatorics; that means, mainly the counting problems with
arrangements and in particular the ordered arrangements that means, the permutation and
the unordered arrangement that means, the combinations. Now the last lecture, we have
read the permutations; mainly, the permutation of a set with having n elements or a
combinations of a set having n elements.

Now today, first we will see that permutations of multi set; that means, r permutations of
a set, where the elements and not distinct. Normally the set we define where the elements
are distinct and we define that type of set as a multi set. So, we will read the
Permutations of Multi sets.

(Refer Slide Time: 01:27)

So, a multi set is a set where elements are not distinct. So, if elements are not distinct that
in other way, I can tell that elements are with repetition; that means, set with the
repetition of elements that we can tell as a multi set. So, I take one example that say M is
a multi set and M, I can write say I have a; there are 3 a’s; 2 b’s; then, c 1; I have saved 4
d.

369
So, it has 10 elements set. Now I can write this thing since a b c a b c d they are not there
are four different types, but they are not distinct and the same thing, I can write as if a
with 3 repetitions. So, normally we define or we denote this thing as a 3 . a; that means, a
of with repetition 3; 2 . b, b with repetition 2 repetition; 1 . c and 4 . d. So, there are 10
elements; this is a 10 element multi set. So, M is a, M is a 10 element multi set. Now it
may happen that there is no restriction of some particular elements; that means, that we
can tell that infinite elements.

These are finite. Finite number of elements exist. Now if infinite, if some element
appears in the set or I should write the multi set infinite time with infinite repetition;
then, I can write the set M say this is a with 3 repetition; b with infinite repetition that I
can write ∞. b; again c can be infinite repetition and then this is a. So, this and infinite
number of elements multi set. There is no restriction. Now, with these introduction, we
try to define that the permutation of a multi set. So, as we have defined already that
permutation we have to defined that this is an ordered arrangement. So, we will be
counting the some objects when the arrangements in order.

(Refer Slide Time: 05:46)

So, I can write that if S is a multiset and r-combination this is a, we are discussing
permutation, this will be r permutation; r - permutation of S is an ordered arrangement of
r of the set S having n elements. So, this is same; only this is again ordered arrangement
only we have taken this is a multiset. So, if I take an example say M is a multiset and I

370
have taken say a with repetition 2; then b with repetition 1 and C with repetition say 3.
Then, the if I if I want the r = 4 say that means, 4-permutation; that means, that is 4
permutation of a set M some of the 4 permutations at be I can write a a b c or a b c c;
these are some of the some of the 4 permutation.

It can be that since it is ordered I can take a c b c, I can take this type of ordered
permutation or it may be b c c c that is again another order permutation. Now I have here
the number of elements or in M number of elements of 3 type a b c elements are of 3
type and total number equal to 2 + 1 + 3 = 6.

So, there will be no 7 - permutation of M. So, at most we can take up to 6 permutation,


we can take. So, at most we can consider 6 - permutation and normally if it is and then, it
is called permutation only because if it is in permutation of a set having n elements, then
we call this is nothing but the permutations of all elements. So, this is called the
Permutation. Now, we will see a property or so, I give a theorem.

(Refer Slide Time: 10:14)

How to compute the r-permutation of a multiset having n elements when it is finite or we


will see later if it is infinite. So, let S be a multiset with objects of K different type; like
last example we have to see a b c, 3 different types. So, here K different types, where
each type, each has an infinite repetition. Then, the r r - permutation of S is Kr. So, the
first theorem we consider that the multiset having infinite number of or having elements
with infinite repetition number and they are of K different types; that means, I can write

371
that like M is a multiset, if I write that infinite of a1; then infinite number of a2; infinite
number of a3 and in this way it is infinite number of aK.

That means, here a1, a2, … , aK are K different type of objects; are K different. Now, how
to prove this thing; how to prove this theorem? So, in constructing the r – permutation,
we have to construct the r - permutation of this type of multiset, we can choose multiset
M, since every element appears or may appears infinite time. So, we can choose the first
element or the first object; first type of objects, any one of the K types; is it as any one of
the K types.

(Refer Slide Time: 14:57)

So, since I have r r - permutation. So, I take that first object can be chosen by K different
ways because any one of the K type second object again that can be chosen by K
different ways and similarly if it is rth because it is r - permutation. So, rth object can be
chosen by K different.

Since there is no restriction and any type of objects appears infinite with infinite
repetition. So, the multiplication rule; using multiplication rule, I can tell that r r -
permutation of set M having objects with infinite repetition is equal to K x K x K x … r-
times. So, this is equal to Kr. So, result is proved. Now, we see that application of this
theorem. I take one example one problem.

372
(Refer Slide Time: 17:58)

How we can apply this one. So, I give one problem that what is the multiset with ternary
numerals with at most 4 digits; what does it mean? So, with ternary numerals means my
numerals can be only 1, 2 or 3, but obviously, that set has the 3 type of elements. So, if I
consider a set S, 3 type of elements, but order of infinite with infinite repetition because
there is restriction. Now, I have to form a 4 digit number, I have the 4 digit number like
examples; examples of 4 digit number only with 3 literals.

So, that may can be 1 1 2 3; it can be 1 2 3 2; it can be 1 2 3 3; all this type of 48


numbers. Now, mainly we have to find out that what is the multiset; that means, how
many this type of numbers are possible? So, directly we can apply this result of this
theorem because here it is Kr. So, K of 3 because I have 1, 2, 3 only; three different
types. So, K = 3 and r = 4 because mainly I have to take the 4 permutation, since I have
only 4 digits. So, 4 permutations of S and this is equal to 34 is 81.

So, I have only these many numbers possible. Now, I give that finite if the theorem want
a set if the multiset have objects with infinite repetition. Now it take if it is of finite
number of repetition.

373
(Refer Slide Time: 21:30)

So, I write Theorem 2. Write the statements of the theorem that similarly let S be a
multiset with object of K different types with finite number of repetition and I am writing
the repetition numbers are n1, n2, n3, … , nK; K different types so n K respectively. So, I
can write or we consider that let size of S is n1 + n2 + n3 + … + nK. So, number of
permutation of S, we can write is n factorial divided by n1! x n2 ! x … up to nK!.

So, first thing is here Theorem 2 tells about finite number of finite number of repetitions.
So, let the K different types of the elements are a1 to ak. So, let a1, a2, … , aK are the K
different type of objects and a1 is with repetition finite repetition with n1 repetition; that
means, n1 number of a1. Similarly, a2 is with n2 repetition, … and aK is with nK repetition,
then say I have to take the I have K different types. Now, let first we choose the a1
objects.

374
(Refer Slide Time: 26:10)

Since I have, I have a1, a2, … , aK; these are the objects we have aK, the K different since
I have a1, a2, … , aK; K different objects. Then, an a1 appears, a1 is with n1 repetition. So,
we can choose; we can choose a1 objects by nC1 ways. nC1 because a1 is of is with
repetition n1 ok. Now, once I have chosen nCn1 ways of a1, then we can choose a2 from
remaining for remaining objects. That means, remaining objects are a2 objects; remaining
objects are (n - n1) and my a2 is with repetition n2. So, this many ways I can take.

(n-n1-n2)
So, the same thing if it is for 3 objects, then now my objects remaining C3a3 is
with n3 repetition; a3 with n3 repetition. So, I have n3. In this way if I continue, then I can
tell my aK if I choose aK objects; aK type of objects that with nK repetition.

So, n-n1-n2-…-nK-1CnK. So, now, we can use the use multiplication rule.

375
(Refer Slide Time: 29:29)

And we can get the number of number of multiplication, number of this is number of
permutations; number of permutations equal to the further of a 1 objects nCn1 ; then, it is n-
n1
Cn2, then n-n1-n2Cn3 and in this way are get the for a k, n-n1-n2-…-nk-1
Cnk. So, if we put the
values the n! / n1!(n - n1)!, then again (n - n1)! / n2!(n - n1 - n2)!

Then, (n - n1 - n2)! /n3!(n - n1 - n2 - n3)! and in this way if I go, then the last term will be
(n1 - n 2 - … - nk-1)! / nk!(n - n1 - n2 - … - nk-1 – nk)! So, the numerator and the previous
denominator, they will cancel because it has same term (n - n1 - n2).

So, they will cancel and or be getting the n! / (n1! n2! n3! … nk! 0!), the last denominator
will be there. Now, what is this last denominator? See the last denominator is if I write
here, the last denominator is (n - n1 - n2 - nk-1 – nk).

So, if you remember the size of S that is n minus this size of n is (n1 + n2 + … + nk)
which is nothing but equal to n only; the size of S. So, this is n - n = 0. So, I get for the
last one this 0! So, which keeps S that or n! / (n1! n2! n3! … nk!). So, this is my, that the
proof. So, quickly if we see one example.

376
(Refer Slide Time: 34:08)

So, we want to compute the number of permutation of the letters in the word say word is
INDIAN. So, here if I consider the set S, then I repeats 2 times; N repeats 2 times; then
D repeats only 1 time; A repeats 1 time. So, this is my multiset and I have total number is
the size of S is 6. So, my n equal to 6 and I can write the number of permutation. So, the
number of permutation is 6! divided by there are 4 types; I is my n1, 2!; n2, 2!; n3, 1!; and
n4, 1!. That means, I with 2 repetition; N with 2 repetition; D with 1 repetition; A with 1
repetition.

So, I can write (6 x 5 x 4 x 3 x 2!) / (2 x 2!) on this becomes 6 x 5 x 2 x 3 this 180. So, in
this way, that we can apply this theorem of to count the number of permutations for
multiset, where the elements appear with finite repetition or infinite repetition and we
can apply to solve the counting problems with permutation.

377
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 44
Combinatorics (Contd.)

So, we have read the r-permutation of a multiset; that means the ordered arrangements
when the set contains the elements with repetition and that repetition we have considered
finite repetition; that means, the each element appears finite number of times or it can be
infinite number of times. Now, the way we have defined permutation and combination if
we remember that it is the arrangement, but permutation when it is the ordered
arrangement combination when it is unordered arrangement.

So, the similar way I can defined the combination of multi sets; that means, that we have
we can count the arrangements or the counting in problems, but we can apply that where
the unordered arrangement is considered from a set or set having elements with infinite
repetition.

(Refer Slide Time: 01:35)

So, we will read the combinations of multi set. Similar way we can define the
combinations only the difference is unordered arrangement. So, if S is a multiset then an r-
combination of the set S is an unordered arrangement of S and similar way the way we
have defined combinations of sets I can tell. So, the r-combinations of multiset of multi set

378
S is nothing, but the sub multisets of S is sub multi set since it is unordered. So, I can tell
this is a sub set, so, some multi set S having r-elements because I am considering r-
combination.

Now, if S is an n object then there is only one n-combination of this then only one n-
combination and normally we call that is the combination of set n-combination of set S. If
S has objects of K-different types then there are K number of 1-combination of S, these are
similar to that normal set.

So, if we illustrate with an example say I consider a multi set S say if S I take that with
finite repetition say I have a elements with 2 repetition, b with 2 repetition and c with 3
repetition. Then since it is an unordered, so, I can write some 3-combinations though sum
of the 3-combinations of S is simply 3. So, I can write 2. a, 1. b; I can write 2. a, 1. c; I can
write 1. b, 2. c; or it can be 1. a, 1. b, 1. c. It can be you can write here 1. a, 1. b, 1. c and so
on we can write. Now, we see how we can give the general statement of computing the r-
combination.

(Refer Slide Time: 07:28)

So, I give a theorem this statement, I write that let S be a multiset with objects of K-types
each with an infinite repetition then the r-combination of the set S we can write as r+K-1Cr
and which is same as that of r+K-1CK-1. And here it is infinite repetition, so, S is S is of type
K type; so, ∞. a1, infinite repetition of a2, infinite repetition of a3, and so on infinite
repetition of ak.

379
So, now, with this theorem statement we read some problems and how we can actually
compute the combinations.

(Refer Slide Time: 10:15)

You first take a multiset one example we take as it is the like the theorem statement. Let S
be the multiset say I have a with 10 repetitions, b with 10 repetitions, c with 10 repetitions
and d. So, there are four different types a, b, c, d with objects of four types of four
different types. Then the question is what is the number of 10 different or I can write 10-
combinations of S which have the property that each of the four types of objects object
occur at least once.

So, the just like the theorem statement here is system multiset having four different types
of objects a, b, c, d and each type of objects appear with finite repetition and 10 repetition,
10 is the, 10 repetition number. Now, what is the number of 10-combinations of S which
have the property that each of the four type of objects occur at least once.

Now, here if we consider ok, this solution if we think say if a appears x1 times, b of x2
times, c of x3 times and d of x4 times; that means, x1, x2, x3, x4 are my repetition number or
other way I can tell that a number of a’s number of that is number of a’s = x1, number of
b’s = x2, and like c’s number of c’s, x3; number of d’s, x4.

380
(Refer Slide Time: 14:35)

So, I can write that the answer is you can write that the answer is same as that of the is
same as that of the number of integral solutions of x1 + x2 + x3 + x4 = 10. Since each object
appears at least once and it is a 10-combination so, the total objects or total object count
should be 10. So, I can tell this is the 10-combinations of this thing.

So, I can write the I introduce an variable y1, y2, y3, y4. So, introduce new variables say y1,
y2, y3, y4 such that this becomes y1 = x1 – 1, y2 = x2 – 1, y3 = x3 – 1, and y4 = x4 - 1.

So, my equation 1, becomes, so, the equation 1 becomes y1 + y2 + y3 + y4 = 10 - 4 = 6. So,


that why we have done. So, that these y’s become here the here the y’s become non-
negative; y’s become non-negative. I have to find out the number of non-negative integral
solution of this new equation I can write this new equation as the 2.

381
(Refer Slide Time: 18:21)

So, if I continue I have to find out the number of non-negative integral solution of equation
2, that is y1 + y2 + y3 + y4 = 6.

So, now if we apply the theorem of the r-combinations of multiset S, then I will get that
number of non negative solutions this becomes.

r+K-1
Student, I have any 6 ok, I write if we see the statement that Cr and this was the r-
combination of S and K different types of objects. So, we identify here r; that means, here
r = 6 and four different types. So, K = 4.

6+4-1
So, I can write r + K - 1, so, C6; r is 6. So, this becomes 9C6 = 9 x 8 x 7 x 6! because
this is 9!; divided by 6! x 3!. So, this is equal to 6! x 3! this is equal to 9 x 8 x 7 / 6 is = 3 x
4 x 7 is 84, so, I will get the total 84 solutions.

Now, one important application area of this particular problem that or these r-
combinations of set with infinite repetition is the number of integral solution. How to find
the number of integral solution? If we see the previous example see the examples we have
actually converted into that form that initially it was only that combination it was given the
statement, but we have converted the problem statement. So, that it becomes that how to
find out the number of integral solutions of this equation.

382
(Refer Slide Time: 22:43)

So, now if we see this type of examples that I give a different problem that say another
example if you see and we give it different solution procedure ok. The statement is
determine the number of 10-combinations of the multiset m equal to 3 a with repetition 3,
b with repetition 4, and c with repetition 5.

Now, here the problem is this and we will apply the inclusion-exclusion principle. So,
different solution technique will be using here we will apply inclusion-exclusion principle.
So, first we consider that we identify the property. So, let P1 be the property that a 10-
combination of say I am making this thing as a M* 1 multiset and M* I am giving that as if
M* is that again three different types having infinite repetition. So, ∞.b; ∞.c and making
this thing and property that 10-combination of M star has more than 3 a’s see the original
problem it was that there are 3. a; that means, a with finite repetition 3.

Now, the property I am taking that P 1 the property that it information of M star has more
than 3 a’s because that is why we have changed the size of the multiset and that we take as
if this is M star which is infinite set. Otherwise, we cannot consider that v a element or the
a have the more number of a will appear where the more than the repetition number. So,
here the reputation number is 3. So, we consider that P 1 is that property.

Similarly that P 2 is the property that the a 10-combination of M star has more than M star
has more than 4 b’s; more than 4 b’s and P 3 is the property that 10-combination of M star
has more than 5 c’s more; than 5 c’s. So, these are my that property.

383
(Refer Slide Time: 28:20)

So, if we remember that inclusion-exclusion principle that actually the way we have
defined that now let A1 be the of this combination; that means, Ai. If I continue let as usual
we consider that Ai consists of this 10-combination; that means, A1 is the A1 concerned
with A’s, A2 is that of with b’s and A3 is that of with c’s.

So, if we remember the inclusion-exclusion principle then I can write that the size of the
set that it will give let the number of I can write the number of 10-combinations M star
that have none of the properties of P1, P2, P3 is equivalent to get the number of 10-
combinations of M. Why?

If we see the way we have taken that M was that a with 3 repetitions, b with 4 repetitions
C with 5 repetition then I have converted M star with infinite repetition and we have
considered P1 as if a appears more than that has more than 3 A’s a appears more than 3, B
appears more than 4, C appears more than 5. So, this is actually complement. So, that is
why then I if I now apply so, using if I remember that using inclusion-exclusion principle
because that tells that A complement the cardinality of A complement is the cardinality of
set S minus cardinality of A.

So, inclusion-exclusion principle I can write the here it is 3. So, cardinality of |A1’ ∩ A2 ’ ∩
A3 ’| these will be the set S - ΣAi. So, here it is only three; that means, |A1 + A2 + A3| - the
2-combinations plus 2-combinations then (|A1 ∩ A2| + |A1 ∩A3| + |A2 ∩ A3|. Then I have

384
another that all three together I have to take that |A1 ∩ A2 ∩ A3| this is a our inclusion-
exclusion principle.

(Refer Slide Time: 33:07)

Now, we have to compute all the values. So, now, we use that r use the r-combination of
how to compute that r-combination of set S. So, S is I can write that 10 because 10-
combination 3 type. So, 10+3-1C10 would which is 12C10 = 12! / (10! x 2!) = (12 x 11 x 10!) /
(2 x 10!) = 66.

Now, I have to calculate the others. Now, how to compute that A1? See I can write that
because there are 10-combinations and A1 we have taken the property that A1 appears
more than 3. So, if A1 appears more than 3 since I have 10 numbers where that more than
3 means at least 4. So, I have 10 and for when I am considering the property of A1 because
that A1 appears more than 3 ok. So, this will be 4; so, this becomes 6. So, I am taking that
6+3-1
this is C6 and this becomes 8C6 = 8! / (6! x 2!). So, (8 x 7 x 6!) / (6! x 2), so, this
becomes 28.

385
(Refer Slide Time: 35:32)

So, similar way I can compute A2 which will be it will be 5 plus because more b appears
more than 4; that means, 5. So, it is 5+3-1C5 and this value becomes 7C5 this becomes (7 x 6
x 5!) / (5! x 2!) and this becomes 21. Then A3 is 4 + 3 - 1 because more than 5 means 6 so,
C appears. So, this becomes 6C4 = (6 x 5 x 4!) / (4! x 2!) and this becomes 15.

Now, the two combinations I can get A1, A2, if I take together so, this becomes 10 - 4 + 5
because for A it is 4, for b it is 5, so, this becomes 1. So, I have 1+3-1C3 is 3C1 = 3. Now, for
(A2 ∩ A3); (A2 ∩ A3) this becomes 0; for (A2 ∩ A3) this becomes 0. Why? Because here
this becomes 5 + 6 = 11 and 11 > 10. So, it is not possible this type of combination.

Now, for (A1 ∩ A3) so, (A1 ∩ A3) this becomes 10 – (4 + 6). So, here these 11 is; these 11
is coming from (5 + 6), b and c, so thing so, these becomes equal to 0. So, A1, A2, A3 is 0+3-
1
C0 = 2C0; 2C0 is 1. So, I got this value 21, this is 15, this is 3, 1, this is 0 another value
have to compute A1, A2, A3.

386
(Refer Slide Time: 38:45)

So, this is my (A1 ∩ A2 ∩ A3) and similarly this becomes 0 because here this is 10 - 4 + 5
+ 6. So, this is greater than, I am sorry, 4 + 5 + 6. So, 15; which is greater than 10, so, this
type of combinations is not possible, so, this becomes 0.

So, now, if I put that values all those values with inclusion-exclusion principle |A1’ ∩ A2’ ∩
A3’| then I got as that is 66 minus; A1 is 28, A2 for A2 this is 21, this is 15 then for 2-
combination we got 3 + 1 + 0 then 3-combination it is 0 only. So, this becomes 66 - 64 - 4
+ 4, I am sorry, this term will be plus 4, so, this becomes 6.

So, see the when we are considering that combination with repetition, so, this is one
example of combination with repetition I can apply the inclusion-exclusion principle. So, I
can write this is an example of; this in an example of combination with repetition; is an
example of combination with repetition where we use the inclusion exclusion principle
and we can get this solution directly by applying this.

So, directly we can the earlier example directly we can we have applied the theorem of
computing the r-combinations of a multiset S and that S has elements with finite or infinite
repetition we have considered and one example we have seen that how to find the integral
solution of an equation. And here another example with combination with repetition we
have seen that we can use that inclusion-exclusion principle that we have read earlier. In
this way we can handle the permutation and combinations.

387
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institutes of Technology, Kharagpur

Lecture – 45
Combinatorics (Contd.)

We are discussing that how to handle the counting problems with permutation and
combination. And mainly the very simple way we have defined the permutation
combination problems as the arrangement of ordered and unordered sets or ordered and
unordered selection or arrangement from a set.

Now, this lecture will be discussing one topic it is called the derangement. I can simply
tell that this is a different type of arrangement or the reverse type of arrangement. So,
normally arrangement some property is to be satisfied we have defined. Now, here also
that property is that arrangement should not be there.

So, sometimes we will tell that this is actually that the inverse of the arrangement. And
there also this is one counting techniques because we will see many real life problems
that come comes under this type of topic. So, this is normally called that derangement.
So, this is a important combinatorial problem ok.

(Refer Slide Time: 01:37)

388
So, with one simple example first I try to explain that what is derangement? So, let in a
party that 20 people joins and the 20 people reach their with a hat; that means, all people
will have a hat. Now, when they leave then they will collect the hat.

And the if I give this type of condition that no one will get his or her own hat. And this is
then how many ways it is possible that no one of that 20 people will get their own hat.
So, normally an ordered arrangement will be we can tell that each people will get their
hat. Now I am telling why I am telling it is reverse that means, this is some problem that
will be handling that how many ways we have to tell that how many ways it is possible
that no one will get their own hat. So, this is the problem of derangement.

Now, first we define the problem of derangement. So, we are the actual nature of the
object is that we can take a set of n elements ok. Like we have consider like 20 person or
20 people join the party with hat. So, I define that thing that let a set X with n elements
as 1, 2, … , n.

Now we define a derangement like that a derangement is defined that in is defined that
the arrangement in which no element gets its original place. That means, I can tell that it
is a permutation; it is a permutation of say write I give some variables permutation of i1,
i2, … , in of the elements 1, 2, 3 up to n.

Such that i1 ≠ 1, i2 ≠ 2, i3 ≠ 3 and so on. That means, this is the permutation that no one
gets it is place means the as if we are taking the place is 1, 2, 3 that is my right number or
place. And then if it is a permutation of i1, i2, and i3 and in then i1 ≠ 1, i2 ≠ 1, i3 ≠ 3, … in
≠ n that should be. That means, that is no one in it is elements in its natural position no
one in its natural place or natural position.

So, I define derangement as if the reverse of that thing. So, I can define it is a
permutation of this if I can consider this is the natural position then no one will get the
position this is my condition to be there. Now we normally denote we denote
derangement of n elements. We denote derangement of since it is a permutation of n
elements as Dn, this is the convention. Now you see that how we can make the
derangement.

389
(Refer Slide Time: 07:49)

Now what will be D1 ? So you can compute so compute some values of Dn compute Dn
ok. So, what will be D1 ? If D1; that means, I have only 1 element and say that is position
is 1, so, I give I have only 1. Then no derangement is possible because it is only 1
position and it is fixed.

So, my D1 = 0 because no derangement is possible; no derangement is possible. Now if I


have so D1 is 0. Now I have D2 is 0 now see I get I have 1 and 2 then that output should
be or the permutation output of the permutation will be. So, I get 2 should be here and 1
should be here so this is the permutation I want.

That means, only 1 permutation is possible with 2 elements that it will be they do not get
their position. That means, here 1 then 2 comes here. So, my D2 is D2 is only 1 because I
have only 1 permutation possible. Then what is D3? So, this time I have 3 elements ok, I
have 3 elements 1, 2, 3. So, I have 1, 2, 3 you see that how many are possible. So, if I
have 1, 2, 3, then 1 permutation is there that in place of either 2 can come or if I take if it
is 1, 2, 3 in place 3 can come.

Now if 2 then 1 can come here or here, but 1 I cannot put here then 3 will be in its
position; that is not the definition. So, I must put 3 here so that everyone gets a different
place, so this is a derangement and for 3 then again similarly 2 I cannot put here I can get
1 then 2 will be here.

390
So that means, these are the 2 permutation this the 1 and 1 this permutation where that no
one gets its proper position 1 instead of 1 it is 2, 2 gets 3, 3 is 1, 1 3 1 2 so these are 2.
So, I have D3 = 2. I take D4 then I have 4 numbers or 4 elements. Now if it is 4; this is
my original position or the place.

Then what I can write that there can be 3 in place of 1 it can be 2. I can write in place of;
in place of 1 it can be 3 or this is original. So, in place of 1 it can be 4. Now if it is 2 then
what will be the other. If it is 2 then with 1 3 at 1 3 4 I have to keep, so, one can come
here, then 4 must come here and 3.

Now again if it is 2 then see 3 can come here then 4 must come here 1. So, 2 1 4 3 2 3 4
1 and 4 can come here, but 3 must be there so 1. So, I get these three. Similarly I see that
these 3 is here. So, then it can be 1 4 3, sorry 1 4 2 this can be 1 4 2 3.

This can be 4 4 1 2 this can be 4 2 1 so 3 1 4 2 3 4 1 2 3 4 2 1. So, I get another 3 starting


with 3 similarly I will get 4. So, these can if it is 4 then these can be 1 this must be 2 it is
3. If it is 4 instead of 1 here it can come 2 sorry 3 it is the position up to 3 it must be 3
this can be 1 and 2 and this 4 then it can be 3 2 1. So, 4 1 2 3, 4 3 1 2, 4 3 2 1 so I get 9
here 3 here 3 here 3.

So, my D4 is; D4 is 9. So, I get that the this is actual how we can get the derangement.
That means, what are the number of permutations we can get, so, that no element can get
it is own position; so, this is the derangement.

But; obviously, that if and my number of elements will be more then it is very difficult to
get in this way to count. So, how we can do that thing? So, now, if we put the a sum
formula or that some generalised rule whether we can frame. I give a theorem of
derangement.

391
(Refer Slide Time: 15:07)

So, this is my theorem of derangement I can write. So, for I give that for n = 1 the
derangement formula is Dn = n! (1 - 1 / 1! + 1 / 2! - 1 / 3! + 1 / 4! - … in these way if I
go. Since I do not know what is the value of n? So, whether it is odd or evens so (-1)n1/n!
So, this is my formula for derangement.

Now, how to proof these things how we can proof this derangement theorem. If we see
that this is nothing, but the selection that as if we have the see the examples what this is
when we have 4 elements as if we have some 4 original positions and what we are doing
that we are placing the elements in such a way so that no one gets it is original position.
As if we are considering this is the; this is the original position this is their original
position.

Similarly, here it is the original position, this is my original position. So, in the similar
way if I write that so let S be the set of all n! permutations. Since there will be an
factorial permutations of n numbers, if we quickly see with this thing by how it is n
factorial permutations; see I have 3 numbers 1, 2, 3. Then what are the different way I
can permit. Because when I consider that 1; 1 can go here 3 different ways because 1 can
get this position 1 can get this position or 1 can get this position.

So, when I am considering the first one it can be 3 positions, but once 1 is placed for 2 it
is only 2 positions, similarly once 1 and 2 are placed 3 has only 1 place left. So, these
will be 1, so, this is 3 into 2 into 1 since I have 3 elements. So, this is 3! similarly if I

392
have n, so, for n the first one will get the all n places for the second one. Since already 1
has got the place so, it will be (n – 1) then for (n – 2) and then up to 3, 2, 1.

So, these will be my n! So, that we have written that n factorial permutations of 1, 2, 3,
…, n. Now say for some j say for some j = 1, 2, … n I write from property some Pj be the
property like the one we have considered in our inclusion exclusion principle the
property that in a permutation; in a permutation j is in its natural position; j is in it is
natural position.

See or derangement is that no one will get its natural position, but we note that the
property Pj I have taken for all j = 1 to n that is P1, P2, P3 that when I am considering j
that it is a permutation where j is in it is natural position j will be in it is position.

(Refer Slide Time: 20:47)

So, the derangement is if you remember the definition of derangement. So, derangement
that when Pj gets; that means, it should be my Pj gets Pj is the property that j gets it is
position. And if Aj is that number of the, if I write if Aj has the property of Pj; has the
property Pj.

Then actually Aj’ has the property has not the property Pj; that means, it will not get the
original position. So, Aj’ has the property with not Pj. That means, Pj means it gets its
original position; that means, it will not get; it will not get j will not get its original

393
position. So, how actually it is the coming with normally the, we have the inclusion and
exclusion principle that we are taking.

So, now how; that means, Dn, I can write the Dn. That this is nothing, but the
arrangement of A1’, A2 ’, A3’. That means, if I apply the above statement for all n elements
then no one will get it is original position. What I wrote, that Aj’ is as the property with
not Pj; that means, it will not get its original position. Now if take for all j = 1, 2, … n
then the derangement is that no element gets its original position.

That means, 1 will not get its position is A1’, 2 will not get its position is to A2’, 3 will not
get its position is A3’and similarly for n. So, Dn = | A1’ ∩ A2’ ∩ A3 ’ … ∩ An’| is A1’ which
is nothing, but our inclusion, exclusion principle. This is my inclusion exclusion
principle that we can apply; that we can apply. Then how will be doing that thing?

Now if I consider my first element; then first element that what are the way it will take
since or if I consider that k, kth element say. So, any a I first I consider any one element
say Aj. So, I can write Aj can get (n – 1)! ways, why?

Because see I have elements like 1, 2, 3, 4 some j say and then n. Now when it will be
getting the place we can write in different way. See I am writing 1, 2, 3, 4, so, I am
considering some jn then what are the place j can take? j cannot take this place because
this is its original position.

That means, other than this place; other than this place j can take any one of the place.
So, j can come here 1 j can come here 2 come here and some j can go here so; that
means, it has option n minus 1. So, what will be the permutation? That means, Aj can go
(n – 1)! which that it can get. So, I can write that it can be the number of permutation that
for Aj that it is (n - 1)!

Now, for this is for j = 1, 2 any n; that means, which one we considering first this will be
my n! Now what will be my permutation then the for if I take the 2 permutation; that
means, Ai ∩ Aj, because if we remember my inclusion exclusion principle we have to
take the two combinations also.

Then if it is 2 then simply it will be the similar logic I can give it is (n – 2)! Because now
already 2 elements are placed, so, I have to or 2 elements they will not get their original

394
position. So, I have to discard those 2 places. So, these becomes a (n – 2) in this way I
can write this thing that A1, I can write that A1 ∩ A2 ∩ A3 ∩ … ∩ Ak.

That will be my (n – k)!, these will be my (n – k)! So, now, if we try to utilize my
inclusion exclusion principle, so, it will be a there are since another thing I require.

(Refer Slide Time: 28:31)

That since there are n C k ways I can choose nCk the k combinations of 1 to n elements
that numbers that I want to put. So, now, if we apply inclusion, exclusion principle;
inclusion exclusion principle.

Then how we get because already we have seen that Dn I can define nothing, but my |A1 ’
∩ A2’ ∩ … ∩ An’|. So, if I get that all permutation earlier what we have seen; that means,
no restriction these will be in permutations minus this is my nC1 I see that there are this
can be there and for 1 there can be (n – 1)! permutation.

And that 1, I can choose from in this nC1 which I can choose the first element and for
each (n – 1)! Now I can for 2; 2 elements I can choose for nC2 and for 2 we have seen the
number of permutation would be (n – 2)! these will be the next will be the similar nC3
then (n – 3)!

395
And if I go in that way then from (n – 1)n, then nCn, (n – n)! So, now, if I put this thing or
if I compute n! - nC1 (n - 1), so, these (n! / 1! (n - 1)!) (n – 1)! + second term is that (n! /
2! (n – 2)!) (n – 2)!

If I go in this way these will be (-1)n nCn, so, I can write (n! / n! 0!) 0! like that. So, see
that here actually that each term from the denominator and the numerator that one term is
always same. So, if these are equal also these will it will vanish.

(Refer Slide Time: 32:45)

So, if I continue then I have the Dn equal, I can write Dn = n! – n! / 1! + n! / 2! – n! / 3! In


these way if I go then (-1)n n! / n!

This the last term if you see that 0! it will cancel and then I get if I take n fact come out
than I will be getting 1 - 1 / 1! + 1 / 2! - 1 / 3! (-1)n 1 / n! So, this is the theorem statement
that we get that we can prove that, this is my derangement expression.

Now, I can input some compute because earlier we have seen that only some simple
values or some small values of n we can easily we can compute. So, now, we can put up
to 4 we have done. So, if D5 now I give the expression 5! (1 – 1! 1/2! - 1/3! + 1/4! - 1/5!).

So, it will be it comes that 5! – 5! / 1! + 5! / 2! - 5! / 3! + 5! / 4! - 5! / 5! So, if I compute


will be getting that quickly I do that this is again 5! both will cancel.

396
Then it is 5! / 2! means this is 5 x 4 x 3 - this is 5 x 4 + 5 - 1. So, these will cancel and it
will be 60 - 20 + 4. So, this becomes 44. So, my D5 is if I get another value D5 is 44 I get
95 is 44. Now see we can compute since I got an expression, but fortunately there is
another very nice expression we can get and that is some recursive statement that we can
recursive expression that we can get recursive expression for Dn.

(Refer Slide Time: 36:51)

So, I can write it actually we can prove easily if you can if you use that expression for
Dn. Then I can write Dn is (n – 1) Dn-2 + Dn-1) and this is for n = 3, 4, 5, … I can write.
So, now, easily we can if we can put we can get D3 = 2(D1 + D2) and already we got (D1
+ D2) is 0 + 1.

So, this becomes 2, then D4 = 2(D2 + D3) this becomes 3(1 + 2) this becomes 9 similarly
D5 = 4(D3 + D4) = 4(2+9) = 44. D6 = 5(D4 + D5) = 5(9+44) = 265; and so on. And in this
way I can compute and I can easily compute or all the derangements of these things. So,
once we get the derangement now easily we can apply these expressions. And
particularly these recursive expression will be very easy to get the derangements. And
the problem that we start started the example that easily we can use that thing. So, one
quickly we if we see one example.

397
(Refer Slide Time: 39:51)

That what early one we are giving them that some in a party that if in n men and n
women. Just they wish to join a dance and how many ways; how many ways that they
can choose, so, that the n women can get a male partner; can get a male partner first time.

So, that is my n! So, if it is first time we remember since I have 1, 2, 3, simply n, I have
also 1, 2, 3, … I have these women, n women, n men. So, simply there is no restriction
n! always the first time they can get. Now, if second time we want the restriction is that
they has to everyone has to change the partner this is my restriction. That means, that is
my derangement everyone has to change the partner; everyone has to change the partner.

Then this is that actually that they the nothing, but the Dn. So, this is actually the second
time dance, so, if it is second time and this is my restriction so this is Dn. So, simply that
using Dn we can solve this type of problem or combinatorics. So, with this lecture we
finish our lectures with the combinatorics problem that how to handle the counting
techniques with combinatorics problems.

398
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 46
Algebraic Structures

Today you will read the Algebraic Structures. Mainly in this study of algebraic structures
we will read how we can define the algebraic systems, their properties and then, we try
to identify that between two algebraic systems what are the properties shared and so that
they are structurally they can be identical or what relations are there in respect to their
algebraic structures we will read.

(Refer Slide Time: 01:05)

So, first we define the, what do you mean by Algebraic systems. Normally algebraic
systems they are the examples are that we know that these are group ring field and the
more simplest form semi-group monoid like that.

So, first we try to define that algebraic systems. So, it is consists of a set. So, algebraic
system consists of a set or rather we call non-empty set and some operations on the set
and they hold some they hold some properties and based on these properties, we will try
to identify the different systems. So, mean systems and then, they are proper properties
then we will try to identify the structures they hold.

399
So, here the main important thing is the operations that on the set that we define and the
properties also. So, first we define that, what are these operations, ok. So, these
operations normally this can be some functions some transformation or sometimes we
called some function means sometimes we called it is a mapping. So, these operations
that can be unary operation like unary operations like or subtraction unary minus we
called the unary operation is unary minus, then our binary operations where the operation
that it operates on the two operands like plus our simple multiplication division all these.

Now, in general I can tell in general that it is some n-ary operation n-ary operation. So,
this in n-ary operation I can define that in general I can n-ary operation we can define
that. If we consider a set on empty set A, then an n-ary operation associates an element
of this set to an n-tuple where each member each member is off is in is in set A. So,
normally we call a into a. So, this is in general the n-ary operation. Now, this can be a
binary operation. This is a it a cross a, 2 a and our addition is a binary operation like that.

So, now we can formally we can define our algebraic systems.

(Refer Slide Time: 07:13)

So, now if we define our algebraic systems since we know the set we know now the
operations on the set s. So, we define algebraic system. So, an algebraic system or
sometimes we called is simply an algebra is a system that contains a non-empty set is set
A and one or more operations. Just now we have defined the operations on the set A.

400
Now, if the operations are denoted as f1, f2, … same this, then the algebraic system is A
we define as (A, f1, f2, …) in this way.

Now, I can give that otherwise it can be now in addition in addition if we add some
relations with this algebraic system, so in addition if we consider some relations say R1,
R2 defined on the set A that is I can denote (A, f1, f2, …) all these operations and R1, R2
with all these relations, then this form an Algebraic Structure, then this system form an
Algebraic Structure.

So, in summary I can tell that algebraic system is a set, non-empty set with some
operations on it and if now we define some relations on this set, then this set non-empty
set A along with the functions and the relations we can tell that these are my Algebraic
structure. Now, first we see some general properties. So, we read some general
properties.

(Refer Slide Time: 11:55)

Because based on these properties first we will try to identify these properties and will be
defining the different algebraic systems or algebra.

So, some general properties of now first we see that the operations that just now we have
defined the algebraic systems, the set non-empty set A and the different functions or
operations f1, f2, etc. Now, these operations that we call these are closed operations. That
means, what do you mean by closed operations that see if I consider that set, my addition

401
the set is the set is integers say integer normally we denote as Z and the operation is
simple addition operation is or simple addition.

Now, if I take element a, b ∈ A, then a + b, this is now here it is Z. So, that is here a, b ∈
Z integer, then a + b ∈ Z because Z is set of set of integer. So, on the operation under the
operation plus that the element we get a + b ∈ Z. So, this is it calls the property of
closure or these operation is closed. It is the closed operation. Now, we see another see
example we say we take another example of set.

(Refer Slide Time: 15:05)

We take the set is A set of odd integers set odd integers and the operation is say addition.

Now, the now the addition or this it is not closed, it is not a closed operation or closure
property does not hold. You can write the closure property does not hold under this
addition for the set of odd integers since here if I consider that even, i toward integers
like consider that O1 and O2 are two odd integers, then O1 + O2 always this will be equal
to the even. This is some even integer and hence I.

So, we have considered that O1, O2 ∈ A set of odd integers a set of odd integers, then O1
+ O2; O1 + O2 ∉ A since it is even. So, it is not closed. So, it is not closed. So, now we
start that we write the all the general properties of Algebraic System. So, since now we
know the closed operation or we can even write the first property is the closure property.

402
(Refer Slide Time: 18:21)

So, the properties, so we give that we give some name that this is A1. This is a closure
and closure under say addition. That means, we here we consider that two operations
when this system we are considered we consider two operations plus and dot. With these
two operations, we try to identify the properties.

So, I can write closure with plus and dot. Now, I give the property of A1; A2 I consider
the property of associative property with respect to addition. Now, if I consider say
element a, b, c; so we will consider set A and where a, b, c ∈ A. Now as just now we
have defined the closure means that I can write that some a, b ∈ a, then a + b ∈ A, area a
. b ∈ A.

Now, associative property I can write that a + b + c = a + b + c. Now, I write property A


3 which is commutative with respect to addition. That means, a, b ∈ A, then a + b ∈ b +
a. I give property A4 is my identity exist some identity element say here 0 is the identity
element with addiction. So, identity is that I get a + 0 normally if e is the identity
elements a + e is e + a = a only.

So, in respect to addition we know that a + 0 is 0 + a is a. So, 0 is the identity element.


So, here e = 0 now I get some inverse element. So, if there exists an element in the set A
such that if a, b ∈ A, such that a + b = the identity element. So, here it is 0 = b + a. So,
then b is the inverse of a. So, additive inverse of a. So, same a - c is the additive inverse
of a. So, additive inverse exist here.

403
Now, I get now if I consider the property or with respect to my multiplication say dot.
So, again this I can consider the associative property associative property with respect to
dot. So, I can write similarly that then multiplication that (a . b) . c is a . (b . c), then A7 is
the property is called the commutative with respect to multiplication and we can write a .
b = b . a. Now, we write the property A8.

(Refer Slide Time: 24:55)

So, the identity element identity element with respect to dot and we know that one is the
identity element since a . 1 is 1 . a = a. So, 1 is the identity element. Now, I can write 9
that is my distributive properties. Now, we have two operations. So, I can write two
operations plus and dot. So, distributive properties with respect to addition and
multiplication.

So, I can write a . (b + c) is a . b + a . c or (b + c) . a, I can write b . a + c . a. So, here I


can write that multiplication dot is distributive over addition. Now, we can write two
other properties that this is called the cancellation property that I can write that if a . b =
a . c implies b = c if a ≠ 0 if a ≠ zero. Now one another is idempotent property that is a . a
= a and a + a = a.

So, normally these are the properties and two operations a plus and dot we define, then
these are the properties we will study on the set A. Now, we take some example that how
actually there these properties are hold and identifying those properties we can define
some algebraic systems.

404
(Refer Slide Time: 28:53)

So, one simple example is say the algebraic system say set of integers and the operations
are simple addition and multiplication.

Now, we can see that this satisfies these algebraic system satisfies all the properties that
A1 to A10 all the properties A1 to A10, but not the idempotent property. Now, we consider
another one that another example we consider which it is the, we consider the set of met
2 by 2 matrices, ok. Let me denote say 2 by 2 matrix on integers values M2(Z) are all 2
by 2 integer matrix and the operations are operations are simple addition and
multiplication. That means, my system is (M2(Z), +, .).

Now, you see that addition under addition all the properties that means it is closure
associative commutative identity elements is also there that. So, it will be up to A5. We
see that M2(Z) if I consider plus, that means this algebraic system satisfies all the
properties that up to A9, the distributive element because I am reading all the properties
A1 to A9 here with respect to addition the identity element is element is 0 because if I add
if I take say 2 4, 3 1 plus 0 0, 0 0 I will be getting element wise addition.

So, this is 2 4, 3 1 then with respect to multiplication the identity element is 1 0, 0 1.


Since if I multiply 2 4, 3 1 to 1 0, 0 1 simple matrix multiplication, we will be getting 2
4, 3 1 now the inverse also exists.

405
(Refer Slide Time: 33:25)

The inverse element with respect to addition this is say if it is say 2 4, 5 3 the inverse is -
2 – 4, - 5 - 3 because this is the my additive inverse.

Now, in this way we can see that it is commutative it is under addition and some
multiplication, but only the cancellation does not hold. Cancellation means our property
in it. Why that property it in that is cancellation does not hold since if say if a is 1 2 by 2
matrix say it is 0 0, 0 2 and I consider b is something called 1 2, 5 6 and my c is 7 8, 5 6.

Now, see that if I multiply A B, then this A is 0 0, 0 2; B is 1 2, 5 6 and this equal to this
is 0, then this is also 0, this is 0 2. That means, 0 into 1 2 into 5 10 doing then this is 10
and 12. Similarly if I get A . C, then it is 0 0, 0 2 dot 7 8, 5 6, then I also get 0 0 and 10
and 12. So, I get A . B = A . C, but we see that then also B ≠ C, even my a ≠ 0, a ≠ 0.

So, cancellation property this cancellation property does not hold here and idempotent
does not hold.

406
(Refer Slide Time: 36:21)

So, if I take another example say the if we consider the power set of S, we know the
power set of S we denote P(S) and the two operations we said the union and intersection,
the sum and product. So, the union and the intersection, ∪ and ∩, then our φ , the null set
or empty set. Empty set is the additive identity and the set itself S is the set itself is the
multiplicative identity.

However here there is no additive inverse exist. That means, these additive inverse is the
inverse element that A5. So, there is no A5. So, in this way we can actually, so this is that
A5 is not there. So, in this way we can identify the different algebraic systems and what
are the properties they hold.

So, in the next lecture we will try to identify that our many common and popular
algebraic systems and we will see that what are the general properties, they hold.
Actually the properties they are satisfying based on these that actual the algebraic
systems are defined and then, we will study their properties also.

407
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 47
Algebraic Structures (Contd.)

So, in the last lecture, we have defined the algebraic systems, the Algebraic Structure and
we have seen the general properties of the algebraic system. Now, in this lecture we will
define some few algebraic systems and normally we use in real life problems.

(Refer Slide Time: 00:54)

Now, so, again I can write that we will be reading the algebraic systems. So, the first
algebraic system we will read or the simplest one is the semi group. So, this is the
simplest algebraic structure. So, we define the as the algebraic system. Let this is a non-
empty set is S and the operation only one operation we consider here is ‘.’, the binary
operation is a semi group where we write where S is a non-empty set and ‘.’ is a binary
operation which is associative.

That means, if it is a semi group it satisfies the property of the following two properties it
satisfies; that means, it satisfies the property of A1, the closure; that means, if a, b ∈ S
then a . b ∈ S and property of A2; that means, the associative; that means, if a, b, c ∈ S

408
we remember that associative is a . (b . c) is (a . b) . c and this is for all a, b, c belongs to
for all a, b, c ∈ S.

(Refer Slide Time: 04:41)

Now, normally this semi group is used to study the formal language, the finite state
machine, Boolean algebra so, it has a number of applications. So, semi group is used to
study its application area. The formal language, a finite state machine and the application
of arithmetic say since we are taking the multiplication as separation so, any arithmetic
operation associated with multiplication we can use this thing.

Now, I define another simple algebraic structure it is called the monoid again it is a non-
empty set or I can tell that it is a semi group with the identity element. See we will in this
study we will try to add more and more properties the algebraic system holds. So, in this
way if I define that means it is closure it is associative in addition it has one identity
element.

So, I can write that it is a semi group, it is a semi group with an identity element; that
means, it satisfies A1 properties A1, A2 since it is a semi group and A3 the or A4 we
wrote that if I tell that it is identity element is A4 as in the last lecture we have done. So,
this is the identity element exists, identity element e say I am writing one identity
element e in m where a . e = e . a = e, where for all a ∈ M.

409
So, normally this monoid we denote as M, e or give the operation if my operation is dot.
So, M dot e whereas, earlier the semi group we write as we denote as simply S dot. So,
we define two very simple type of algebraic structures. Now, we see some of the some of
the examples that it holds ok.

(Refer Slide Time: 09:48)

We take one example. So, we consider the set consider the set of integers say Z and
operation plus addition multiplication subtraction and our division, ok. Now, see if I
consider only the closure and the associative property; that means, closure consider only
the closure; that means, my A1 and associative property that is my A2. Then it is closed
the closure property holds; that means, closure holds for addition multiplication and
subtraction, but it is not closed under division.

Since, if a and b are two integers; if a and b are two integers; that means, a, b ∈ Z then a
+ b ∈ Z. Because a + b is integer a . b is integer a - b is also integer, but a / b may not be
an integer. So, closure property does not hold for division. So, closure property it is not
closed under division. So, closure property does not hold for division; hold for division.

Now, if I consider my associative. Now, associate again it is associative for addition


multiplication and subtraction. So, I can tell that it is a semi group; that means, Z plus
then Z multiplication, then Z is subtraction all are semi group. But, say I can write here
that Z division is not, is not a semi group; since closure property does not hold. Now, we
see another example of earlier we have seen that what about the odd integers.

410
(Refer Slide Time: 15:25)

We take example 2, consider set of odd integers and operation is simple addition then it
is not the, or closure property does not hold. Since the sum of two odd integers are even,
since the sum of two odd integers is even and which is not in the set because we have
considered the set of odd integers. So, it is not a semi group; so, it is not a semi group.

Now, we consider all another example we consider that for a matrix. See if we consider
set of m x n matrix; set of m x n matrices and the matrix addition operation is say matrix
addition. So, I can write the system is A or Amxn matrix or m I can, it takes it can take the
real values. So, I can write it is a real matrix and an operation is addition. So, this is the
system we consider.

Now, it is a semi group; it is a semi group since it if we add it is a semi group since if we
add 2 m by n matrices; that means, if I add a I take two different matrix a x m by n plus
Ymxn then I will be getting some matrix a Z which is also m x n I will be getting a matrix
Zmxn. Here X, Y, Z ∈ Amxn.

And, we know that it under addition that it is also associative because if I add X plus
now, if I write that X + Y + Z will be get getting X + Y + Z. So, these are.

411
(Refer Slide Time: 20:13)

If instead of addition if we consider subtraction; if we consider subtraction; so, instead of


addition if the operation is subtraction say matrix subtraction then also it is a semi group,
but if we consider the operation as the transpose matrix transpose. It is a matrix
subtraction ok; consider the operation as matrix transpose then transpose of Xmxn;
normally we write that thing as it is denoted as X transpose, XT. So, XT if it is dimension
m x n that will give you that some Ynxm

Now, see the order is changed this becomes n x n. So, X ∈ A because A is the set of all
m x n matrices, but Y ∉ A, since A is the set of all m x n matrices. Since, but Y is a, n x
m matrix; so, Y ∉ A. So, it is not closure. So, that means, closure property does not hold;
so, closure property does not hold. So, it is not a semi group; it is not a semi group. This
is the closure property does not hold for this thing.

Now, if it is not a semi group then; obviously, it is not a monoid. Since the monoid we
have defined as the, a semi group with an identity element.

412
(Refer Slide Time: 23:48)

So, now we see another different type of example, say we consider the set of permutation
of two of a two element set.

Consider set of permutations of a two element set A; say the elements are {1, 2}. So,
mainly the operations here because remember this we told that this can be a function, this
can be transformation, this can be a mapping. So, we have considering here as if this is
the set and that all the permutations we are taking. So, the permutations we define say
like say f1, I define as if 1 2, 1 2. So, this is my permutation.

Now, other permutations possible are f2 is 1 2, 1 1; f3 is 1 2, 2 1 or 2 2 and f4 I take 1 2, 2


1. Since, I have only two element set 1 2, so, with these two elements I can get 1 2, 2 1, 1
1, 2 2 these are the combinations; that means, these are my permutations. So, this
permutations is 1 2, it will permutated to 1 2 only, it is permutated to 1 1, it is permutated
to 2 2, it is permutated. So, these are the only four possible permutations possible. So,
these are my set, these are my set of permutations, ok. So, my set of permutations these
are my sets are f1, f2, f3, and f4.

Now, we see that which class of algebraic system it forms. Now, we first define a
operation, we define a operation dots like define a operation dot such that it will take let
us say I give say 1 2, 1 1 dot 1 2, 2 2 I take this operation; that means what? 1 2, 1 1 is
my f2 and 1 2, 2 2 is my f3 as if.

413
Now, permutation this will be permuted that see if it is 1 2 1 is permuted to 1 and here 1
is permuted to 2. So, I give this is 1 2; 2 it is 1 and then again 1 it becomes 2. So, this is 2
2. So, that 1 2 2 2 is my f3. So, it becomes f2 . f3 is f3. So, the dot operation we define on
these permutations like this, then see that if I do these operations we made on other
elements since we have f1, f2, f3, f4 that four permutations possible.

(Refer Slide Time: 28:53)

So, first we see that if we made f1 . f2; f1 we have done 1 2, 1 2; f2 we have given 1 2, 1 1
and we will see the way we have defined it is 1 1. So, this becomes 1 1; 2 2, 2 1 so, 2 2 2
1; that means, it is f2 only. So, f1 . f2 is f 2. Similarly, if I do the f1 . f3 I will be getting f3 ,
f1 . f4 I will be getting f4 only; that means, that is the f1 = 1 2, 1 1 is the identity; is the
identity element.

Now, if I complete all the operations under this dot we have defined; so, I have f1, f2, f3,
f4 with these dot operation just we have defined on the permutations of two elements set
then I get since, f1 is the identity. So, f1 . f1 it will f1, it is f2, it is f3, it is f4.

Now, f2 . f1, if I because f1 is the identity. So, I will be getting this is f2 only f2 . f2 if just
we do f2 is 1 2, 1 1. So, 1 2, 1 1 dot 1 2, 1 1; this give 1 1 and then 2 1, 1 1 so, this
becomes 1 2, 1 1; 1 1, 2 1 is the f1 f2 1 2, 1 1 is the f2. So, f2 . f2 is f2 only. So, in this way
if I can fill up that I will be getting this is f2 this is also f2 . f2 is f2 then f2 . f3 is f3 and f2 .
f4 is also f3. I see f2 . f4 if we do f2 is 1 1, f4 we have written f4 is 1 2, 2 1. So, this will be
say 1 1, 1 2; that means, this becomes 1 2 then 2 1, 1 2 so, 2 2, 2 1 1 2. So, this is 2 2.

414
So, it is f4. Now, this is f2, this is f3. So, you have given it is just a minute, f2 we have
taken f2 we have taken 1 2, 1 1, f3 is 1 1, 2 2; f3 is 1 3, 2 2, f3 is 1 2, 2 2, this is 2 2, this is
2 2. Then this is 1 1, 1 2; 1 2, 2 1 2 2. So, this is f3 only. Now, this is f3 only. So, f2 . f3 is
f3; then f2 . f4 is also f3, ok; f2 . 1 2, 1 1 and f4 was 1 2, 2 1 and that becomes 1 2, 2 1 just a
minute f4 what is f4? f4 is 2 1 ok. So, this becomes 2 2. So, that is also f3.

So, this is f1 f2 dot f4 that is it that is also f3. So, we have given this is f3. So, now, in
similar way if I do then I will be getting a this is already we have done f3 f1 this becomes
f3 then this is f2 we have done then f3 f3 is f3 and f3 f4 will get f2 and then it is f4 f1 is f4; f4
f2 already we have done f4 f2 is f3 or we will just do the f4 f2 f4 is 1 2 1 2 2 1, this is my f4
and I want f2 so, 1 2, 1 1; 1 2, 1 1. So, this becomes 1 2, 2 1; 1 2, 2 1 and then 2 1, 1 1;
so, 2 1. So, this becomes also 1 2, 1 1. So, 1 2, 1 1 is f2. So, this is also f2. So, this
becomes f2, then this becomes f3 and this becomes f4, f4 this becomes you will see that f4,
f4 is 1 2, 2 1; 1 2, 2 1. So, this becomes 1 2, 2 1; 1 2, 2 1; 1 1 2 1 1 2. So, 2 1, 1 2 this is 2
2. So, this is my f1 only, 1 2, 1 2 is my f1 only, ok.

So, this is my hope we get this operation in this. Now, what you see from this? That
means, it is first thing is it is closure because I have the set only f1, f2, f3, f4 when we
operate this thing on dot then we get again f2, f3, f4 .

(Refer Slide Time: 37:35)

415
So, we get that it is closure, then identity element is there; identity element is also there
is f1 and it is associative then the system of the algebra with algebraic system is a
monoid.

Since it has a and we can see that associative property also, we can see that it holds the
associative property; that means, if I can do that f1 . f2 . f3 we will see that just from the
previous thing that f2 . f3 is f3 f2 dot f3 is f3. So, f1 . f3 which is f3 only. Now, if we dot f1 .
f2 . f3 since f1 . f2 is f2 only and this is f3. So, I get f3. So, if it gives me the associative
property, ok. So, we get a system that is set of permutation of two elements set which is a
monoid and obviously, that is a semi group.

416
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 48
Algebraic Structures (Contd.)

So, we have read two simple very simple algebraic systems. And some examples also we
have seen that how they are satisfying the property particularly we have used the closure,
the associative and the identity element.

And then how they are forming the semi groups and the monoid. Now there are some
variant or again some subset. Because whatever algebraic system mainly we have
defined that it has a non empty set and the operations are operating on this set.

(Refer Slide Time: 01:19)

So, how they behave when we will consider a subset of the set? So again algebraic
system we will read. And mainly will consider the subset of the set of the algebraic
system and then we will try to get them find some more properties. So, first since now
we know the we have read the semi group and semi group now if I quickly summarize it
has the property of closure and associative ok.

And monid we have seen the closure associative and it has some identity element
identity exist I write identity element exist. Now we define a sub semi group because for

417
both these cases we have considered a set and we have given examples. So, now if how
we define it sub semi group or sub monoid. So, first we define a sub semi group.

Let S be the non empty set and star is the operation the a * b, a semi group and T is a sub
set of S then T is called a sub semi group of (S, *). If T is closed under the operation star
so as the name is sub semigroup only we are taking ones subset of S. And the only
condition is that this subset must be closed under the operation star. Now similarly if we
define the sub monoid.

(Refer Slide Time: 04:53)

So, again let (M, *, e) normally we write M by monoid we give the notation M say (M,
*, e) be the monoid under operations star the operation star. And let T is a subset of M
then T is closed under * and the identity element also exists. That means, e ∈ T. Then we
call that then is a sub monoid of (M, *, e).

Now we can take our example of that sub monoid we take that set of integers. consider
set of integers set of we take consider set of set of positive integers Z+ and the operation
is addition. Now already we have seen that Z+ under operation e and my identity element
is additive identity is 0 this exists so this is a is a monoid.

Now let a be the set of odd integers set of odd integers. That means, that is A is 1 3, 5 7
like that. So, A is a subset of Z+ on set of what positive integers set of odd positive

418
integers we have taken. Now see if we consider the set A that is on that is only odd
integers. So, it does not have any identity element. So, since it does not contain 0.

(Refer Slide Time: 10:43)

So, a of the subset A as all does not contain 0. So, there is no identity element. Again it is
also not closed, again is also not closed under addition. Since if we add 2 odd numbers
then the result is even and which is not an element of A.

Since A is the set of odd integers. So, neither it satisfies the closure property not even it
has no identity. So, it does not satisfy the closure property or it does not have any
identity or some additive identity. The first thing it is not a semi group sub semi group
not a is not a sub semi group not also not a sub monoid not a sub monoid.

Now we have seen the defined that a monoid that mainly it holds the property of closure
associative property and it has it must have some identity element. Now, it holds some
other property like there are some variant of monoid we call that is a cyclic monoid. And
it is very important in some real algebraic systems. So, first we define what is we call
that cyclic structure so.

419
(Refer Slide Time: 15:05)

If it is a the cyclic property we can tell see if we can it is as a algebric system it has a set
and if there exists one element in the set such that the other all other elements can be
generated from by taking the power of that particular element then it is called a cyclic in
nature. And that particular element is called the generator of that system the algebra.

Like we tell that if say a if we consider a set A if we consider a set A. And element and
then element A belongs to A. Then the all powers of a if we take all the powers of a or a
then say a x a2 x a3 like that; that means, say some an, it am. And obviously, operations I
am taking as the multiplication operation is multiplication.

Now, if the set A contains all these elements say a2, a3, a4, … an or en then actually we
using this a taking the power we can generate all other elements. So, in that case this is a
this is this has some cyclic property this is have some cyclic property. And a is the called
the generator general is called the generator. Now we define the cyclic monoid.

420
(Refer Slide Time: 18:47)

So, we can define the cyclic monoid. So, I can write that a cyclic monoid just now the
way we have defined that algebraic system only now algebraic system we are
considering a monoid. So, it is M star e in which every element of the set M can be
expressed as some power of a particular element that belongs to M also obvious
particular element a ∈ M.

Then I can write that x if x ∈ M then x = some am, ok. So, this is my definition of cyclic
monoid some power of particular element A such that if x ∈ M the x = am some power
and m belongs to some integer. Now if x, y ∈ M. So obviously, we can write that x = a m
and say y = an.

Then I can write that x * y that is am x an is am+n is an x am this is y * x this star is the
multiplication we are writing. So; that means, it is competitive in nature x * y we get y *
x it is commutative. Now we see this is this is cyclic monoid.

Now there are in real life we use there are many applications in GL algebra that actually
it satisfies this property of cyclic monoid. We see one of the examples that our module
operation is very popular in many algebra that and many application areas like coding
theory cryptography and that is actually it holds it satisfies or any system under this
modulo operation this becomes algebraic systems like cyclic monoid we take one
example of that take one example.

421
(Refer Slide Time: 22:39)

So, let S be n a set having 2 digit elements; that means, {00, 01, 02, …, 99}. Although
we write 00 is 00, 1 is 1, but just for symmetry we are writing this way. Now the
operation we consider is modulo 100. That means, what is this operation the module 100
is if I take one element or some number if I divide it by 100 we will be taking only the
remainder.

Since 100 is 3 digit number the least 3 digit number. So, though if I take the remainder
the remainder can be only up to 99; that means, it is closed. So, this is modulo operation;
that means, it tells that modulo 100 is the operation that if one number is divided by 100
it will give will consider the remainder with the remainder of 2 digit numbers 2 digit
numbers. That means, again 000 to 999.

So, now, the we have to check that we will check the first is if (S, *) is abelian monoid.
Here abelian here abelian monoid abelian means it is commutative abelian monoid if it
satisfy the commutative property. If it is commutative property it satisfied then it is a
abelian or commutative monoid commutative property.

So, we have to check whether (S, *) is an abelian monoid. Then find the identity element
and we see the cyclic monoid generated by determine the cyclic monoid generated by
say some numbers 07. So, with this example and; obviously, here with this example we
see there some more properties of the monoid and this star here we consider the star is

422
the operation of means the modulo 100. Star is the operation modulo 100 for this
example ok. So, first we see now what is the identity element, better we see them b first.

(Refer Slide Time: 28:39)

Since my set is S is 00, 01, 02, like 99 to all two digit numbers. And my operation is star
which is we take that modulo 100 this multiplication and then we take the module 100.
So, 0 so if I take the multiply with 01; that means, if I take a two digit number we
multiply with 01 and divide it by 100 take the remainder; that means, module 100 will be
getting a only.

Since (a, *) 01 is a and that is it and a ∈ S; that means, a is a 2 digit number. So, 01 is my
is my identity this is my identity element. Now if we call so this is actually my b answer
of b. Now we check whether it is the first question was what is the what is the abelian
monoid? That means, whether it is a commutative or not? So, first thing is it will be
closed it has some identity we have to see whether it is associative or not it has identity.

Since 100 is least three digit numbers. So, always the remainder; that means, some
number modulo 10. I take the n modulo 100 n modulo 100 is 00 to 99. So, it is closed
then whether it is associative or not it is closed. Let us check the associative property?
So, if we consider 3 elements a, b, c of two digit numbers belongs to S.

423
(Refer Slide Time: 32:37)

Now since it is closed so if I consider say first (a * (b * c) modulo 100)) modulo 100.
That means, I am taking first I am considering I am multiplying b and c and all my a, b, c
two digit numbers. So, since it is closed so (b * c) modulo 100 again it will be giving a it
will be giving another two digit number say d. So, let (b * c) modulo 100 is d.

Obviously, d ∈ S because it is closed. So, this becomes now (a * d) modulo 100 and say
(b * c) modulo d and let the a star modulo (a * d) modulo 100 is e. So, say my result is e
here all that e ∈ S. Now, we see that since it is associative property. So, first I do the a
star b, ((a * b) modulo 100) * c) modulo 100. Now since we are getting this (a * b)
modulo 100 we are taking the last two digit numbers last only the remainder.

And again that is multiplying with c we are getting taking the remainder when divided by
100. Obviously, we will be getting and again remainder nice last two digit numbers it
will be e only. We take some examples that say I get now a is, a is 0 5. I take b is 8 9 and
we see de we check then if I multiply a star b ok. I should take another value say c = 0 8.

So, if I take say a star b star c and this modulo 100 is there always. So, then it is I get 5
and if I multiply these 8 and 89 this will be get getting only 12 because divided by 100
modulo; that means, remainder will be 12 so this is 12. Now if I take this modulo 100 it
will be only 60. Now if I do the other way that a star b modulo 100 star c modulo 100.

424
Then I will get a star b is 5 and 89. So, that will be 4, 45 remainder is 45 only 45 and
here it is 6 because my sorry c is 8 c is 8. So, if I take modulo 100. So, 8 into 45 this is
36. So, I will be getting only the two digits. So, this is also if I divide by 100 it will be
giving him my the 60. So, I see that it is also 60 it is also 60; that means, associative
property holds.

(Refer Slide Time: 38:01)

So, what I get that first thing is that for my a part that I see that the system defined here
is closure property it holds associative. It has already we have seen identity 0 1 identity
exists so it is a it is a monoid. Now here we see that if a star b module 100; obviously, is
b star a module 100.

So, it is commutative; that means, it is abelian commutative or abelian. So, it is abelian


monoid. Now c part it is generated by generator is 0 7 generator given is generator is 0 7.
So, if I 0 7, 0 7 modulo 100 since it is only two digits so I will get 49.

So, if it is (49 * 0 7); that means, it is 0 72 if I write in this way. Then again if it is 0 73 I
get the (49 x 0 7) modulo 100 we are taking two digit numbers. So, it will be will get it is
43. Now again if I get 0 7 I write here 49 means actually this is 0 7. I can write this same
thing as the it is as ((0 7 * 0 7) * 0 7) that I am taking power 3 modulo 100.

Now in this now if it is already 43. So, if I write ((0 7 * 0 7) * 0 7). So, actually this will
be this is modulo 100 is actually (4 3 * 0 7) module 100 and this becomes 0 1 because if

425
I multiply. So, 3 0 1 divided by 100 means it will give you 0 1. So, now, again if I
multiplies (0 7 * 0 7) another power if I increase either it was 4 I will be getting. Since
now I got the identity element 0 1.

So obviously, I will be getting 0 1 into 0 7. So, since already I got so it is 0 7 so it is


cyclic in nature. So, what I got first the generator is 0 7. The second it is generating 49
then 43 then again 0 1 and now it will repeat. So, the cyclic the monoid we get a right the
c part.

(Refer Slide Time: 42:15)

The cyclic monoid generated by 0 7 is I should write (0 7, 49, 43, 0 1) and it will repeat.
So, we read monoid and then that there is some other properties that one monoid can
hold. And these type of we can we can see. And we can check that error there are the
general properties that we read that again some algebraic system how they hold.

Like we are just now we have seen the abelian monoid that means it satisfies the
commutativity. Similarly it can be abelian semi group. So, if the semi group satisfies the
commutative property it will be the abelian thing. So, next lecture will again we will
identify some more algebraic systems of the larger algebraic systems and how they
satisfy the properties.

426
Discrete Structure
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 49
Algebraic Structures (Contd.)

We are discussing the Algebraic Structures and we have defined the algebraic systems as
set of finite set of elements which is non-empty and some binary operations or some
unary operations in unit that operates on this set. We have also read some general
properties of algebraic systems, and mainly now what we are doing that we are trying to
identify or to form to define the different algebraic systems depending on the properties
that they satisfy.

We have already read the semi groups and monoids the simplest algebraic systems now
today we will read the group which is the most important algebraic systems or we can
tell the algebra and which have a number of application arrears in almost all the streams
of engineering mathematics in computer science. So, we will read the group today as an
algebraic system.

(Refer Slide Time: 01:50)

Now, if we remember though we have read the general properties of algebraic systems as
the closure property, the associative property, the commutative property, the identity and
the inverse. Now, the semi group and the monoid that we have defined that mainly they

427
followed or they satisfy the property of closures, then associative and if the identity
element it has then it is a monoid otherwise it is a semi group.

Now, group is a you can define that again this is algebraic system which actually
satisfies the all three properties that the monoid satisfies; that means, the closure,
associativity and the identity element it has. Now, in addition if it has the inverse element
then we will tell it this as a group.

So, we define write in that the a group G we give the notation like that {G, .}, as if G is
the set of element and dot is the operation. So, is a set of elements with binary operation
dot that associates to each ordered where a, b of the set G of a element a . b where dot is
the operation that we have defined. So, a . b and that is also in G; such that the following
properties must be hold.

Now, the properties are one that the closure; that means, if a, b ∈ G then a . b ∈ G. Then
associative; that means, if a, b, c ∈ G then a . b . c is same as that a . b . c; 3 is our
identity element; that means there is an element e exists, an elements e ∈ G then for all a
∈ G; a . e = e . a is a only. Now, up to these three properties we have seen and that then if
it holds then we call this is monoid.

Now, in addition if the system has some inverse element exists; that means, for all a ∈ G,
if there is an element a’ ∈ G such that a . a’ = a’ . a ; is the identity element only. Now,
see we have only these properties we have added. This is my added property with
monoid, added over monoid and we tell that then this forms a group.

Now, if the group of satisfies the commutative property also then it is called an abelian
group or the commutative group as we have defined in form monoid and the semi group.

428
(Refer Slide Time: 09:37)

So, if it also satisfies the property of computability; that means, that is the property. I
write that 5, that b dot a equal to a dot b for a, b belongs to G then it is a called an abelian
group or we can tell this is a commutative group.

Now, we see one simple example that if my set is; one simple example you see if the set
is a real number normally we define the denote that is a R and the operation is
multiplication then it is the closed, since if I take two real number and if we multiply that
is also an element of a the set R. It is associative with real numbers the associative
property also holds because in final result is a real number that is also an element of R.
So, this is associative.

Then the identity element exists and we know the multiplicative identity is one,
multiplicative identity is 1 and now, the inverse also exists. Since it is a real number so,
the inverse also exists. So, it forms a group. So, R with multiplication forms an algebraic
system, it is a group.

Now, if instead of this R the real number if we consider the set, now if the set is integers
again positive, negative, with 0 and the operation is multiplication then it is closed,
associative, identity exists that is equal to 1; multiplicative identity 1, but there is no
inverse exists since it is the set of integers. So, but no inverse exists; so, it is not a group.
So, integers so, it is not a group integers with multiplication as the operation it is not a
group.

429
(Refer Slide Time: 16:00)

Now, there are some other simple definition of groups we always we read, one is called
the finite group, finite and infinite group. If the set is finite then it is a finite group and
then the size of the group and in this case if it is a finite group the size of the group is
called the order of the group, is called the order of the group. Now, if the set is infinite
then it is a finite group. So, simply infinite or finite; it actually depends on whether if the
set is finite or infinite. So, if the set is infinite; that means, the set has infinite number of
elements.

Now, if you consider a set A say we consider some properties of group we know study.
We consider is set A equal to say n number of elements it has and the say we say dot is a
binary operation and a dot that means, a set with the binary operation dot forms a group.

Now, the effect of this operation of this operation dot on the elements of or the n number
of elements of A that we can represent by a matrix. The elements of A or I can write on
the n elements of because n element set so, n elements of a can be represented as a n by n
matrix and we will see some properties if it is a group then from directly from the matrix
how we can identify some of the properties group properties.

430
(Refer Slide Time: 20:00)

So, I can write in this way the matrix will be like I can give a1, a2, a3 up to an. We in the
operation we give here and then again a1, a2, a3 and then an and this is we see this is n x n
matrix. If we represent the elements that a1 . a1 that the after operation if we represent
this as a C11, C12, C13, …, C1n, similarly 2 1 then I can write that Cij is ai . aj; that means,
if I consider some Cij here some Cij. So, here I will be getting that ai elements ai is here
and as if some aj. So, Cij is ai . aj.

Now, we identify some properties that each element here since it is a group. So, each
element has an inverse. So, now, you give a property of a group that give a property that,
no two elements in a row or in a column is same. Now, how we can show that thing? See
if I have two elements say assume the two elements are same. So, let two elements Cij
and Cik are equal or same in a row. We consider that in a row two elements are same.
Now what is Cij? Now, Cij is ai . aj and Cik is ai . ak.

431
(Refer Slide Time: 24:21)

Now, if we assume that Cij and Cik are same. Then now if Cij = Cik; that means, ai . ak,
sorry ai . aj is ai . ak. Now, since it is a group so, there exists one inverse element and let
these inverse element is for ai is ai-1. So, we write since it is a group. So, there exist an
inverse element of ai. So, I can write ai-1. ai . aj is in both side we do the operation dot,
then ai-1, ai is the identity element. So, e . aj is e . ak. Since this e is same element e . aj is
e . ak, we know e . aj is aj only and e . ak is ak only because that is my e is my identity
element; e is identity element. So, then aj = ak.

Now, since it is a set, so, no two elements this aj and ak are same. So, since no two
elements of the set a is same; that means, ai, aj ≠ ak . So, Cij ≠ Cik. So, no and similarly we
can proof that for columns also, no two elements in a column are same. So, similarly we
can proof for columns also.

432
(Refer Slide Time: 28:35)

Now, as we have defined a cyclic monoid, here also we can define the cyclic group. The
definition is same. The group is cyclic is a power of an element say a ∈ G and here a is
called the and say the power is like, the power is aK, where K is some integer positive
integer and a is called the generator G.

Now, in property of a cyclic group is already we have this thing we have seen for
monoid and here also it is same that a cyclic group is always commutative in nature; and
maybe finite or infinite. So, we have read some on the definition of group, some
properties of group and we will be continuing the group properties and some examples in
our next lecture.

433
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 50
Algebraic Structures (Contd )

So, we are reading the properties of Group.

(Refer Slide Time: 00:26)

And we identify some more groups; so, Group Theory. See already we have seen that if
A is one set. A is one set with n numbers of elements and one operations dot. So, that my
A dot is from a group. Then, this elements with the operations can be represented by n x
n matrix.

Now and also we have seen that no 2 rows or no 2 columns that are in two elements in a
row or no to element column in identical. We have proved that thing. Now say we see if
n = 2; if n = 2; that means, my set has 2 elements and let this elements are A and B.
These are the 2 element sets and we take the operation is operation is dot and A dot form
a such that A dot form a group.

Now if I this will be 2 x 2 matrix and we see that we what will be the elements of the
matrix. So, we represent like this now see a dot a; that means, I need a since it is a group
it has some identity element and since it has 2 elements only. So, one must be the

434
identity element. So, let a is the a is the identity element; a is the identity element. So, we
can write a dot a is a only. Now since a is identity means a . b is b only. Now similarly b
. a is b only, since it is commutative that property also we have to seen and now if it is b .
b; then, it is b only. b . b is the a because otherwise b, b will be the identity, since we
have already assumed that is the identity element.

Now, if I continue this thing for n = 3. So, if it is n = 3 and my set is a, b, c; the 3


element set. Operation is as usual dot we see and a dot is the group and a is the identity
element. Then, if I give then I have 3 elements, I give dot a, b, c. See a . a since it is
identity a, a . b; b since it is identity, it is c.

Now, b . a it is b only. Now, b . b; b . b I write it is c and b . c, it is a and c . a again c,


then c . b already b . c is a. So, c . b is a and c . c is b. So, I get that the first row is a, b, c;
then b, c, a and then c, a, b. So, with only 3 elements, but no 2 row and in the row no 2
elements in the row or column are equal. So, it holds the property, we have read ok.
Now, we read one examples that see one example of group.

(Refer Slide Time: 05:30)

So, let Zn equal to {0, 1, 2, …, n - 1}; that means, there are n elements set Zn is an n-
element set and we denote this operation is a modulo operation is a mod operation of
additive modulo n and then, will say whether it forms a this set whether we check,
whether Zn with modulo operation; whether this forms a group or not ok. Let we
consider or we assume n equal to 7; that means, my Zn is {0, 1, 2, 3, 4, 5, 6} since I will

435
be taking modulo 7 that my operation is operation is modulo 7. If you remember that
modulo 7 means the number we if we divide by 7, we will be taking the reminder it will
give that.

So, if you divide by 7 the reminder can be from 0 to 6 and that is my set. So, if I draw the
group operation or the effect of this modulo operation on the set Zn in matrix notation
just now what we have read. So, it will be the give 0, 1, 2, … this is my modulo 7
because my set is upto 6. There are as upto 6 elements. Now if I because it is additive
modulo, mod operation this a additive modulo n additive modulo n; that means, every
time we will add and will be dividing by 7 and taking the reminder. That means (0 + 0) /
7. Obviously, it will be 0 then 0 + 1. So, since 0 is my identity element. So, I will be
getting 1, 2, 3, 4, 5, 6 because all are less than 7. Now, since it is for I, 1 + 0 is becomes
1.

Because 1 / 7 reminder is my 1 modulo 7 is 1, 2; then, this because 3, 4, 5, 6. Now, 6 + 1


is 7 and if I, 7 modulo 7 if I take that becomes 0 because reminder 0. So, I give here 0.
Now, 2 + 0 is 2; 3, 4, 5, 6. Now again, 5 + 2, 7; 7 modulo 7 becomes 0. Now, 6 + 2, 8; 8
modulo 7 becomes 1. Similarly, we can fill up 3, 4, 5, 6, again 7 become 0; 8 becomes 1;
9 becomes 2. Then, 4, 5, 6, 7 becomes 0; 8 becomes 1; 2 this becomes 3. 5, 6 then 0, 1, 2,
3, 4; now, this 6 and now it becomes 4, 6, 6 12; 12 modulo 7 is 5. Now, we see we once
you got the or the effects are the operations of modulo 7 of the set Zn; then, we see that
my if I study then my matrix element are only 0 two 6.

So, first thing is that it is, it holds a closure property. So, the closure property holds
because my matrix elements are also elements are from lies between 0 to 6. Now,
associative since it is addition. So, if I take any we can take a is 4, 5, 6; that means, a
equal to 4; b is 5 and c is 6. So, I can take 4, 6 this is equal to 5, 6 11. So, this is this
became 11 modulo 7; 11 modulo 7 is 4, and 4 modulo 4 8.

So, 8 modulo 8 modulo 7 is 1. Now, if I take 4 modulo 5; then modulo 6. So, 4, 5 this
becomes 9 modulo 7 is 2; 2 modulo (6 + 6) modulo 7; that means, 8 modulo 7 that is also
1. So, I have it this is equal. So, it forms a associative property. So, it holds associative
property. Now, the 3 is identity element identity since it is additive modulo 7. So,
identity exist and equal to 0 and inverse, this is that since it is additive.

436
So, inverse is sum minus a since it is additive modulo 0. So, we can take that if I take we
will be getting some a and -a is equal to the identity element e; that means, e minus a 0,
this will be my and it is my identity equal to 0. So, inverse exist. So, it forms a group. So,
it is a group no service.

So, my answer is it is a group. So, additive modulo 7 or additive now, we can generalise
that additive modulo n on the set Zn 0, 1 to n - 1 in n element that it will be a it always
forms a group. Now, we see another property of group already we have defined the sub
semi group sub monoid and similarly we can define the subgroup.

(Refer Slide Time: 16:00)

So, we will define similar way we can define the subgroup, if you remember that if T is a
subset of S; where say (S, .) is a group and T is closed under the operation dot T satisfies
the associative property or and now the 2 property that identity and the inverse element
that and the if e is the identity element of S since it is a group. So, it has some identity
element; then e belongs to, then e ∈ T.

Then, if e ∈ T and about the inverse that there exist an inverse element a’ for all a ∈ T
such that a’ ∈ T. Then, T is a subgroup of S; T is a subgroup of S. Now, we read two
properties; we actually define and then we will a give a theorem on this that it is called
the Cosets and the Lagranges theorem on this.

437
(Refer Slide Time: 19:31)

So, first we will define Cosets. So, let T be an algebraic systems and dot is the one is a
binary operation. Now, let a belongs to T and H is a subset of T; then the left coset of H
is defined as and always the coset is defined with respect to one element of T the original
set here it is T. So, let us left coset of H in respect to a is, a . H; a is a dot H that is I can
write a dot since H is a sub set. So, I can write a dot H equal to all the elements a dot x,
where that all x belongs to, all x ∈ H and dot is the binary operation that we have chosen.

Now, similarly the right coset of H in respect to a is H dot a that is we can write H . a
again since for all x element a and x ∈ H. So, this is the 2 things the left coset the left
coset and the right coset of H; H, where H is a sub set of T. Now, we give a property on
this one property we write on cosets.

So, let a dot H and b . H are set two left cosets of H or some time we call cosets of H.
Then, either a dot H and b . H are distinct or they are identical and we can easily prove
this property from earlier matrix representation and that what we have identified some
property that no 2 elements in the row or in the column, they are equal and another thing
we always remember that since it is a set. So, it is a distinct element; also if they are they
either will be distinct or they are identical if they are not.

438
(Refer Slide Time: 25:21)

Now, we read the Lagrange’s Theorem. Now, Lagrange’s theorem tells about a of the
property of the order of a group. If you remember the order we have defined that the size
of a group and the group must be finite otherwise there is no concept of a size. So, it can
write that any group the any group of prime order. So, it tells about the order and any
group of prime order is cyclic and any element other than the identity element is a
generator of that group, since it is a cyclic group. So, it has some generator and other
than identity element every element any element can be the generator that means that is
if we take the power of that particular element, it will generate the or it will produce the
other elements.

So, this is very important when we will study some algebraic systems. Another thing is
always that this is it also forms a Abelian group that it also follows it also follows the
commutivity; that means, it is always an Abelian group. So, we can write that any (T, .)
is a group and a not equal to the identity, then an a ∈ T. Then, a is the generator of the
group. So, we have read the definition of group and the some properties and some
theorems related to the order of the group. Now, since we have started our discussion
with the algebraic structure and we have defined like that we have a set and operation
defined on it and if you remember then that some relations on this function that gives
you the algebraic structure.

439
Algebraic system is a set with the operation and then in addition if you consider some
relations on this, then it will give algebraic structure. So, now, when we define the
algebraic structures; so the relation between the one algebraic system to another
algebraic system is very important and that we define with something call the
Homomorphism and the another some other variety of Homomorphism.

(Refer Slide Time: 29:48)

So, we define the mainly the two there are other varieties also the Homomorphism and
another important is the Isomorphism. Homomorphism and Isomorphism the we will.
So, that if two algebraic systems are isomorphic, then they are structurally similar.

So, homomorphism and isomorphism of it will give the definition that let since it gives a
relation between 2 algebraic system. So, I consider 2 algebraic system (X, .) and say (Y,
*); these are the two algebraic system and . and * are the two operations. Now, a function
if from one algebraic system from X to Y is known or is called Homomorphism right, we
can write X is for (X, .) to (Y, *), if for sum x1, x2 ∈ x, we can write that the properties
that f(x1), f(x1. x2) the operations defined on x, this is equal to f(x1) operations defined on
y and f(x2).

So, the function is these; then, we call that this is these two are homomorphism between
X and Y and here on we can tell since it is a function. So, you know that if the function is
onto, then the term is epimorphism. Then we then we call epimorphism.

440
If the function is one-to-one; then it is monomorphism; then it is monomorphism and if
the function is one-to-one and onto; onto and one-to-one, then it is Isomorphism. So,
now, it is clear that if it is onto and one-to-one; that means, they are structurally two
algebraic systems, they are same or they are structurally similar; then we can tell that this
is they are structurally similar in the algebraic system and they are isomorphic to each
other.

(Refer Slide Time: 35:22)

We can we can take or we write in a different way that if we write that take one example
that if A on S, O, C and one A’ S’, O’, C’; these are two algebraic systems, then just with
this thing we can write we graphically you can tell that if I take this as S; this is my O; S’,
sorry S x S to S and if I give say some homomorphic thing homomorphism say S’. So,
this becomes S’ by S’, this is something O’. So, this becomes S’ and again, this gives a h.
So that means, here h is h is I can write h is S to S’ and h some 2 elements if I consider a
. b is h a, h(a’), h(b’)the way we have defined and if I consider some constant, then that
constant is h(c) = c’.

So, this is the general definition homomorphism and it will graphically it will show in
this nature. So, the way we started that actually the study of algebraic structures. So, in
this lecture we have reads some algebraic systems like semi group monoid group and
then, the how that form the relation between or the how from one algebraic system to
another algebraic system, we can get by applying some function and based on that the

441
nature of the function whether it is onto one-to-one or onto and one-to-one, we get the
whether the homomorphism that becomes the epimorphism or monomorphism or the
isomorphism. So, mainly our focus is on isomorphic thing whether two algebraic
systems are structurally similar or not. That means, whether they are isomorphic or not.

So, with this we complete this lecture here and in the next lecture, we will again study
some more algebraic systems which a practically utility and they are used in other
different streams of Computer Science and Mathematics.

442
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 51
Ring and Modular Arithmetic

So, we are discussing about the algebraic structures and some general properties of the
algebraic systems we have read. And, now based on the properties that the one set with
some binary operators, they are satisfying, we are defining the different algebraic
systems. We have read the semi group, monoid and group. And, today we will read the
another algebraic structures Ring.

(Refer Slide Time: 01:00)

Now, this algebraic structure ring is slightly different from the other three that we have
read. Normally, the algebraic systems we have defined, that one set or non-empty set
with finite or infinite number of elements and, a binary operator one single binary
operator defined on the set.

Now, for this ring that instead of one operator, that two operators will consider and the
general properties that the commutativity, associativity, closure, that multiplicate, the
identity inverse, etcetera, that we have read. And, we will see that for the two operations
defined on this ring and what are the properties that must satisfy. So, that this algebraic
system we can call a ring.

443
So, ring R is; if I give the definition is a non-empty set of elements with two binary
operations. Normally, we called addition these two operations are addition and
multiplication, but these addition and multiplication may not be our ordinary addition
and multiplication. There are there can be two different operations, but normally we call
them addition and multiplication; such that for call all elements a, b, c ∈ R the following
properties are satisfied.

Now, since there are two operations. So, what are the properties based on these two
operations that we identify. So, first thing is that this is an additive commutative group.
Ring is a additive commutative group. So, it can write the ring; so, obviously, since it is a
group so, the property of the group that group satisfied; that must be satisfied.

So, we write the group properties we remember, that it must satisfies the closure. So,
since now we have two operations. So, closure with respect to addition. If, we remember
that when we have define the group, then consider only one operation. So, with respect
to one operation say the addition first we are considering.

Then, the, it should be the associative; it must hold the associativity. So, it is associative,
then the additive identity exists and if it is a group, then there must be additive inverse
also. So, additive inverse also exist. Now, it is a commutative group; so; though it must
hold the commutative property. So, now, commutative property holds.

So, if we quickly write that closure we remember that if a, b ∈ R, then a + b ∈ R.

So, the notation we are taking that plus and star. So, the ring we are defining (R, +, *).
As it plus is addition and star is multiplication. Now, if it is associative then a, b, c ∈ R
with respect to addition. So, we write (a + b) + c is a + (b + c). Now, additive identity
exists. So, if e is the additive identity, then a + e = e + a = a only. Additive inverse exist;
so, we know that a plus, if a’ is the inverse of a, is a’ + a = the identity.

Now, if it is commutative property holds, then a, b ∈ R, a + b = b + a. So, this is only the


a. Ring is an additive commutative group in addition the sum of the properties so, with
some additional properties some additional properties. Now, what are those properties?
So, these are only with respect to addition.

444
(Refer Slide Time: 09:18)

So, in addition we write it is continue the properties. Now, we remember there are two
binary operators when we are discussing the ring. So, now, we considered the
multiplication operation.

So, again this 6 property will be the, it is closure property, closure with respect to
multiplication, than it is associative with respect to multiplication. Now, it is distributive
in nature. Since, we have two operations. So, now, this is distributive property holds.
Now, these are the three additional properties. So, since we have taken the star notation
for multiplication. So, if a, b ∈ R, then a * b ∈ R. Now, associative so, a, b, c ∈ R then a
* (b * c) = (a * b) * c.

Distributive property holds; so, we take that multiplication is distributive over addition.
So, a * (b + c) = (a * b) + (a * c) or I can write that (b + c) * a since it is ok, we write the
two operations that I can write (b * a) + (c * a). So, these are the three additional
properties over additive commutative group that makes an algebraic system ring; this is
my ring. So, give simple example that where this property holds.

So, let Z is a set of integers, R is a set of real numbers and C is a set of complex
numbers, then the two binary operators or operations defined on this sets say Z, or R real
numbers or complex numbers will satisfy all the properties, this satisfy the properties.
Just now we discussed that the commutative group, additive commutative group and the
though with respect to multiplication the closure associative and distributive. Now, I can

445
write that 1 to 8 that we have discussed. And, so, each one; that means, (Z, +, *), (R, +,
*), C the complex number (C, +, *) forms a ring.

And obviously, when we are considering the complex number; the multiplication is the
multiplication of between multiplication two complex numbers, or addition of two
complex numbers. Now, here the addition or the additive identity is 0 and additive
inverse is of additive inverse of x inverse of x is - x. Normally, we will take like that.

(Refer Slide Time: 16:36)

Now, we consider another example of different type. Say we consider a set of matrices; 2
by 2 matrices. So, let M2(Z) is the set of 2 by 2 matrices or integer matrices; that means,
matrices of interior elements. The two binary operations on the set are matrix addition
and matrix multiplication.

So, quickly we see that what is matrix addition; 2 by 2 Matrix; so, we consider the, say a
b, c d plus e f, g h. And, this is equal to; it is; we know the matrix addition is defined as
the sum of element wise addition or the sum of elements; that means, a + e, b + f, c + g,
and d + h.

Now, how we define the matrix multiplication? If, I take the same matrix a b, c d, now I
take multiplication; then e f. g h equal to we know that ae + bg, then af + bh, ce + dg, cf
+ gh, this is my matrix multiplication. Now, if we see that then I can write my matrix or
additive identity; matrix addition if we consider, then with respect to the operation

446
addition; that 0 0, 0 0, this 2 by 2 matrix is the additive identity. Since, if we add element
wise 0 then I will be getting the same matrix, now this is additive identity.

Then, what is additive inverse? That; we know that a plus; a + a’ = e; that means, if I take
the 2 by 2 matrix is a b, c d, then my - a – b, - c - d is equal to give me 0 0, 0 0. So, - a - b
is my additive inverse, - a – b, - c - d is the additive inverse of a b, c d.

So, if I now seems the element wise it is the addition and our normal addition is closure
property holds. So, obviously, for addition also matrix addition also the closure property
holds.

(Refer Slide Time: 22:29)

So, if I continued; so, since matrix addition is the ordinary addition of elements matrix
elements. So, we can see that; so it with respect to addition, I should tell that matrix
addition, The closure property the associativity, and commutativity are satisfied.

So, already we have seen that it is additive; that is it is matrix addition is or the set of 2
by 2 matrices with respect to matrix addition is the additive, commutative group. That
we have seen when we have studied this example as an example of a group.

Now, what about the matrix multiplication? So, matrix multiplication if we see, then
multiplication is defined as a multiplication, ordinary multiplication and addition. So,
closure property holds. So, if we consider the matrix multiplication, matrix

447
multiplication, inverse ordinary addition, and multiplication of elements integer, because
we have considered the integer matrices; multiplication of integers.

So, the closure property, the associativity are satisfied. Now, since it is multiplication.
So, the multiplicative identity, multiplicative identity is sorry we have not yet read that
the distributive properties, we have to with respect to multiplicative operations of the
multiplication matrix multiplication, the distributive property also holds. So, it forms a
ring.

But, one thing we observe or we notice, that if we take say one example that 2 matrix; 2
by 2 matrix of like say 1 2, 1 1 and 5 6, 4 0. If, I do the matrix multiplication we get 1 x 5
+ 2 x 4 that is 13, then 1 2, 6 0 that is 6, 1 1 this is 9 and again this is 6. Now, if we take
the 5 6, 4 0 same matrix in different order; that means, a b and b a. So, 1 2, 1 1 then we
get that 5 + 6, this is 11, then this is 10 + 6 it is 16, 4 0. So, this becomes 4 and this
becomes 8.

So, what we see that this a b, if I consider that a is a 2 by 2 matrix and b is a 2 by 2


matrix, this is a star b and this is we take b and a. So, this is my b * a and these two are
not equal.

(Refer Slide Time: 30:02)

So, what we can conclude that though if a b or bit error rate with respect to my matrix
multiplication, this is not equal to b * a. So, it is not commutative. So, that means, if the

448
if we want a commutative rings, then we have in addition we have to make that this
property should hold. So, here actually here a, b belongs to M 2 Z ok. So, if I add then
that the ring also holds; that means, if earlier we have seen that the ring holds the 8
properties. Now, if we give as if this is a ninth properties that if a * b = b * a ; that
means, with respect to; with respect to the operations multiplication, may or may not be
the original multiplication ok. And a, b ∈ R, then it is a commutative group;
commutative ring, then it is a commutative ring.

Now, if we add some more properties with respect to multiplication. So, I see that; see
with respect to multiplication we are considered closure, we are considered associative
and with respect to both addition and multiplication, we have considered the distributive
properties, but if I consider say the; if multiplicative identity exists ok. So, if
multiplicative identity exists that is I can write that say some element u ∈ R such that u
not equal to the additive identity say e.

And, a u or it should write a * u since multiplicative multiplication sign we have taken


star, a * u = u * a = a for all a ∈ R; that means, one multiplicative identity exists.

Another property we take that say no 0 devices. This is my property that no 0 devices;
that means, if a, b ∈ R and a * b = b * a = 0. Then, either a = 0 or b = 0. Then if these all
3 all 1 to 11 this property holds. So, if some algebraic systems or I can tell the ring in the
algebraic system satisfy. So, the properties1 to 11, then it is an integral domain it called
an integral domain.

That means over the properties of over the properties of ring, we can add the properties
of that commutativity with respect to multiplication, then multiplicative identity exist
and no 0 devices, then this becomes a this is called that Integral Domain.

449
(Refer Slide Time: 37:01)

Now, if I just take the example that S is a set of integers say positive, negative, and zero,
under addition and multiplication, ordinary addition and multiplication, then S is a ring
first and S is the additional 3 properties also hold. So, S is an integral domain; that
means, it is a commutative ring with multiplicative identity and with no zero devices.

So, we have read the mainly the definition of ring how one algebraic systems, becomes a
R and what are the properties over the group the other algebraic systems that we have
read earlier so that it becomes 18. And, then again the properties over ring, we have
considered some other additional properties with respect to the another binary
operations, that commutativity, multiplicative identity and no zero devices, then this is
making an another algebraic systems or the variant of ring sometimes we called this is
the integral domain.

And, we will read some examples and some more properties of ring in the next lecture.
Because, in real life or in ring has different type of application particularly in computer
science and in mathematics as usual that ring has a number of applications area. So, we
will see some of the properties.

450
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 52
Ring and Modular Arithmetic (Contd.)

See, in the last lecture we have read the definition of ring and mainly the differences of
the other algebraic systems like, semi group Monoid group where the set, a non-empty
set we have considered with one binary operations defined on it. And, then what are the
axioms are satisfied by the set with these options. Ring is mainly different from others
algebraic systems, because it is in it involves two binary operations on the non-empty
set. And, and we have read the, what are the properties that it must hold.

There, we have the two binary operations, we have called the addition and
multiplication, but that are not always the ordinary addition and multiplication it may be
ordinary addition or multiplication.

(Refer Slide Time: 01:39)

So, first we will see one such example, that where the operations are two binary
operations, but not the our ordinary addition and multiplication. So, first we consider the
ring examples; that means one example with two binary addition operations, which are
not ordinary addition or multiplication.

451
So, we consider one example that is trick let say R is a ring R is a, or better I write R
normally the way we write R, I give two operations like that. So, let (R, ⊕, ⊙) I am
telling plus dot be a ring or initially I take that it is an algebraic system with the two
binary operations defined as follows, because I am not taking these are ordinary addition
or multiplication.

So, what are those operations? The operations I am taking that one addition I am
defining that a ⊕ b is a + b - 1. Here, this right hand side of the equation in RHS + and -
are ordinary addition and subtraction, ordinary addition subtraction.

And, the multiplication we defined a ⊙ b is a + b - a b; that means, multiplication. So,


similarly in R.H.S +, - and better I give a dot and “.” are ordinary addition, subtraction
and multiplication. So, the here the plus and dot within circle we have we are taking two
binary operations are define like that. So, they are not simple ordinary addition or
multiplication, but it involves some addition subtraction and multiplication.

Now, we check whether this algebraic system becomes a ring or not. So, check if (R, ⊕,
⊙), if the algebraic system is a ring.

So, if we remember the properties of ring. So, one by one we try to check that thing ok.

(Refer Slide Time: 07:20)

So, we give the solution this is a continuation. Now, first the closure; so, the closure with
respect to addition. So, here addition is this addition. So, this involves these operations

452
involvers, ordinary addition and subtraction. So, it so the closure property holds, that is
that if a, b ∈ R, then a ⊕ b = a + b - 1 ∈ R.

Now, we see that associative property ok. So, this is my I write this is closure then we
see the associativity. So, if a, b, c ∈ R first we see that a ⊕ (b ⊕ c), this becomes a and
this part is a plus, sorry b + c - 1. Again, if we apply we will be getting a + b + c - 1 - 1.
So, this becomes a + b + c - 2.

Now, if we take a + b first and then c, we will be getting a + b – 1, c is a + b - 1 + c - 1 =


a + b + c - 2. So, these are equal, what you see that these two are equal. So, though
associativity property holds associativity property holds. Now, additive identity we see
the so, if say some Z exists such that a ⊕ Z = a, then Z is the additive identity.

Then, Z is the additive identity. So, if I write a ⊕ Z. So, a ⊕ Z = a which implies that a
+ Z - 1 = a that is Z = 1. So, one is the identity of or additive identity. So, one is the
additive. So, we notice that, here these addition in a circle is the addition operations we
are assuming is the additive identity. Now, what about additive inverse?

(Refer Slide Time: 14:15)

So, if we remember the what definition that, if I have some element say inverse element.
So, that a ⊕ a’ equal to my identity and identity becomes 1.

So, what is a dash for some we have to check whether some a dash exists or not for some
a’ ∈ R. So, here a + a’ - 1 = 1, so a’ = 2 - a. So, 2 - a is the additive inverse. So, obviously,

453
for each a, for each a ∈ R, 2 - a ∈ R and it exists. So, the additive inverse also exists. So,
we have seen the closure associativity, additive, identity additive inverse. Now, we have
to see the commutativity with respect to the addition.

So, we see the we will see the commutativity with respect to addition. So, a; obviously, a
⊕ b = a + b - 1 = b + a - 1 = b ⊕ a. So, it is commutative. So, it is commutative. So, we
get that up to this property we holds, it is a, this it is an additive. So, R is an additive
commutative group.

Since till this time we have consider only one operation and that is this addition
commutative group. Now, I have another operation is multiplication. So, now, we check
the multiplication properties or the properties with respect to my multiplication.

And, again we notice that this multiplication is not the ordinary multiplication, it is
actually a multiplied by b means a + b – a; b and that a . b is my normal multiplication or
the product normal product. So, if we remember now with respect to multiplication, we
have to check the first the closure.

(Refer Slide Time: 18:30)

So, this is closure with respect to multiplication closure, with respect to multiplication
then if I take that a, now this time this is my multiplication is, a + b – a . b; so, since a, b
∈ R.

454
So, it is normal ordinary addition and subtraction and multiplication. So, a + b - a . b ∈
R, because +, - and . an ordinary addition, subtraction, and multiplication. Now, what
about my associativity or I can write associative properties with respect to multiplication
with respect to multiplication? So, we write a c this equal to a, this is b + c - b . c = a + b
+ c - b . c - a normal multiplication b + c - b . c

So, this becomes a + b + c - bc - ab - ca + abc; now, if I consider the ordering of


multiplication is changed; that means, (a ⊙ b) first then multiplication c. So, this
becomes if you check this also becomes (a + b – ab) ⊙ c which gives that a + b + c - ab -
bc - ca + abc. So, we see that the these two are equal. So, associativity holds.

(Refer Slide Time: 22:36)

Now, what is my distributive properties with respect to the addition and multiplication
defined?

So, we can write that this is since multiplication is distributive over addition. So, this we
can where a, b, c ∈ R. So, I can write a, and this becomes b + c - 1. This is equal to a + b
+ c - 1, because a + b - ab + c - 1. So, this becomes 2 a + b + c - ab - ac - 1. Now, we see
the if we do the a ⊙ b this becomes a + b - ab, if we take the a ⊙ c, then this becomes a
+ c - ac, now if we these two if we add; that means, ab + ac.

So, this becomes a + b - ab + a + c - ac - 1, because my addition is a + b - 1. So, here this


is a, this is my a, this is my b. So, this becomes 2 a + b + c - ab - ac - 1. So, again we see

455
that these and these they are equal. So, the distributive properties hold. So, it becomes a
ring the so, R these algebraic system is a ring. Now, whether it is a commutative ring or
not, now over ring if I add the commutativity with respect to multiplication.

(Refer Slide Time: 26:22)

So, this is if I take a, b ∈ R. So, this a ⊙ b is a + b - a b = a plus, or I can write b + a


same thing, I can write b + a - ba = ba. So, it is commutative. So, it is a commutative ring
R. Now, if we add the if we see the multiplicative identity, we check whether it exist or
not multiplicative identity; that means, I have some a ⊙ Z, if I take that type Z exists
equal to a.

So, a + Z - a Z = a since already commutative. So, Z(1 - a) = 0 and this is for all a ∈ R.
Now, see here this become 0; that means either Z = 1, this is either Z = 0 or a = 1. Now,
see this a = 1 that this property should hold for any arbitrary a not only for 1. So, this
should hold for. So, I can write that it should hold for any arbitrary a ∈ R and not only a
= 1.

So; that means, that is Z = 0. So, my multiplicative identity is Z equal to so,


multiplicative identity exist and it is 0 multiplicative identity is 0. So, the properties that,
we see that it has multiplicative identity is also exist. So, in this way we can check that it
is a ring; it is a commutative ring and with a multiplicative identity exists.

456
Now, we see the some properties of so here some example we have studied that with
addition and multiplication, which are binary operations, but not the ordinary addition or
binary multiplication.

(Refer Slide Time: 31:08)

Now, we see some properties that we called the ring properties. Now, we have defined
ring we with two binary operations. Now, these we can write that in any ring (R, +, *)
that telling that as if some addition and multiplication. The, the properties are that 1 we
can write the 0 element for addition, because we know that 0 is the additive identity. So,
if I write that 0 element is e I write the additive identity is e, it is unique.

Same way I can write the additive inverse. So, e is the additive identity. The additive
inverse is unique. Now, I can prove I give a proof the proof is very simple. So, for a part
let there are two let there exist two additive identity; say e1 and e2. So, if some a ∈ R so,
then a + e1; that means, I can write if I consider that e2 is since it is identity; that means,
e1 and e2 ∈ R.

So, I can write e1 equal to since it will belongs to R; that means another element of R.
So, I can write this is e1 + e2. Since, e2 is the identity element, since e2 is identity additive
identity.

Similarly, I can write e2 = e2 + e1. Since, e1 is the identity element so; that means, that is
e1 = e1 + e2, since it is commutative with respect to addition. So, I can write equal to e2 +

457
e1 = e2 that is e1 = e2. So, the for e part we see the multiplicative identity is unique sorry
additive identity is unique this is addition additive identity is unique.

(Refer Slide Time: 36:30)

Now, the what about the additive inverse that we can write that for additive inverse that
means, my b part. So, for a ∈ R. Suppose, there are two elements similarly I can take two
elements b ∈ R, or I can take two elements b and c I can take two elements b and c ∈ R.
Such that a + b = b + a = e the identity, similarly a + c = c + a = the identity.

So, if I write. So, b = b + e, since it is a inverse equal to b plus I can write e is my a + c.


So, this becomes b + (a + c). Now, my b + a is e from here b + a = e. So, this is e + c = c
only so; that means so, b = c. So, again; that means that my additive inverse is also
unique.

Now, we can see that sub ring, we can see that just we can define the way, we have
define the subgroups sub monoid, sub semi group, and we can define the sub ring.

458
(Refer Slide Time: 40:00)

So, for a ring (R, +, *) again plus star a non-empty set a non-empty subset say S of R is
called the subring, that is under addition and multiplication.

That means here the plus and star and as usual that it may or it may not be the ordinary
addition or multiplication the R multiplication of R the restricted to S is a ring; that
means, that in other words I can tell that with S is a subset of R, then with respect to the
this addition and multiplication defined over R, that S is also closed and S is becomes a
ring.

So, this is a subring, then example I can for every ring R. The subsets of identity element
is a subring or our known example we see that other algebraic systems we have seen, the
set of all even numbers, even is a subring of (Z, +, *) where Z is the set of integers, or
even I can take the set of positive integers.

Then, also it holds set of positive integers. Here, you can write set of integers. So, there
are many such properties of subring and we can write.

459
(Refer Slide Time: 44:39)

And, some of these 1 very important property, I can tell that or if we if we consider that
examples, that earlier we have taken with respect to that, if we remember that one ring
that example we have taken earlier (R, ⊕, ⊙) that ring.

We have considered and if we see that whether this becomes a sub ring or not, say we
have considering that now it is instead of R that R is actually my Z, Z say R equal to we
consider R = Z. And, the subset S is set of odd integers, set of odd integers. Then, what
about the addition, that say a ⊕ b is a + b - 1. So, if a b belongs to S odd integers, then
this becomes odd. So, this is; that means, a b belongs to so, this because a plus b is even
so, this is odd.

So, a, b ∈ R, sorry S; a, b ∈ S, then a ⊕ b ∈ S, then what about the multiplication that a b


is a + b - a b. So, if a b are odd. So, this becomes even and this becomes odd. So, this
becomes odd. So, I can write that a, b ∈ S, a ⊙ b ∈ S. So, we can see that with these two
these are actually holds the closure property. So, I can write that S is a, S is a actually
sub ring is a sub ring of Z, here R = Z ok.

So, we have read the algebraic systems ring and with two binary operations which is
different from the others I repeatedly we are mentioning and then some examples.
Mainly to show that the addition and multiplication the two binary operations that we are
defining with ring, that I am not ordinary, that may or may not ordinary addition and
multiplication. And, we have read some of the properties and how actually one algebraic

460
systems, whether it forms a ring or not that we have studied with some examples. So,
with this we finish the discussion on the ring.

Next day, we will see the other properties and how they are related there are some
operations and how they are related with ring.

461
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 53
Ring and Modular Arithmetic (Contd.)

So, we have discussed the Algebraic structures and number of algebraic systems, mainly
based on some properties we have read and almost all the algebraic systems like group or
the semi group, monoid or the last algebraic systems that we have read is the Ring. There
everywhere we considered one example, where some modular operation we have
discussed or we considered. Now, we have defined there in very short that what do you
mean by the modular n, a modulo n or a modular b. Now, today we will see or we will
read in details the modular arithmetic. Because this has a very important role in algebra;
algebraic systems or particularly this modern algebra.

(Refer Slide Time: 01:32)

So, today we will mainly consider the modular arithmetic, its definition, the different
properties and some application areas. So, first we define that what do you mean by
Modular. So, let a be an integer and n be a positive integer. Then if we divide a by n,
then we will get a quotient; get a quotient or integer quotient say q; say q and a reminder
r, where 0 ≤ r < n and q and r integer.

462
So, we can write that a = q n + r or q that r remainder is greater than 0, greater than equal
to 0 or less than n, if it is divisible by n; a is divisible by n; that means, there is no
reminder. That means, it is 0 or it is less than n and q, I can tell that q is floor (a/n); floor
(a/n) earlier we have defined that it is the largest integer less than or equal to a/n. So, I
can write that this is floor (a/n) x n + r. Now this r is sometimes called the, the remainder
r is called the residue or that it is the remainder of when a is divided by n, it is called that
a modulo n or a mod n. So, mainly the remainder when a is divided by n, like it is called
that a modulo n.

(Refer Slide Time: 06:08)

So, we defined that a mod n, we defined a mod n to be the remainder when a is divided a
is a integer a is divided by the positive integer n; positive integer n. Example we gave
give. So, this is my definition of a modulo n ok. If I give an example simple example, if
we see that modular see 11 mod 7 that means, when 11 is divided and we know it is
nothing but 4.

So, what will be minus 11 mod 7? - 11 mod 7. This can be minus, can be - 3 which can
be the quotient. I am sorry - 1 be the quotient and then 4 is, so I can write this thing as - 1
x 7 + (- 4); this is - 11 or same thing I can write that - 2 x 7 + 3. So, this can be since the
way we have define it is the remainder. So, it this can be the remainder - 4 or this can be
the remainder. So, - 11 mod 7, I can write this is 3 or even sometimes we can write - 11
mod 7 is - 4, but normally the convention is that we give the, give as a positive integer.

463
Because the remainder we have defined that if you remember that we have defined that
my r is 0 ≤ r < n and n is a positive integer; n is a positive integer.

So, since r greater than equal to 0, so this is positive and less than n. So, here say this n is
7; in this case n is 7. So, my a modulo n; a modulo n is 3. So, this is my definition of my
modulo. Now all of we know, but again I repeat that sometimes we call that devisors.

(Refer Slide Time: 10:00)

So, normally divisor is when there will be no remainder. So, divisors that if say n | a. We
normally we write in this way n | a that means, when a is divided by n, a positive integer;
a positive integer, then there is no remainder. We call, or we mention call that a is
divisible by n or I can tell that n divides a and normally, the notation is n | a. So, the
divisors have some property. Though it is very primitive, but we require for this
explanation of the different property of a modular n so, we quickly write those things.

The some of the properties of divisors, we can write that 1; if a | 1; if a | 1, then a = +- 1.


If a | b and b | a, then a = b. If any b, any b not equal to 0, divides 0; b | 0, then b | 0. We
call b; we call b | 0 and if b divides, if b | g and b | h, then b | (mg + nh); where, m and n
are positive integer or m and n are integers. So, we can explain that fourth property
because all the properties 1, 2 and 3 are very trivial all of we know that thing.

464
(Refer Slide Time: 14:25)

So, we just explain the property 4; it tells that b | g and b | h. Then b | (mg + nh) ok. So, if
b | g that means, we can write that g equal to, then g equal to some b into some g1.
Because it divides that means, there is no remainder; only quotient. So, if I multiply both
sides by gm, then mg is b x mg1. Similarly, if b | h; then, h = b x h1 and nh = b x nh1.

So, now if I add this 1 and 2; so, adding 1 and 2, we get mg + nh = b(mg1 + nh1). So, mg1
+ nh1 this is one integer. So, we can write that. So, some if I write or this equal to b into
some say K one integer. So, K = mg1 + nh1 is one integer. So, b divides can write that
b|(mg + nh). So, the property 4, it is proved. We can explain in this way. Now, we go to
some properties of modular operator.

465
(Refer Slide Time: 17:36)

Because just now, I have seen some only our normal division that some of the properties,
when it is properly divisible or if some remainder is there. If some remainder is there,
then actually our modular operation comes into picture. Now, if a modular n, we have
defined that a modular n. We write a mod n. a mod n is the remainder, when a is when n
divides a ok. Now, n divides a. Now, if n is a positive integer and we a is divided by n,
then the remainder can be 0, 1, 2, 3, … (n – 1).

So, when a is divided by n the remainder, the remainder can be 0 to (n - 1). These are my
remainders. So, a mod n is the set, I can write that this is 0, 1, 2, 3 up to (n – 1). Now, we
will see some arithmetic that which works on this set only or we will see the whether our
ordinary addition subtraction division or multiplication, how it works or whether at all
the similar way it works on this set. Because the modular arithmetic now I tell that a mod
n is nothing but this, these it can be only the set of elements from 0 to (n – 1). So, first
we see the modular arithmetic operations.

So, first we consider the addition or consider the addition. So, addition we can write that
(a mod n) + (b mod n), if I take the or I can write in this way [(a mod n)+(b mod n)]; and
I again modular n; [(a mod n)+(b mod n)]mod n. Then, I will be getting (a + b) mod n.
First, we see that see. Here my a mod n is a set any elements from 0 to (n – 1). So, this is
a set from 0 to (n – 1); any elements. Now, similarly b mod n because it is divided by n.

466
So, this will be again 0 to (n – 1). So, these are two numbers and then again, if I take
modular n. So, the whole thing that this thing again is becomes 0 to (n – 1).

And similarly, if a + b now whatever be the number large whatever large number it is,
when I am dividing it by n and since a mod n is nothing but the remainder. So, again this
thing is from 0 to (n – 1). So that means, this we know that this is (a mod n) + (b mod n),
if I take the modular n then this will be the (a + b) mod n.

(Refer Slide Time: 23:04)

So, how we can prove? We see the proof. So, let this is continued. Let a mod n that
means, when a is divided by n is actually ra and b mod n, when b is divided by n the
remainder is rb. So, I can write a = K1 n + ra. K1 is the quotient, when a is divided by n.

Similarly, I can write b = K2 n + rb. So, here I can write that my K1 is; K1 is floor(a/n)
and 0 ≤ ra < n. Similarly, here I can write K2 is floor(b/n) and 0 ≤ rb < n. Now, if I; if I
add this equation 1 and equation 2; equation 1 and equation 2, if we add; then, we will be
getting that adding equation 1 and 2, we write that a + b = K1 n + ra + K2 n + rb.

So equal to, I can write ra + rb + n K1 + K2. Now if I take divide a, this equation. So, I can
write a + b. Now, say this equation I give name equation 3. So, if I divide equation 3 by
n. So, divide equation 3 by n, this will give and if I take the remainder of that. So, this
will be (a + b) mod n is the remainder from left hand side and from right side, this will be
my (ra + rb) mod n because here n into K1 + K2. So, this is when I am dividing by n. So,

467
there will be no reminder for this part. So, for this part since is n into; so, divided by n
will give 0 remainder; will give remainder 0.

Now, (a + b) mod n = (ra + rb) mod n that gives what is (ra + rb) see that ra is a mod n.
So, this is nothing but ra + rb is a mod n; ra is a mod n ok. I can write here. So, a mod n
plus rb is b mod n and this mod n. So, this is mod n. So, the property 1 or the addition
property, the addition property is proved that (a + b) mod n = a mod n + b mod n. Now
the totally similar way, that similar way I can prove the subtraction.

(Refer Slide Time: 28:36)

So, the property of subtraction that we can write that subtraction that (a mod n) – (b mod
n). If I take a mod n, this will be (a – b) mod n and the way we have proved that my
addition property for modular operator that totally similar way, we can take; only that
when we have added adding that time, we have to subtract equation 2 from equation 1
and the remaining things are same. So, if I write the multiplication property that we have
to write that that a mod n into b mod n, we take again modular n is a into b mod n.

Now, the way we have proved if the same thing we can do so multiplication proof, we
can now take that a similar way we take that a mod n = ra. So, let a mod n = ra. So, a
equal to the way we have taken K1 n + ra and b mod n = rb we can take b = K2 n + rb.
Now, what is my a b? Because when we have proved the addition property, we have
taken the equation 1 and 2, we have taken the sum. Now, we have to multiply. So, if I

468
multiply equation 1 and 2 will be getting a into b equal to (K1 n + ra) x (K2 n plus rb) and
will be getting ra x rb plus that we can take K1 K2 n2 + K1 n rb + K2 n ra.

So, this will be ra x rb plus if I take common n. So, I will be getting K1 K2 n + K1 rb + K2


ra. Now, see similarly if I divide a into b by n.

(Refer Slide Time: 32:39)

So, dividing by n and take the remainder, we get (a x b) mod n is only ra x rb because
again here n is there. So, when I will be taking dividing by n this part will give the 0
remainder. So, this is if we reminder that (a x b) mod n is r is my ok. This is (ra x rb) mod
n, then these will be [(a mod n) x (b mod n)] mod n. So, it is proved. But see we cannot
do this thing for division property. We have only multiplication, subtraction and the
addition ok.

So, just the basic properties that modular operation holds that we have read here and
some more properties when it is repeated multiplication or repeated addition and that will
be reading in the next lecture.

469
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 54
Ring and Modular Arithmetic (Contd.)

So, we are discussing the modular arithmetic and in the last lecture, we have define that
what do you mean by a modulo n and mainly that is nothing but the remainder when a is
divided by n and the three basic arithmetic properties. Thus, addition, subtraction and
multiplication and how actually they operates on the set 0 to n minus 1; since 0 to (n - 1)
are the remainder when it is divided by n.

(Refer Slide Time: 00:57)

So, we will now continue the discussion on Modular Arithmetic because some more
properties now we will read and some application areas that how that modular
arithmetic, we can utilize for some computation purposes. So, if we quickly write the
three basic arithmetic properties that we have read is the addition. I can write that (a mod
n) + (b mod n) and if I take the modulo whole this is nothing but the (a + b) mod n.

Similarly, we have given the subtraction and which is nothing but the same only instead
of plus we take the minus. This is - b mod n, (a – b) mod n and the multiplication that (a
mod n) x (b mod n) take the modulo n which is (a x b) mod n.

470
Now we take one example that how it is used for larger arithmetics; how it is what is the
advantage of this thing? Now, we take one example. Say we take a = 11, b = 15 and n =
8. So, the addition will or a mod n first we do. a mod n is 11 mod 8 which is 3. Similarly,
I can write b mod n is 15 mod 8 and is equal to 7.

Now, if we do the addition; write addition, then 11 mod 8 + 15 mod 8; this modulo 8,
that means, my LHS; this is my left hand side. So, 11 mod 8 we have seen 3; 15 mod 8
we have seen 7; (7 + 3) mod 8 is 10 mod 8 = 2. And if I do (a + b) mod n; so if I write
the RHS (a + b) mod 8. So, this is simply (11 + 15) mod 8 and this equal to 26 mod 8
which is 2. Now, we see that here it is 2; here it is 2. So, these 2 are required.

Now, what is the advantage? See here, I have taken a is 11 and b is 15, but and this is
slightly larger 26 mod 8. I get 2. Here my computing and I am doing only 11 mod 8 and
15 mod 8 not the and I got 3 + 7. So, instead of 26, I got 10. So, if my a is very big say if
I take my instead of a, 11 and b, 15 I can take my a is safe is a very large number 10235
like that or even larger and say is also 75980 or even larger.

(Refer Slide Time: 06:23)

So, whatever be the thing, I do when I do that a + b. Again, it will be a some larger
number and that when I take the modulo, when I take the modulo a + b. So, if whatever
large number it is, if I take (a + b) mod 8, my module the result will be only 0 to 7
because my modulo 8; that means, only the remainder when it is divided by its 8, the
remainder can be only 0 to 7 and this is a big advantage of when the large number will be

471
dealing with large number the computation in large number. Particularly in the area of
pictography, the coding that it is of tremendous use.

Now, with the same number that same example that a is 11, and b is 15, and n is 8, we
can see the multiplication. Because all of we know the multiplication becomes the
product will be even larger than the addition of two. So, if I take the a modulo n which is
11 mod 8 = 3, and my b mod n = 15 modulo 8, which is 7. Now, if I take the
multiplication that means, in LHS again the similar way I can take, I can take the LHS.
This is equal to the (11 mod 8) x (15 mod 8). I take a mod 8 and this becomes 11 mod 8
is 3 and 7 and this is modulo 8.

So, 3 x 7; both are very small numbers because that number cannot be larger than 7. So,
at most this can be 49. So, this is 21 mod 8 and this becomes 5. Now, if I do the RHS,
then it is (11 x 15) mod 8. Now, see 11 x 8, this is a larger multiplication complex
multiplication and the similar way if I take a and b, then it will be even largest. So, this
will be 165 mod 8 and if I take the remainder this will be 5 because it is 20 x 8 + 5. So,
165 is 165 is this. So, I can write thus 165 mod 8 = 5.

So, when I am doing the multiplication, this advantages even more. Because
multiplication of too large numbers are actually difficult complication and this will be
never it will be more than the n - 1; maximum it can be n - 1. So, we say that these are in
this way we can take that this 5 and 5 these are equal. So, in this we way we take.

(Refer Slide Time: 11:01)

472
Now, exponentiation because we know the exponentiation is nothing but the repeated
multiplication. My exponentiation is nothing but repeated multiplication and just now,
we have seen the multiplication is very easy; particularly large multiplications large
multiplication of large numbers because the each one cannot be larger than n - 1 when it
is divided by n.

So, we take one example of that and we see how we can take the advantage of modular
multiplication. Say we are taking or we want to compute say 117 mod 13 ok. Now 117;
that means, we have to multiply 11, 7 times and modulo 13. So, what we can do that?
See we have to compute this thing. So, I write my 11 mod 13 is nothing but 11 because
11 is less than 13 remainder should be 13 only.

But 112 mod 13, if I apply multiplication that means, it is (11 mod 13) x (11 mod 13) that
of mod 13. So, I have to write each one will be 121 mod 13 and that will be. So, if I
divide that what is my 121, is 8. It is of 4; + 4; 9 x 13; I think is 9 x 13 is 117 + 4.

So, I can write 121 mod 13 = 4 ok. So, 121 is 4. Now, I can 112 is modulo 13 is 4. So, I
can write 114 mod 13 or first I take 113 mod 13 is same as 112 mod 13; repeated
multiplication 11 mod 13 and that of mod 13 just the rule of that modular multiplication.
So, 11 square we have just seen that 112 mod 13 is 4 and 11 mod 13 is 11. So, modulo 13
and that is 44 mod 13. So, this will be 5 x 11.

Now, what is our I have to find out that 117. So, I can write 117. If I 117 can be written as
117 is 114 x 113. So, 114 we got 3, we got 5. So, and 112 we got 4. So, that again I can
write 112 or what I can find out the 11 to the 4 only. So, I can write the 11 to the power
the same way I can write the 113.

473
(Refer Slide Time: 16:56)

So, 114 mod 13, we have to compute that we can continue ok. 114 mod 13 that we can
write (113 mod 13 x 11 mod 13) mod 13; and 113 we got 5 into 11 mod 13, and 55 mod
13. So, that is 3.

So, now if I write 117 mod 13, I can write this as 114 mod 13; 113 mod 13, and 114 is 3
and because this is my multiplication rule and this cube is 5. So, (3 x 5) mod 13 and this
becomes 2 mod 13 that means, this is equal to 2; 2 mod 13 is we get that mean reminder
is 2 ok. This is 2 mod, I can write 2 mod 13.

Now, see the way we have done this, this power can be is a large number that it can be
some I can write some ab and modulo n, where this a and b are very large number; a and
b are large integer say very large integer, but if we apply the modular multiplication to
compute the exponentiation. Then, never the each multi modular multiplication results
cannot be larger than n - 1 because that remainder can be only n 0 to (n - 1).

So, in this way we compute my computation is much simpler. So, this is one particularly
to get exponentiation that this is a big advantage and this is used this computation is used
in cryptography. So, algorithms like RSA, algorithm we know that public cryptography,
this has a big advantage.

474
Now, we see some again some simple properties of modular n or before that we define a
if congruence which is actually some I should tell some variant of modular operation.
How we can define; the congruence or congruent modular n or congruence?

(Refer Slide Time: 20:24)

So, if a and b are 2 integers; a, b are 2 integers; and n is a positive integer and here a and
b are divided by n separately by n and modulo’s are that where we can write it is a
modular n and when it is b is divided by n, the remainder we can write b mod n. Now, a
mod n, just now what we have read? The remainder can be only value 0 to (n – 1).

Similarly, b mod n whatever be the value of b, this can be 0 to (n - 1). Now since if n is
small or whatever be the n values, then it is a many to 1 mapping; that means, for many a
and b that will map to the same value because a and b can be any larger integer that we
can get a the same value n. So, if we see that my a mod n = b mod n that means, the
remainders are same when a is divided by n, b is divided by n. Then, we write that a is
congruent to b mod n. So, this is the definition of congruence a is congruent to b mod n
when a mod n = b mod n. So, we call this is the operation of that congruence and we
write a is congruent to b mod n ok. Now, we see some property of this congruence.

475
(Refer Slide Time: 23:17)

So, property one, the again these are also properties of I can tell the modular operator
because congruence is nothing but the modular. So, again we read some of the properties
of modular operator. So, many time we define or we the property that if a mod n = b mod
n, or I can write a is congruent to b mod n same thing just now we have defined, then n |
(a – b). Sometimes, this is also one definition of the congruence we write that n | (a – b).

How we can explain this thing? See we start from this that I can write the proof or
explanation whatever we call the proof or some explanation because it is trivial. Then, if
n | (a – b); that means, a - b = K n; because there is no remainder, K is the quotient ok. K
is integer and there is a quotient. So, a = b + K n. Now, this equation if I divide by n and
take the remainder. So, divide the equation by n and take the remainder. So, remainder
will be K, then LHS will give a mod n, and if I take divided by n and take the remainder.
So, K n since I am dividing by n. So, K n this portion has no remainder.

Because it is n divides, n | K n because it is divisible. So, I will be getting only b mod n.


So, which is my definition or what the statement is that if a mod n = b mod n, then
divides (a – b). So, this is one property that will many times we use that thing.

476
(Refer Slide Time: 26:34)

Now, other property I can write that this is very trivial that if a is congruent to b mod n,
then we can write b is congruent to a mod n. And the explanation is very I should tell
explanation instead of proof because it is mainly coming from the definition of modular
that the way we have done that congruent is a mod n = b mod n. So, I can just write this
side b mod n = a mod n and this is the definition that b is congruent to a mod n. So, it is
very trivial. Now, the third property that property 3, we can write that if a is congruent to
b mod n, and b is congruent to c mod n, then a is congruent to c mod n.

So, again I think this explanation is very simple because a is congruent to b mod n means
a mod n = b mod n; and b is congruent to c mod n is b mod n = c mod n. So, I can write;
I can write a mod n = c mod n and which implies actually a is congruent to c mod n. So,
these are some of the properties that if we see some example we see that.

477
(Refer Slide Time: 29:17)

Example, we take 23 is congruent to 8 mod 5 - 11 is congruent to 5 mod 8. Similarly, I


can write 81 is congruent to 0 mod 27. So, if we explain that first one; 23 is congruent to
8 mod 5 because we see if I here n is 5 ok. I can write give some 1, 2, 3 and later, I write
the explanation. So, number 1 explanation is my a = 23, b = 8, and n = 5. So, what you
see that 23 mod 5 is 3, and 8 mod 5 is 3. So, from here I can write that 23 is congruent to
8 mod 5.

Now, if we see the 2, that - 11 is congruent to 5 mod 8 and directly I can write - 11 mod
8 is – 3, and - 3; we know - 3 is nothing but + 5. So, I get thing it will be positive number
normally that is the convention. So, one thing you know that if it is a minus, then and it
is mod 8. So, if I get x then it is that n + x; x is, if x is - 3, if it is negative or then it is n +
x that means, 8 - 3, 5.

And 5 mod 8 is 5 because it is less than 8. So, 5 is the remainder only. So, from here and
here I can write - 11 is congruent to 5 mod 8. Then similarly the 3, if we see 81 mod 27
is 0 because there is no remainder 3 into 27 is 81 and this is 0 only. So, I can, and 0 mod
27 is 0 only because that divisible property or devices property of devices, we have seen
that any b not equal to 0 divide 0. So, this is the property very trivial property. So, I can
write 81 mod 27 or 81 is congruent to 0 mod 27 ok. So, 81 is congruent to 0 mod 27.

So, congruence is actually one property of modular arithmetic. So, these are some of the
basic properties of modular arithmetic and again, we will see some examples or other

478
modular properties when particularly the addition and multiplication, we will see.
Division now we will not considered and slowly we will see that what is the problem or
how we can incorporate the division properties.

So, next lecture, we will continue again with the properties of modular arithmetic in
particular the addition and the multiplication operation.

479
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture – 55
Ring and Modular Arithmetic (Contd.)

So, we continue our discussion on Modular Arithmetic and this lecture particularly will
see how the addition and multiplication gives a particular type of algebraic system.
Actually, these as the example or modular operation as the example already we have
discussed for our group ring, and now we see in general that how these properties are
giving the particular type of algebraic systems. So, again properties of modular
arithmetic.

(Refer Slide Time: 01:06)

So, this modular arithmetic as already I mentioned will consider the mainly the addition
and multiplication ok. Now, and will see the, if we remember that whenever that we are
define some algebraic systems like group ring some general properties we have set and
based on those properties. What are those properties?

Like commutative associative whether additive inverse exist, additive identity, or the
multiplicative inverse exist based on that we have define some algebraic systems. Now,
now we see or we first prepare some our addition modulo table; that means, some table
with the operation is the modular addition. Let, we take 1 example of and with these

480
example where we define that thing. So, addition and multiplication of modular
arithmetic we take, the modulo say 8 ok. Now, modulo 8 means, that my set can be only
0, 1, 2, 3, 4, 5, 6, 7; 0 to (n – 1) ok.

Now, if we make the addition table ok. First we do the, we do the addition table. So, I
write that 0 because my set will be 0, 1, 2, 3, 4, 5, 6, 7. Here also this is my addition
modulo 8, I am taking this is my addition and multiplication modulo 8. So, this is
addition modulo table. Now, how we do that thing, that if we know the addition this is if
a and b, say if this is my set s. Then, a and b ∈ s, then (a + b) modulo 8 will be taking
that is the modulo; that means, I will add 2 numbers and will take the remainder when it
is divided by 8. Now, a is 0 to 7; a can be 0 to 7; b can also be 0 to 7.

So, will be adding these 2 numbers and taking the remainder by dividing it by 8. So, 0 +
0 it is 0, it is 1, 2, because if we add all the a + b that will be less than 8. So, the
remainder will be the same thing. Now, if it is 1 + 0, it is 1, 2, 2 divide 2 divided by 8
remainder will be 2, 3, 4, 5, 6, 7, now this becomes 1 + 7; 8; 8 divided by 8 this
remainder will be 0. Similarly, again 0 + 2, 3, 4, 5, 2 + 4; 6, 7 these becomes 6 + 2.

So, 8 divided by 8 remainder 0 2 plus 7 9. So, 9 divided by 8, 1. Similarly, now we can


fill up quickly 5, 6, 7, now this becomes 0, this becomes 1, this becomes 2. Now, it is 4,
5, 6 this become 0, 1, 2, 3, this is 7, because modulo 8. I am taking, this is 4 + 3; 7, 7
modulo 8 is 7; 8 modulo 8, 0; 1, 2, 3. Now, 5 it is become 5, 6, 7, now 0, 1, 2, 3, 4, 6, 7,
now this becomes 0, 1, 2, 3, 4, 5, now 7 is 7, 0, 1, 2, 3, 4, 5, 6. So, we see that it is if I
take that 0 + 0, it is 0; 1 + 1 + 7 is a, or 1 + 0 is 1, 2 + 0 is 2, 3 + 0 is 3, 4 + 0.

So, if we remember that my a + e = a then e is my, e is additive identity. So, here for
modulo 8 addition, modulo 8 addition the identity additive identity is 0 ok, addition I
have written. So, I can write identity element is identity element is 0 identity element e is
0. Now, what about the additive inverse? Now, if we remember the, if some a + a’ = e, or
a’ + a; then a’ is the inverse of additive inverse of a.

Now, we see that if we that 0 + 0 is 0; see 1 + 7 is 0, 2 + 6 is 0, 3 + 5 is 0, 4 + 5 is 0 since


0 is my identity. So, for each element I am getting and if I add I am getting 1 element
just to add I am getting the identity element; that means, for each element of this set from
0 to 7 that 1 inverse exist. So, for when a = 1 my a’ is 7, a = 2 my a’ is 6. Like that, so, my

481
for all a, I can write then for all a, ∀ a ∈ S, S is 0 to 7 that additive inverse exist later we
will tabulate that thing what are the we now remember. So, additive inverse exist.

So, when we have considering addition modulo 8. So, this is my, this is my addition
modulo 8 we can write this is my addition modulo 8. So, for addition modulo 8, my these
are the things I get my identity element exist, which is equal to 0 and for all a the
additive inverse exist, because just now we see that. Now, we take the multiplication we
see the multiplication modulo multiplication modulo 8, see multiplication modulo 8 ok.

(Refer Slide Time: 11:22)

The same thing that since here modulo 8 so, my s is 0, 1, 2, 3 because only up to 7. So,
when I am considering the modular arithmetic that, how these multiplication operation
operate on this set? Ok.

So, we this is my multiplication and considering 0, 1, 2, 3, 4, 5, 6, 7 here also we


consider 0; 1 now it is multiplication. So, have to take that (a x b) mod 8, and a, b ∈ S.
So, 0 x 0 of because 0 into all this becomes 0 and 0 mod 8 is 0. So, I write these are all 0
ok. Now, if I multiply then these becomes 1 x 0, it is 0; and 1 x 1, 1 modulo 8, 1; 2, since
it is multiplied by 1 only. So, all are less than 8. So, remainder will be the same when
divided by 8.

Now, it is 0 to 4 modulo 8, 6 modulo 8, now 8 modulo 8, 2 x 4, 8 and 8 modulo 8 is 0.


Now, 2 x 5, 10, 10 modulo 8, remainder is 2, 2 x 6, 12, remainder is 4, 1 divided by 8, 2

482
x 7, 14 remainder is 6. Now, similarly 3 x 0, 0, 3, 6 modulo 8, 6, 3 x 3, 9, 9 modulo 8 is
1, 12 modulo 8 is 4, 15 modulo 8 is 7, 18 modulo 8 is 2, then 21 modulo 8 is 5. Now, 4 x
0, 4, 8 modulo 8, 0, this is 0, 4, 12 modulo 8, 4.

Then, it is 0, 16 modulo 8, 0, 4, 24 is 0, 28 is 4, 5, 0, 5, 10 modulo 8 is 2, 7, 20 modulo 8,


4, 25 modulo 8 is 1, 30 modulo 8 is 6, 35 modulo 7 modulo 8 is 3. Now, 0, 6, 4 this is 2
because 18 modulo 2, 8 x 2, 16 + 2, 24 mod 8, 0 then 30. So, it is 6 again 4 and 2, 7 it is
0, 7, 14 is 6, 21, it is 5, it is 4, 28, 35 it is 37 to 6, 42, 42 modulo 8 is 2 and 7 x 7, 49
modulo 8 is 1. Now, we see that what will be my multiplicative identity ok.

So, we see that if I consider 1, if I consider 1, then I am getting the 0 x 1, 0, 1 x 1, 1, 2 x


1, 2. So, I can write that (a x e) some we know that operation that a into modulo n, in this
case that (a x e) modulo 8 is e only a only that number only. So, e is my, e is
multiplicative identity.

And, equal to 1; that means, or multiplication or multiplicative modulo 8 is 1 ok. So,


now, we remember the definition of inverse for multiplicative inverse we see
multiplicative inverse, it will be we remember a x a’ modulo 8 should be e, or e modulo
8. I write (a x e’) is e modulo 8. So, now, we see that e is 1. So, see for 0, 0 is since we
can see that 0 is if I multiply everything it will be 0. So, from 1 to 7 from 1 we are
getting some identity that 1 x 1 identity.

See for 2 we are not getting any not getting any identity for 3 we are getting identity 1,
but for 4 we are not getting, for 5 we are getting 1 identity, for 6 we are not getting, for 7
we are getting identity. So, if I summarize I can write that for we are getting
multiplicative identity, identity for a = 1, 3, 5 and 7; that means, we are getting
multiplicative identity I give a tick mark if I getting identity and I give a cross if I do not
get.

So, I get for a = 1, 3, 5, 7 I am getting and for we do not get no multiplicative identity for
a = 2, 4, 6.

483
(Refer Slide Time: 20:41)

So, we can conclude the conclusion is that conclusion or if I tabulate first and conclusion
is if a is relatively prime to n, when I am taking multiplication modulo n, then
multiplicative inverse exists, then multiplication multiplicative inverse exists.

Now, what is relatively prime relatively prime to n; that means, a and n are relatively
prime when there is no common factor between a and n. So, a and n are relatively prime
when the when there is no common factor of a and n. So, if we see that when a equal to
see I have taken modulo 8. So, my I am taking mod 8 operation on modulo 8, 8. So, my n
= 8 and when I take a is 1; that means, 1 and 8 other than. So, factor of n other than
better I write other than 1.

See for 1, 3, 5, 7 this is so 1 and so, a = 1, a = 1, and n is 8 always. So, 1 and a they are
relatively prime, we are getting that some inverses 1 only ok. We are getting that a’ = 1,
when a = 3 we are getting a’ = 3 since 3 into because 1 x 1 modulo 8 = 1 modulo 8 and 1
is my identity, 3 x 3 modulo 8 is my 9 modulo 8 is 1 modulo 8. What about a = 5 is 5
only because 25 is 25 should be the 5 x 5, 8 x 3 + 1.

So, a’ = 5. So, 5 x 5 modulo 8 = 1 modulo 8, then a = 7 we get a’ = 7 and this is 7 x 7


modulo 8 is 1 modulo 8. I think 1 we can see here 7 into 7 we can if I explain this is 49 =
6 x 8 + 1. So, when I will be taking modulo and it will be 1 only, because it will there is
remainder here. So, 49 modulo 8 it would be 1. So, 49 modulo 8 = 1 modulo 8 similar
thing for other 3 examples.

484
(Refer Slide Time: 25:49)

So, now if I tabulate we write that, I have taken the set 0, 1, 2, 3, 4, 5, 6, 7, since we are
taking the modulo 8 addition and multiplication, 8 and modulo 8 addition and
multiplication.

So, the previous 2 examples what we see that, if we now write the a the additive inverse
and the multiplicative inverse ok. So, a can be 0, 1, 2, 3, 4, 5, 6, 7. I take the additive
inverse and multiplicative inverse, then what we have seen 0 additive identities. So, in I
must write this 2 my additive identity is 0 my multiplicative must remember that we are
taking modulo 8 operation multiplicative identity is 1, that earlier we have seen
multiplicative identity is 1 modulo 8, 1.

So, we have seen the additive modulo 0, because it is 1 + 7 modulo 8 is 0, 2 + 6 modulo


8 is 0, 3 + 5 modulo 8 is 0 modulo 8, 4 + 4 modulo 8, 5 + 3 modulo 8, 6 + 2 modulo 8, 7
plus 1 modulo 8. So, additive inverse exists what earlier we have seen. What about
multiplicative inverse? Since, we do not consider 0, because that we know that there is
no 0 devisors. So, will multiplicative inverse does not exists.

Now, for 7 we get the multiplicative inverse 7, because 7 x 7 is the 49 and just now we
have seen that 49 modulo 8, 1, but for 6 it does not exist then for 5 it is 5, sorry this is
there are a is this one. So, we are taking multiplicative inverse say 1. Now, I made some
mistake we are taking multiplicative inverse of 1. So, multiplicative inverse of 1 is 1 only

485
1 x 1 modulo 8, 2 does not exist, 3 it is 3 only, then 4 does not exist for 5 for 5 it is 5
only, for 6 there is no multiplicative inverse, for 7 the multiplicative inverse is 7.

And, we have already conclude earlier the conclusion we have made that if a is
relatively prime with n; that means, for my 1, 3, 5, and 7, then only we get the
multiplicative inverse. And, if they are not relatively prime; that means, my a if a and n
are not relatively prime are not relatively prime, then multiplicative inverse does not
exist. And, that is for a = 2, 4, 6; because 2, 4, 6, and 8; n = 8, they are not relative prime
relatively prime, they have some common factor. So, it is there.

Now, these will give as the another algebraic system, it is called the field what will be
talking in the next lecture. So, that means, if multiplicative inverse is there, but if we
remember that when we have read the ring.

(Refer Slide Time: 32:00)

Now, if we see the properties of ring and properties of ring, what we have seen the when
we have seen the ring that, if we consider the addition modulo addition um and the
multiplication modulo 8, or some modulo operation modulo arithmetic the addition the
operation is addition and multiplication modulo n, I am writing modulo n then set;
obviously, my set is my set is 0 to (n – 1) already we have discussed because remainder
only, then what are the properties it holds, the first property holds is commutative laws
ok.

486
So, the properties are commutative laws both for addition and multiplication that we
know that if it is (x + n) modulo n, we remember that (x + y) modulo n is (y + x) modulo
n. And, same thing for multiplication x into y mod n is y into x mod n. Now, it is my
associative laws.

We remember that now x y z we consider and we can write that (x + (y + z)) modulo n
ok, equal to ((x + y) + z) modulo n. And, I can write x plus y into z modulo n is x into y
into z modulo n. Now, my distributive laws we know the x x (y + z) modulo n that will
be the (x x y) modulo n + (x x z) modulo n, or I can write together this mod n, because it
is same as that of if we remember the multiplication rule x this plus additive rule this is
same I can take this mod n.

And, I can write x on that side also. So, if it is identities we go to the next we continue.

(Refer Slide Time: 36: 27)

So, if I take the identities already we have seen the additive identity additive identity 0 is
0 mod n and multiplicative mod multiplicative identity is 1 mod n and that exist because
0 and 1 always be the set now 4. So, this is my 4 and 5 is the additive inverse. So, what
we have seen that additive inverse exists the additive inverse exists, when we have taken
the modulo n operation modulo n addition exists for modulo n addition.

So, it is a ring or commutative ring. So, my modulo arithmetic modulo arithmetic


operation.

487
The addition and multiplication 2 binary operations, the way the ring we have defined 2
binary operations and multiplication the modulo is a modulo n we are taking modulo n
and the it is operated on set 0, 1, …, (n – 1), and it is a is a commutative ring. Because
for multiplication also it is a it is commutative.

But, what we have seen the multiplicative inverse we cannot tell that for all the elements
only those elements which are not relatively prime that it is they are inverse exists, but if
they are relatively prime; that means, common factor exist between a and n, then no
multiplicative inverse exist.

And, this particular property when we will consider, then it becomes a new algebraic
system call the half field. So, next lecture we will discuss read about the algebraic system
field; that means, we will see that when multiplicative inverse that property is satisfied
when and how we can form that type of algebraic systems and their properties. So, with
this we end our discussion on the modular arithmetic operations.

488
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 56
Finite Field and Applications

Today we will read the fields one algebraic systems and in particular our emphasis will
be on finite fields, because as real life applications there are numerous application areas
that where finite fields are used, particular that cryptography and the coding theory well
mainly the finite fields are used. So, first we did that the field.

(Refer Slide Time: 01:02)

Since already we have read the number of algebraic systems and there we have seen that
a; the general properties that they hold. Now, we based on those properties that we try to
define the algebraic system field. So, a field F and normally a field is also with two
binary operations like ring. So, we if we write that as if the addition and the
multiplication is a set of elements with two binary operations like ring that we have read
last day, say addition and multiplication, but as already we have read, we have seen that
this addition and multiplication may not be the ordinary addition and multiplication.

And such that if a, b, c are the elements of F then the; and the following axioms are
satisfied. If we remember that the these axioms are the properties that are the mainly the
closure property, the associative, the identity element must be there and when we are

489
considering two binary operations then distributive property must be hold. So, if we see
those properties say for addition we can write; that means, for addition operation now
properties are say closure, then it has the associative, then it has additive identity should
be there, then it must be commutative and additive inverse exists.

So, this is when we consider the addition operation and addition operation that is my
here we have considered it is plus. Now similarly if I consider the; because field on field
there are two operations are there. So, if I consider the multiplication operation; for
multiplication operation then I should have the closure; that means, it should be closed
under multiplication, then associative with respect to the multiplication operation, then
multiplicative identity should be there, now the distributive property should be there, so,
it should be distributive.

Now, if the multiplication is commutative then it can be a commutative ring, now we can
also see that integral domain; that means, if it is multiplicative identity and the no
divisors; that means, if I add another property we have seen that multiplicative identity
and no divisors; no zero divisors; then it can it is the integral domain. Then it is so, we
have seen that if it is say additive property we can write that it is A multiplicative M. So,
if it is A 1 to A 6 it holds; then I can write M 6 to M 7 and M 9, M 10 then it is I can tell
this is commutative ring that we have read lasting.

And now if I add two more that M 8 that multiplicative identity and the M 11 the no zero
divisors then I can tell that this is the integral domain. Now see for when we have
considered the addition operation we have considered that additive inverse, but when we
have considered all the multiplication operation the properties which are must be obeyed
under multiplication say here closure, associative and multiplicative identity for integral
domain it can be commutative and distributive when both addition and multiplication we
have considered. So, distributive for both addition and multiplication, but multiplicative
inverse we have not considered.

So, here for the field that in addition that must multiplicative inverse it must satisfied.
So, we can write the additional thing that M 12 is the multiplicative inverse exist. So,
over the properties satisfied by the competitive ring and the integral domain, if we see
that multiplicative inverse exist; then it is a field.

490
(Refer Slide Time: 11:08)

So, what is a multiplicative inverse; that means, if the if; a belongs to F the field and say
multiplicative identity is e; this e is the multiplicative identity. So, which is for normal
multiplication or ordinary multiplication it is 1; for ordinary multiplication identity is 1.

Then there must exist an element a inverse such that a inverse in multiplication if I take
equal to a to a inverse equal to the multiplicative identity e equal to may be equal to 1 for
ordinary multiplication. So, this a inverse must exist for the field and then we called that
this is a field. Now if we remember and when it is finite field; finite field that if the order
of the field is finite; that means, the number of elements in the set are finite. So, it is
finite field if the order of the field is finite and order means we know order is the size of
the set; that means, the number of set of elements ok.

And as I have already mentioned that infinite field is of very less use actually the real life
applications like cryptography, coding theory the finite fields are used. So, mainly in our
lectures we will be concentrating on the finite fields and their properties.

491
(Refer Slide Time: 14:07)

So, if we remember the in the lecture that or when we have read the ring we have taken
some examples that addition and multiplication modulo; we have taken addition and
multiplication modulo 8; one examples we have seen and what we have shown that
under multiplication modulo 8; under multiplication modulo 8 it is a ring.

But the; when we have seen the operations the addition and multiplication modulo 8 then
we have seen that it is the multiplicative inverse does not exist for all the elements. If we
remember the what will be the set when we are taking the modulo 8 normally we have
read that Z, now we give the notation that it is a Z8 is the set, what is Z8 because if I take
the modulo 8; that means, it is nothing, but the remainder when some number is divided
by 8.

So, remainder can be 0 to 7; {0, 1, 2, 3, 4, 5, 6, 7} so, this is the set Z8 and we have seen
that Z8 and then the addition modulo 8 and the multiplication modulo 8. We have taken
this here plus and star at the addition and multiplication modulo 8. Now when we have
written that all the; or tabulated all the additions and the multiplication modulo 8 we
have seen that if we remember that only since these are my set elements. So, some set a;
if I write that this is 0, 1, 2, 3, 4, 5, 6, 7 then we got that additive inverse; we got that
additive inverse.

Additive inverse for 0 it is 0 because for additive identity is 0, this is 7, this is 6, 5, since
modulo 8 modulo 8 is; 8 modulo 8 is 0. So, this is 4, 3, 2, 1. When we have taken the

492
same thing for the, or multiplicative inverse; multiplicative inverse here multiplicative is
that modulo 8 multiplication then we have seen that for 0 normally we do not get
because 0 then there should not be zero divisors.

Then for 1 we get it is 1, for 2 we did not get any multiplicative inverse, for 3 it is 3, for
4 we did not get, for 5 it is 5, for 6 we did not get any inverse, for 7 it is 7. If we
remember again then it is for say 5 this is we know that 5 into 5 modulo 8 modulo 8
equal to 25 mod 8 and this equal to 1; remainder is 1. So, similar way we can get the 1
and 7, now see and the conclusion we have made that if this a; if we remember that
conclusion was that if a and n when we are taking modulo n or n multiplication, then a
and n are relatively prime; then we get the then multiplicative inverse exist for Zn; this is
for Z n.

So, and since here 2 4 and 6 are not relatively prime to 8 so, we did not get, but here say
1, 3, 5, 7 they are relatively prime to 8 relatively prime to 8 so, multiplicative inverse
exist. So, that is why the ring under modulo addition or modulo multiplication or if we
take the modulo 8 multiplication; that means, Z8; Z8 was not a ring or Z8 is not a ring.
Now, if it is a field that multiplicative inverse must exist. So, if I consider the n as a
prime.

(Refer Slide Time: 20:17)

So, we consider n as a prime, then what will happen say if it is Zn or I write n equal to p
normally that is the convention so, we write Zp. So, if it is Zp then Zp the set will be 0, 1,

493
2, 3 and up to p minus 1, then what is the relation between all these elements to p. Since
p is a prime; so, all the elements of Zp are relatively prime to p except 0; we do not
normally we consider that 0.

So, relatively prime to p; that means, I can take if a belongs to Zp other than 0 then a and
n are relatively prime Then now if I do the modulo p addition and multiplication modulo;
that means, the set I take the Zp and then plus and last day we have given this notation as
the star that modulo addition under this; this is plus and star are modulo p or mod p
addition and multiplication, then it must be a it must be a field.

So, we have considered the p and Zp and so that the set becomes 0 to (p – 1) since p is
prime. So, all the elements are relatively prime and then the according to that example
we have seen; that it must be; we must get that a multiplicative inverse.

(Refer Slide Time: 23:50)

Now, we take one example that where we take the Z7 ; that means, we consider we
consider p = 7 and the plus and star we give the modulo 7 addition and multiplication.

Now, if we tabulate the addition modulo 7 so, we first see the addition modulo 7 it will
be only 7 elements and modulo 7. So, if we remember it would be same because addition
will be similar 6 + 1, 7 so, modulo 7. It is 0; again 7 modulo 7 it is 5, 6, now it will be
modulo 7. So, it will be giving 0, 1, 2, 3, 4, 6, 0, 1, 2, 3, 4, 5. So, addition modulo will be
7 now addition modulo 7 this table will be.

494
Now, if I consider the multiplication modulo 7 on Zp, now since 0 multiplied by any
element will be 0. Now it will be similarly it is multiplied by 1; this is because
multiplicative identity is 1. Now I have to take that a x b modulo 7. So, 2 x 2, 2 x 2; 4, 4
modulo 7 is 4, 6 modulo 7 is 6, but 8 modulo 7 will be 1, similarly 10 modulo 7 will be 3
and 12 modulo 7 is 5. So, what lastly we have done modulo 8 now we are doing modulo
7.

Then it is 0, 3, 6 modulo 7, 2 then it is 5, 12, 15 so, it is 1 now 18 so, this becomes 4,


now 0, 4, 0, 4, 8. So, it is 1, then 12, it is 5, 16, it is 2, 16 modulo 7 remainder 2, then 20.
So, it is 6 then it is 3, 5, 5 modulo 7; 5, 3, 1, 6, 25 so, it is 4, then 30 so, it is 2, 6 modulo
6, 0, 6 module 12. So, it is 5, 4, 24 then 30 so, 2 then 36 so, it will be 1.

Now, we observe some of the seen; first thing is except 0 we are getting multiplicative
identity for each element 1 because since multiplicative identity is 1. So, we are getting a
inverse equal to 1 for each or for all a belongs to F Zp, here it is I should write that for a
belongs to Z7. So, for each element of Z7 ; I am getting and this is for other than other
than 0.

So, multiplicative inverse exist since last day we have seen that for or when we have
discussed that multiplicative inverse exists for other properties when the we have taken
that addition modulo 8 and multiplication modulo 8 that for all properties that we have or
the axioms that we have defined for field should follow that closure, associative, additive
identity it is a commutative and then for since it is a commutative ring we have shown
this is also integral domain.

So, up to these all these properties for addition these additive 1 to A6 for multiplication
for M6 to M7 commutative ring then it is integral domain everything is satisfied. Now
what we show that these only these M12 that multiplicative inverse that now we show
that when we are taking that a prime number; that means, when Z7; 7 is a prime then
multiplicative inverse exist. Since all other all the elements of Zp or in this case Z7 it is
relatively prime to p.

So, we can we conclude that our under addition modulo p; addition and multiplication
these are 2 binary operations multiplication modulo p where p is prime though on Zp, Zp
is a set 0 to (p – 1) is a field. And this is a very good observation and based on that
actually we will be forming that prime field.

495
(Refer Slide Time: 32:31)

So, normally when p is prime we call it is a prime field. So, on prime field so, Zp is a
prime field and operation is and we will; mainly the next lectures we will be considering
this prime field and the extension field that is Zp and some Zpn; that means, when this is
pn, the set of elements are 0 to pn.

So, mainly our focus is on these two fields we will be discussing. So, in this lecture we
have seen that how very basic concepts that how the Zp with the two binary operations
the modulo operations addition modulo p and multiplication modulo p; how they are
forming a field and how we are defining the prime field and then this pn we call that is
the extension field and mainly we will be concentrating on the studies of these two
fields.

496
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 57
Finite Field and Applications (Contd.)

So we are discussing on the fields and in particular the finite fields.

(Refer Slide Time: 00:31)

So, we have read the how fields are formed; that means, over the commutative ring or
the integral domain, how multiplicative inverse is that; if exist then it becomes a field.
And we have seen the example that when we take the modulo p where p is a prime that
modulo p addition and multiplication over Zp how it has formed a field.

Normally these if we consider that it is over p we call this is a Galois field we call that; it
is called GF(p) that is Galois field and so, this is GF(p) that Galois field of p; if p = 2
then normally this becomes GF(2) and or what pn mainly will be considering some field
where GF(2n). So, for GF(2) this will be the; it will be of two elements only. So, it will
be only two; 0 and 1; two elements and these are two elements. So, if I take modulo 2
addition it is 0, 0 + 0, 0, 1 , 0 + 1 is 1 and then 1 + 0, 1 and 1 + 1 this becomes 0.

So, it is nothing but our x, or the modulo 2 addition; this is our modulo 2 addition. Now
similarly I can write the modulo 2 multiplication 0, 0 this is 1. So, this is my modulo 2

497
multiplication ok. Now before pursuing our discussion on fields and particular prime
field; we must read something called the polynomial arithmetic. So, because our mainly
will be seeing that how this polynomial operations or the over the field of polynomials
this we can; this can become a field.

(Refer Slide Time: 03:22)

So, first we see the Polynomial Arithmetic. Now here actually this polynomial
arithmetic; this any polynomial is taken as a variable. Now mainly here we will be
reading the three things; one is normal polynomial arithmetic the, or we call the ordinary
arithmetic on polynomial; ordinary polynomial arithmetic using our basic algebra and the
operations concerned are mainly operations are our ordinary addition, subtraction,
multiplication and division, these are the operations will be seen.

Then we will see the polynomial arithmetic in which the coefficients are the elements of
some field. So, now we will see the polynomial arithmetic where the coefficients are the
elements of some field and just now the example or the last lecture we have read the
modulo p; then the operations that will be taking that we will be the modulo operations;
that means, modulo addition and multiplication. And we can see that the coefficients; if
it is modulo operation on modulo p, or modulo p then the coefficients can be Zp that will
be seen.

498
Then another thing another will read the now polynomial again polynomial arithmetic
and define polynomial arithmetic; it is defined that the operations are some modulo or
modular polynomial arithmetic better I write because the operations are on modulo m(x).

(Refer Slide Time: 07:27)

So, I write modular polynomial arithmetic; this is modular polynomial arithmetic on the
coefficients are defined on modulo m(x) where m(x) is a polynomial ok. And finally, we
will show that with this procedure that even some field which is not when we are taking
that it is not a field if we consider that our normal modulo n operation, but using the
polynomial arithmetic particularly modular polynomial arithmetic this becomes a field
and that is of interest in real life applications.

499
(Refer Slide Time: 08:59)

So, first we see the ordinary polynomial arithmetic; the number 1 is ordinary polynomial
arithmetic as the arithmetic, here will be only on ordinary addition, subtraction,
multiplication, division. So, first we consider the; our addition, subtraction and
multiplication, division we will be seeing later.

So, first thing is first we define a polynomial so, a polynomial. So, we define a
polynomial f(x) is an xn + an-1 xn-1 + an-2 xn-2 + … + a1 x1 + a0; it is x0 is 1. So, I can write
in this notation that n = 0 or sum i = 0 to n; i = 0 to n ai xi and I call this is an n degree
polynomial. So, this degree of the polynomial is degree is n.

Now, if I consider another polynomial g(x) so, let g(x) equal to another polynomial of
degree m say i = 0 to m and bi xi; that means, let g(x); here degree is m. Now if I take the
addition of f(x) and g(x); that means, my addition will be f(x) + g(x) and here i = 0 to n,
ai xi; i = 0 to m, bi xi and let we have considered n > m; that means, degree of f(x) is
greater than the degree of g(x).

So, there will be some more terms from because from m + 1 to n that terms will be here.

500
(Refer Slide Time: 12:36)

So, the sum will be the sum will be f(x) + g(x) is i = 0 to n, ai xi; and i = 0 to m, bi xi. So,
what I can do that for i = 0 to m; since n > m. So, I can write that (ai + bi) xi ; that means,
that degree wise the coefficients were added, I have some more terms in the first term
that i = m + 1 to n, ai xi. So, the addition is defined like that.

Similarly, I can defined it is same as that of my subtraction. So, if it is my subtraction it


is f(x) – g(x) and I can write this is (i = 0 to n, ai xi) - (i = 0 to m, bi xi); n > m and instead
of plus only I have minus because i = 0 to m, (ai - bi) xi plus as usual this m + 1 to n this
term will be ai xi; now this is my subtraction.

501
(Refer Slide Time: 15:23)

Now, is multiplication; if I take the multiplication, the f(x) x g(x) and this will be simply
the (i = 0 to n, ai xi) x (i = 0 to m, bi xi) and if I do that multiplication the result will be i =
0 to m + n and this will be the ai of bj those terms all the terms will be there I write ci xi
where I can write, where ci is ai or i all the terms if I write it will be a0 bm+n; I shall write
a0 bk + a1 bk+1 + a2 bk-2 + … + ak-1 bk +ak b0.

So, I can take all these terms and here actually k, I have given. So, it should be k only; it
should be k.

(Refer Slide Time: 17:33)

502
So, if I take some example; if I take one example say my f(x) is x3 + 2x2 + 1 and g(x) is
x2 + 3x + 2 ok. Now what will be my f(x) + g(x), see f(x) + g(x); I can write if I consider
all the terms that x3 + 2x2 + 1, I can take since it does not have any x1 term so, I write 0.x
+ 1 and g(x) if I add so, g(x) does not have any x3 term so, I; coefficient should be 0 then
x2, then 3x, then 2.

So, if I add I will be getting x cube then 3x2 + 3x + 3. So, the way we have done that 0 to
m so, it is up to 2; only the coefficients will be added. So, 2x2 it has 1x2 so, 3x2 it does
not have any x term. So, 0 plus 3 3 1 plus 2 3 and the m + 1 to n; that means, only 1 it is
left is cube. Similarly I can do here now directly I can write f(x) – g(x); since there is no
cube; degree 3 term say x3 – x2 because 2 - 1. So, x2 then - 3x because it does not have
any 0 x - 3 x + 1 - 2 so, it is - 1. So, f(x) – g(x) is that.

Now, if it is f(x) x g(x) that multiplied that ordinary multiplication we are doing and the
coefficients are we are taking. So, this will be x3 + 2x2 + 1 and we take x2 + 3x + 2. So, it
will be if I take m + n; if we remember the way we have written so, it will be x5 + 3x3 the
term will be the; a0 bk. So, here x3, 3x4 and 2x4 so, I can write 3x4 + 2x4 plus x3 term that
2x3 ; then 2 x 3; 6x3 plus that 2x 4 2x2; then x2 term 2 x 2 + 4x2 + 1 . x2 plus now there is
no other term here so, only 3x + 2. So, I have considered all the thing then it will be x5 +
5x4 + 8x3 + 5x2 + 3x + 2. So, we get the result here.

(Refer Slide Time: 22:39)

503
Now here the whenever we are considering a polynomial say f(x), say f(x) equal to I am
taking 3x2, now 3x3 + 2x2 + 1x + 1 like that. See here the coefficients are 3, 2, 1, 1 here it
is not there means it is actually it is 1 ok. So, now, my coefficients are here coefficients
we are taking it is 3, 2, 1, 1; that means, as if these are integer coefficients we are taking
positive integers or integer coefficients we are taking.

Now, so, we have defined multiplication; addition, subtraction, multiplication, now what
about division? What about my division; because if we remember that our modulo 7 see
if I; because if I want the division we consider division then I need some inverse. That
means, I can write that a / b so, actually I can write this is a into b inverse if it is ordinary
multiplication and division. Now the main point is or issue is here whether b-1 exist or
not, because just now the; from the definition of field we have seen and we have seen
some examples that this multiplicative inverse may not exist.

So, here that whether the main issue is whether b-1 exists or not. Say I consider 5 / 3; I
consider 5 / 3. So, my 5 is, 5 and 3 are integers so, if my set is the integer set then I know
that I cannot get this integer as the 5 / 3, 1; but because I know this 5 / 3 is 1 now the 1 x
3 + 2 so that means, here I get that remainder; quotient 1 and remainder 2 ok, quotient 1
and remainder 2.

So, if my coefficient sets are integer then actually they are not forming a field they are
not in field; they are forming a field; that means, coefficients, if the coefficients are in
the set of integer because if it is a integer that multiplicative inverse does not exist. So, it
is not a field , but if the coefficients are if the coefficients are real or complex number if
the coefficients are real number or say rational number or complex number then they
form a let me write here in this case I see the real numbers then they are form they form
a field.

Now, if I take 5 / 3; now the operation we have seen say modulo 7.

504
(Refer Slide Time: 27:40)

If the multiplication is modulo 7; that is multiplication modulo 7 is modulo 7


multiplication on Z7 then we know that 3 has some inverse, then the element 3 belongs to
Z7 has an inverse which is which is 5 because 3 x 5 modulo 7 is 1; multiplicative
identity; this is multiplicative identity. So, this is I know that 3 has inverse so, now, if I
do the 5 / 3 under modulo 7 operation then I can write this is 5 x 3 -1 modulo 7 and that is
5 x 5 modulo 7 and is 25 modulo 7 is 4. So, the result exist and since 4 is, 4 ∈ Z 7 so, this
forms a field.

So, if I take the coefficients and we take the instead of normal coefficients in Zp; so,
now, what is the conclusion? the; if the coefficients we are taking; coefficients we are
taking in some modulo n; that means, set is in coefficients set are in Zn; here the
examples then it forms a field. Why you are doing that thing, because if inverse exist
then we can take the we can do the division; then it forms a field and if it is field then
inverse exist and then division is possible say field ok.

505
(Refer Slide Time: 30:35)

Now; that means what? If I; if it is a polynomial; that means, my f(x) say f(x) is I take a
very simple example with 5x3 and say my g(x) is g(x) is 3x. So, division now if I
consider division I can do f(x) / g(x); f(x) divided by g(x) and that is equal to 5x3 /3x and
this is (5/3) (x3/x) is x2 and ordinary division I cannot get, but if the coefficient is in
modulo 7 then just now we have seen that it is 4x2.

Because if the coefficients; because 3-1 = 5. Just now we have seen coefficients in Z7
because 5 and 3, or 5, 3 ∈ Z7 because 0 to 6. So, then I can do the then division is
possible so, conclusion is then division is possible; that means, multiplicative inverse
exist and multiplicative inverse exist means the coefficient forms a field. Division is
possible if multiplicative inverse exist multiplicative inverse exists and multiplicative
inverse exist means and; that means, that is the coefficients form a field; that means, the
coefficients form a field.

So, why field is very important because then only I can do the division also; I can do all
the division etcetera. So, now, we will see that if I consider the polynomiality then it is
actually.

506
(Refer Slide Time: 33:11)

If the; if we consider polynomials we consider the polynomial because we are discussing


on polynomial arithmetic, polynomial whose coefficients are in Zp then it is called a
prime polynomial; then it is called a prime polynomial.

And some more definition on polynomial is very important and we will be discussing on
that; one is that called the irreducible polynomial and reducible polynomial. So,
irreducible polynomial that if the polynomial has no factor polynomial is has no factor
then if a polynomial f(x) has no factor; that means, it cannot be represented as a product
of two other polynomials; that means, it has no factor, product of two or more
polynomials. So, it is similar or analogous to the prime number.

So, if your polynomial cannot be represented as product of two or more polynomial then
it is irreducible polynomial and sometimes we analogy with irreducible is the prime; this
is called the prime polynomial. So, this is different this is not prime here.

507
(Refer Slide Time: 36:44)

Coefficients are in prime; consider polynomial whose coefficient are there; the; then the
coefficients form a field under modulo addition and multiplication. And if the
polynomial f(x) has factor then it is called reducible polynomial ok. If f(x) has factors;
has factor polynomials; that means, factor means it has, it can be represented as a product
of some other polynomials. So, what we see that if we; the, we started the discussion
with three; one the ordinary polynomial arithmetic and then the so, mainly we have seen
the ordinary polynomial arithmetic and the polynomial arithmetic where the coefficients
are the elements of some field. So, we have seen that if the coefficients form a field then
division is possible so, these two things we have done.

And now we will be in the; in our next lecture we will read this is the third one the when
the modular polynomial arithmetic; that means, the divisor or the, that can be treated as a
itself treated as a variable and we can take the modulo m(x) type of thing. So and
whether they form a field and what are the application areas of that. So, how finite fields
mainly this polynomial arithmetic, why it is important that we will be discussing in our
next lectures.

508
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 58
Finite Field and Applications (Contd.)

So, we are discussing the Finite Fields and their Applications. And, mainly how we can
construct a finite field? So, today we will continue that lecture on that polynomial
arithmetic, as we have read the last lecture that polynomial addition, subtraction,
multiplication, and then finally, how again we are able to do the polynomial division. So,
once the, we can do the polynomial division; that means, multiplicative inverse exist
over Z p today we will see that modular polynomial arithmetic, how they govern to make
or to construct some field.

So, first we will read them modular polynomial arithmetic.

(Refer Slide Time: 01:11)

So, if we remember that the example we have done that, first we have taken the field of
field we have done Z8 and we have seen that is not a actually that is not a field. If
whenever the all properties we have studied, but if we do the operation on modulo 7, it
has it becomes a field. And we concluded that actually the if we take the field the field is
Zp, where p is a prime and the modular arithmetic operations and modular addition and
multiplication.

509
Now, if Zp is a Zp forms a field under modular addition and multiplication, then Zpn also
forms a field. Here p is prime and n is some integer; n is positive integer. Now, if we
remember that whenever we have done the Z8, that we have studied the properties we
have seen that Z8 does not form a field. It is a ring, but since multiplicative inverse does
not exist for all elements of Z8 whereas, Z7 that is p = 7 form say field.

Now, 8 is 23. So, it is of pn form where p = 2 and n = 3. So, just now we have seen that or
we just mentioned that Z8 is not a we have earlier read that thing also Z8 does not form a
field, but now we are doing that comments we are making that Z23, how this becomes a
Z23 becomes a field becomes a field. And for that we will do the polynomial arithmetic
or modular polynomial arithmetic. So, this is our intention of this lecture.

Now, first we will see that we consider a set of polynomials.

(Refer Slide Time: 05:21)

A set is of all polynomials of degree less than equal to n - 1. So, we can write the
polynomials we write f(x) = an-1 xn-1, since highest degree is n – 1; an-2 xn-2x + … + a1 x +
a0 and we can write i = 0 to n – 1, sum ai xi.

Now, we consider the coefficients the coefficients that is the value of i that is ai this
belongs to some Zp; that means, we know we have defined Zp is 0 to (p – 1). So, the total
number of polynomials in the set S is pn since a can take pn number of values, because

510
each ai can take p number of values, a i can take p number of values, that is 0, 1, 2, up to
(p – 1), because as we wrote that ai ∈ Zp and Zp is 0 to (p – 1).

And see I have n number of coefficients a 0 to (n – 1). And so, if I consider as it places.
So, we have n number of a’s, so, the total number of terms in the polynomial or all
possible terms that will give 1 polynomial. So, all possible terms will be pn, ok. So, there
will be pn number of polynomials in the set. Now, we take some example.

(Refer Slide Time: 09:27)

We consider that p = 3 for example, 1 we consider p = 3 and n = 2.

So, pn is 32 ; that means, 9 polynomials are there in the set S. So, if we consider the
polynomial variable normally we call the indeterminate, if is x if the polynomial variable
that is the indeterminate is x it is then, what are the polynomials then the, these 9
polynomials these 9 polynomials are as follows see n = 2. That means, my ai can be only
0 and 1, p = 3. So, a will ai ∈ Zp and Zp is 0, 1, 2.

So, ai can take value 0, 1, 2; and n = 2. So, the degree of polynomial will be (n – 1)
polynomial is 1; that means, a1 x1 + a0. So, and this a0, a1 can take value from {0, 1, 2}.
So, if I take a1 = 0, if a1 = 0, then the first term will be 0 and a0 can be 0, 1, 2. So, the
polynomial the 3 polynomials we get the polynomials 0, 1, 2. Now, if I get a1 = 1,
because a1 can take. So, for a1 = 1 we get the polynomials x because 1 . x; so, x + 0 x.
So, I get x + 0 x + 1 x + 2.

511
Now, a1 = 2 the polynomials, or 2x + 0, 2x + 1, and 2x + 2 so, these are my 9
polynomials. So, these 32 because pn. So, these 9 polynomials when for pn, i write p = 3,
n = 2. So, are 0, 1, 2 then x, x + 1, x + 2, then 2x + 1, 2x, 2x + 1, and 2x + 2. So, these
are my 9 polynomials.

(Refer Slide Time: 14:33)

Now, if we consider another example, we consider another example 2; where we write p


= 2 and n = 3. So, that since pn so, is 23, that is there will be 8 polynomials in the set S.
And what are those polynomials? Similarly, if I consider the indeterminate as x so, here
p = 2. So, p = 2 that is Zp will be only 0 and 1 because it is 0 to (p – 1) and n = 3. So, the
degree of polynomial so, the polynomial if I write f(x) equal to it will be a 2x2 because (n
– 1) is 2, n = 3.

So, (n – 1) = 2 that should be my maximum degree of the polynomial, then a1 x + a0 so,


this time there will be 3. Now, we take if we consider a2 if a2 = now I have to take all
possibilities of a2, a1, a0. So, I can write a2 = 0 and a1 = 0, then a0 it can be 0 or 1; a0 = 0,
a2 = 0, a1 = 0; then a0 = 1. So, the polynomial is here f(x) = 0 here f(x) = 1.

Now, I consider a2 = 0, but a1 is 1 because they can take 0, 0 or 1 values. So, if a1 = 1,


then if a0 = 0 then, f(x) = x, if a2 = 0; that means, all possibilities we are taking a1 = 1 and
a0 = 1 then f(x) = x + 1. So, now, for we have taken a2 = 0 all these values. So, now, for
same thing we can do for a2 = 1.

512
So, this is actually for we have done a2 = 0, for all a2 = 0.

(Refer Slide Time: 18:39)

Now, we do for. So, this is if we continued, then for a2 = 1; I can write again all 4 values;
that means, a1 = 0, a0 = 0, a1 = 0, a0 = 1, a1 = 1, a0 = 0, a1 = 1, and a0 = 1.

So, since a2 = 1 so, always I get this x squared term should be always there. So, first I
write for all the polynomials here I get x2. Then it is all 0, 0; then here it is 0 + 1, here it
is x + 0, here it is x + 1. So, the 8 polynomials we got these the 8 polynomials; that
means, here 23, where p = 2, and n = 3, the polynomials are that we got 0, 1 x + 1.

So, polynomials are 0, 1, x + 1, then here we get x2 + 1, x2 + x, and x2 + x + 1. Now, we


can also represent these polynomials by binary codes. How see, here I have 3 terms.
Since I have the polynomial is of the form a2 x2, a1 x, and a0, then mainly that whatever
the value of a2, a1 is 0. So, that gives me these all these polynomials. So, if I write say
here mainly we are getting this for a2, a1, a0 where this a0, a1, a2 can take values from Z2,
because my p = 2; that means, 0 and 1; that means, 0 and 1.

So, if I take all possible values of these. And we will see here there are 8 and we know
from 0 0 0 to 1 1 1.

513
(Refer Slide Time: 22:11)

So, if I continue the next page if I write all possible values that a2, a1, a0 we give the
values 0 0 0, 0 0 1, 0 1 0, 0 1 1, 1 0 0, 1 0 1, 1 1 0, 1 1 1. So, we will we will give that see
0 0 0 means now if I write now the polynomials. So, the polynomial will be here 0.

As if this is my 0th term or if I again write that x0 if the position wise you can we can
write that as if this is my x0 term, this is x1 term, and x2 term, because it is a2 x2, a1 x1,
and a0 x0. So, I can write then it is 0, 0 and this is 1 x0 is 1. So, this is polynomial 1. Since
it is only 1 so, x, so, this is x this is 1 + x, this is x2 , this is x2 + 1, this is x2 + x and this is
x2 + x + 1.

So, actually the binary values when these it is in Z2; that means, it can take only 0 and 1.
So, that is why this is same as that of our binary codes and this gives this is the binary
representation of this polynomials. So, sometimes so, you also use this binary
representation if it is in Z2; that means, if my ai is are in if ai is ∈ Z2 since it is in binary;
that means, Z2 is 0 and 1. So, though we can there can be binary representation of
polynomial; that means if that particular term or is there a polynomial. On that particular
polynomial term is there then that coefficient is 1 that particular ai value is 1, if that
particular term is not there then the particular it is 0, like here they take an example of x2
+ 1 we take example of x2 + 1.

So, x2 + 1 we can write x2; that means, 1 . x2 + 0 into x because x term is not there and 1.
So, this is actually binary representation is 1 0 1. So, binary representation is 1 0 1 ok.

514
So, now, we have read that rules of arithmetic for the following when it is the
coefficients are in Z2 or Zp.

(Refer Slide Time: 26:17)

So, the coefficients, coefficients of the polynomial in Zp.

Now, once we get the set of polynomials and now we can do the modular polynomial
arithmetic; that means, that we can divide one polynomial by another polynomial and the
remainder will get we can use that thing. So, what we can write that if we multiply, if we
multiply two polynomials of set S, say f(x) and g(x) two polynomials f(x) and g(x) that
belongs to S. And, the we have considered the polynomial this is the polynomial S is the
set of polynomial of degree less than equal to (n – 1). So, S consists of polynomials of
polynomials of degree less than or equal to (n – 1).

Now, if the product becomes or the product is such that the degree that the degree of the
result polynomial; that means, the product polynomial degree of the resulting polynomial
is greater than n, because if we multiply two polynomials whose degree can be (n – 1)
then the it can be greater than n, (n – 1) because I have taken f(x) and g(x) maximum
degree can be up to (n – 1), then that will not be this result polynomial will not be in this
set S.

So, the way we have done the modular arithmetic. Now, if we consider an irreducible
polynomial m(x), which is analogous to a prime analogous to a prime. And, that is why

515
we call prime polynomial also, we have read that definition and we divide the product by
m(x); that means, divide f(x) into g(x) the product by m(x) and we get the remainder
r(x).

See then, if I want these remainder must polynomials must be in the set S. So; that
means, the degree of the polynomial r(x) must be less than equal to n, my less than equal
to (n – 1).

(Refer Slide Time: 31:557)

So, I take the if r(x) belongs to S we want that all remainder, then degree of all r(x) all
remainder polynomials must be less than equal to (n – 1), because we have considered
the set is a set of polynomial with degree less than equal to (n – 1). So, when can I get
some polynomials as the remainder whose degree will be less than equal to (n – 1), when
my divisor polynomial is of degree n; that means, that is my divisor polynomial my
divisor polynomial that m x must be of degree n, must be of degree n.

So, now if we summarize that f(x) g(x) again f(x) and g(x) are polynomials of degree (n
– 1), less than equal to (n – 1). I should write degree less than equal to (n – 1); m(x) is an
irreducible polynomial irreducible means that if it has no factor that we have read the
earlier. So, m(x) is a irreducible polynomial of degree n.

Then r(x) equal to the remainder polynomial, the remainder polynomial r(x) equal to
[f(x) x g(x)] mod m(x); that means, if it is remainder I can take modulo m(x). Now, this

516
is totally similar as a of modular arithmetic because m(x) is analogous to some prime
number p and this is a product. So, a mod n and the remainder I can take. So, now, with
all this set of polynomials, because r(x) is of degree n less than equal to (n – 1).

(Refer Slide Time: 35:35)

So, r(x) is belongs to S and now that we these r(x) gives the if we now consider the
modular polynomial arithmetic; modular polynomial arithmetic, then we will be using
my all my S the set with that all r(x), S all my r(x) that r(x) is the, r(x) is, I can write that
[f(x) x g(x)] mod m(x). So, this is the set and with this this is totally similar and we can
now we will be using this set to form the form a field.

So, we will we started our lecture that how Zp to the power n can form a can form a field
and what we have seen a p = 2 as an example n = 3. So; obviously, Z8 we have earlier
seen that normal modular arithmetic Z8 is not a field Z8 is not a field under for modular
arithmetic, normal modular arithmetic. Now, what we have done that we have got 8
polynomials.

So, now, under will show how we have to show how Z23 forms a field under modular
polynomial arithmetic. Since now we have 8 polynomials in the set. And in the next
lecture we will continue this is topic and we will see how we can form a field under
modular polynomial arithmetic.

517
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 59
Finite Field and Applications (Contd.)

So, in the last lecture we have seen that how that some polynomials we get. And we can
do or we can perform computation or under modular polynomial arithmetic. Now our
main objective is that how one field can be constructed under modular polynomial
arithmetic. Even that normal modular arithmetic that is not a field and Z8 and Z23 is the
example we have given.

(Refer Slide Time: 01:05)

So, we continue our lecture on modular polynomial arithmetic. And then mainly if I
summarize the last lecture what we have read, we have 2 polynomials f(x) and g(x) and
if I divide that thing by a irreducible polynomial of degree n. And we get the remainder r
x then we will be working on this set r(x) because r(x) is of degree (n – 1).

Since, m(x) has degree n irreducible polynomial. So, r(x) must be less than n; that means,
less than or equal to (n – 1), degree less than or equal to (n – 1). So, first we see one
example or that how we do this a division, because in previous lecture we have seen that
addition and multiplication and subtraction. So, now, we see the how we can divide and

518
take the remainder. So, we are taking one example, where we choose the irreducible
polynomial, where we work in it is of Galois Field of GF(28).

So, we have to take a m(x) is an irreducible polynomial of degree n; that means, here n =
8, pn. So, polynomial of degree 8, because we told that we are forming the field GF(pn).
So, p = 2, n = 8 ok. So, first we choose the m(x). Now, there are many irreducible
polynomial of degree 8, we choose here one very popular irreducible polynomial of
degree 8 normally this is used in the standard algorithm of AES in cryptography.

So, we choose m(x) = x8 + x4 + x3 + x + 1. This is one of the irreducible polynomial;


there are many irreducible polynomials of degree 8. So, we take one irreducible
polynomial here. And, we take f(x) now we have 2 polynomials was less than degree less
than 8.

(Refer Slide Time: 04:58)

So, let f(x) = x6, take that polynomials f(x) = x6 + x4 + x2 + x + 1, and g(x) is x7 + x + 1.

We remember that my m(x) again I repeat m(x) is x8 + x4 + x3 + x + 1. Now, we have to


do [f(x) x g(x)] mod m(x). So, first we multiply because we want to compute since we
are doing the modular polynomial arithmetic.

So, we want to compute r(x), which is equal to the [f(x) x g(x)] mod m(x). So, first we
have to multiply. So, we multiply [f(x) x g(x)], see f(x) is x6 + x4 + x2 + x + 1, and g(x) is

519
x7 + x + 1. So, if I just multiply. Normal multiplication this is so, x13, if I multiply with
x7 + x11, x9, x8 + x7.

Now, I write in the x term that x7 + x5 + x3 + x2 + x, 1 is left. So, 1 into this means the
f(x) only so, x6, x4, x2 + x + 1.

Now, see the coefficients are either 1 or 0, because that it is we are considering 28; that
means, my p is 2 if we remember my field is I am taking Z28. So, my p = 2; that means,
thus it will be in 0 and 1, Zp is Z2. So, Z2 is 0, Z2 is 0 or 1. So; that means, my
coefficients can be either; that means, my a can be either 0 or 1. Now, if I take since it is
Z2 so, the my addition will these computation will be coefficients when will be taking.

So, one thing we remember the coefficients or the arithmetic on coefficients is under
modulo p; that means, here modulo 2; that means, mod 2 addition and multiplication will
be doing.

So, here I will be doing here it will be modulo 2 addition and multiplication. So, what
will happen; that means, if I take it will be x13 will be there; x11, x9, x8, but see x7, and 7
since 1 + 1 is 0. So, there will be no x7 term because it is modulo 2. So, (2 + 2) modulo 2
is 0. So, there will be no x7. Now, x6, x5, x74, x3. Now, again one x2 and x, so, 2x2 and 2x
so, it will be 0 so, only 1.

So, this is my the product. So, my product is so, my this is my product is 1 + x3 + x4 + x5


+ x6 + x8 + x9 + x11 + x13, and we remember that the coefficients the arithmetic we are
following for coefficients, then that is modulo 2 addition and multiplication since we
here modulo 2, since details, since p = 2.

520
(Refer Slide Time: 11:24)

Now, we have to divide. So, we if I divide by m(x) now I have to do [f(x) x g(x)] / m(x),
because r(x) is the remainder we have to take. So, if I do that thing we remember our
m(x) is x8 + x4 + x3 + x + 1. Now, we divide and my product f(x) x g(x); g(x) is x13 + x11
+ x9 + x8 + x6 + x5 + x4 + x3 + 1.

So, now polynomial I have it is 8 and 13. So, if I multiply by 5 my quotient is 5 then I
can get x13, see 4 + 5 I have x9. So, I have I write since I have one x9 term. So, I can write
here x9, then x8, I have I have x6 also and I have x5. So, then this is normal addition and
since under modulo 2 addition the addition and subtraction are same. So, that is why we
are not using any minus sign, we write that under modulo 2 addition and subtraction are
same. So, we are not using any minus sign.

So, it is only x11. Then this will all cancel out then x4 + x3 + 1. So, since x8, so, I can take
x3. So, it will be x11 then see x7. So, I do not have any x7 term. So, I write x7 here x6. I do
not have an x6 term, then x4; I write x4, then x3. So, again if I give I get x7, x6 + 1.

Now, see that m(x) is of degree 8 and I get some remainder r(x). So, this is my r(x), I get
some r(x) = x7 + x6 + 1 whose degree less than equal to degree, less than 8 degree, less
than 8; that means, the degree of m(x); 8 is the degree of m(x). So, this is my, this is the
how we can form the remainder. So, this is modular polynomial arithmetic.

521
So, now, we can use instead of this; that means, my what it becomes that I can write that
r(x), I compute r(x) is [f(x) x g(x)] mod m(x) and I got this for these f(x) and g(x) value
the here my r(x) is I am getting r(x) is x7 + x6 + 1.

So, the similar to my polynomial arithmetic I normal modular arithmetic I got the
modular polynomial arithmetic. Now, we will be using this thing to form a field ok.

(Refer Slide Time: 16:25)

Now, we take our p is 2 and a 2 degree polynomial we take; that means, Z we take one
example and how we can example that forming a field in Z2; that means, when we are
telling Zpn that p = 2, n = 2.

So, again first we see what are the polynomials? Because, p = 2 means it is in Z2. So, that
is 0 and 1 coefficients can be only 0 and 1 and it is n = 2. So, my polynomial is f(x) is a1x
+ a0 only 2 values we know that all possible values of a1 and a0 ; that means, a1 is 0 can
take 0 0, 0 1, 1 0, 1 1 these are the 4 values, the way we have represented. So, my f(x) I
can directly write that f(x) the set of f(x) better I write the polynomials the set the set of
polynomials is consists of the of the polynomials 0 0 means 0, then 0 1 which is 1, then x
and 1 + x.

So, these are the, this is my polynomial set; that means, S is 0, 1, x and 1 + x. So, these
are my 4 polynomials now we remember that when will be coefficients for coefficients
arithmetic will be for coefficients arithmetic, that it is the under modulo 2 addition,

522
because modulo 2 addition, and multiplication and multiplication, and for the set of
polynomials. For polynomials arithmetic we will be considering, for polynomial
arithmetic will be considering modulo m(x) where here is this is of since they are less
degree 1. So, m x is of modulo m(x) is irreducible polynomial of degree 2.

(Refer Slide Time: 20:00)

So, if we just do that thing that we know that for degree 2 there are only 2 irreducible
polynomials. I take m(x) = 1 + x + x2 I take this is one irreducible polynomials. Now, if
we do the addition and modulo addition and multiplication table. So, if I consider
addition and multiplication table. So, this is modulo m(x) addition table I have 0, 1, x,
and x + 1, these are my 4 polynomials 0, 1, x, and x + 1; 4 polynomials I am doing
modulo addition.

So, 0 + 0 it is 0, 0 + 1 is 1, x + 1 simple modular and simple polynomial addition 1 + 0 is


1. Now, 1 + 1 is 2 and this is this becomes 0 because it is modulo 2 addition, so, it is 0.
Now, 1 + x, now 1 + x + 1 so, x plus 1 + 1 = 2 because coefficient arithmetic is modulo 2
so, this becomes x because 1 + 1 cancelled. Then x + 0 is x, x + 1 is x + 1, x + x again it
will cancel, then x + x + 1 this becomes 1, x + 1, then this is x this is 1, this is 0.

Now, we see 0 + 0 is 0, 1 + 1 that is 0, x + x is 0, x + 1 + x + 1 is 0, and 0 is the additive


identity. So, 0 is additive identity and x is itself the additive inverse said the additive
inverse of x, additive inverse of x. Now, if I consider modulo m(x) multiplication ok. So,
we consider now modulo m(x) multiplication table.

523
Now, for multiplication if the product becomes the degree is greater than the n, here it is
2, 1 multiplication table then we have to divide by this irreducible polynomial m(x) and
we have to take the remainder. So, again if I do the table 0, 1, x, and x + 1, here if I give
the modular m(x) multiplication, I will take 0, 1, x, and x + 1. So, 0 if I multiply the
coefficients so, it will it will be non-arithmetic modulo 2. So, it will be 0, only 0, only 1
if I multiply then the number itself, so, 1 into x, x into x + 1.

Now, x into 0 this will be 0 x into 1 this is x. Now, x into x this becomes x2 now see I do
not have any x2 in this element. Because, that my if I remember the, that my set, my set
was S; S was 0, 1, x, and x + 1. I do not have an x2, because the degree 2 is greater than
this m(x) has degree 2. So, I have to divide x2 by 1 + x + x2. And, if I do that thing just
you we will be getting that, if I divide x2, if I divide x2 by 1 plus, or x2 + x + 1, m(x),
then I will be getting 1 and this becomes x2 + x + 1. So, remainder is x + 1.

So, I will be giving this remainder instead of x2 I will take the remainder this is x + 1 that
is modulo m(x) we are doing. Similarly, if it is x2 + 1 and now we understand that if I
divide by it is x2 + x + 1. So, simply the x2 + 1 will go. So, this becomes x. Similarly,
now it is 0, it is x + 1, and here x(x + 1) is x2 + x and if I take modulo x2 + x + 1 my
m(x), then if I divide simply x2 + x and x2 + x will vanish so, it will be 1.

And, now if I multiply (x + 1)(x + 1), then (x + 1)(x + 1) this becomes x2 + x + x + 1 is


x2 + 1 again this is degrees more. So, I have to take modulo x2 + x + 1 and then x2 + 1
will go and x I will get.

Now, we see that if here it was multiplicative identity, sorry additive identity was 0.
Here, we see that other than 0 the way we have defined, we have for 1 we got
multiplicative identity 1, for x2 this will be, this will be 1, because x2 + x the 1 will be
there one. So, I get multiplicative inverse identity 1 here also I get 1.

That means here my additive identity it was there. And, similarly here I get my
multiplicative identity I get multiplicative identity for all elements other than 0 exist and
that is equal to 1. So, I have multiplicative inverse for all element other than 0, because I
am getting 1 for 1 multiplicative inverse is 1, for x multiplicative inverse is x + 1, for x +
1, multiplicative inverse is x, because x(x + 1) equal to 1. Since, I can write for x, x into,
say x(x + 1) = 1. So, multiplicative inverse of x is (x + 1) or the diverse multiplicative
inverse of (x + 1) is x, and for 1 it is 1 only.

524
So, what we see that the inverse exists so; that means, it will now it forms a, it will form
a field.

(Refer Slide Time: 30:18)

So, I can conclude that, we have taken Zpn; Z22 and the irreducible module m(x) we have
taken 1 + x + x2, this is important because selection of different irreducible polynomial
will give a different results. And, but it will that it Z22 what we see that Z22 means Z4.
See, is it is not a prime Z22 it is 4 is not a prime still Z4 forms a field. A when we have
converted this is the, this operation in modular or computation is modular polynomial
arithmetic. And then Z4 just now what we seen even the 4 is even 4 is not prime.

So, what earlier we have seen that in normal arithmetic normal modular arithmetic if
only Zp forms a field is not a prime. But, we have so, we have now we take that Zp earlier
we have seen from say field under normal modular arithmetic. And, what Zpn forms a
field under modular polynomial arithmetic. So, this is the conclusion that we make that
Zpn forms a failed. We will continue this lecture with some example the; we started in the
next class.

525
Discrete Structures
Prof. Dipanwita Roy Choudhury
Department of Computer Science & Engineering
Indian Institute of Technology, Kharagpur

Lecture - 60
Finite Field and Applications (Contd.)

So, we are discussing about modular polynomial arithmetic and in the last lecture we
have seen that how Zpn forms a field under modular polynomial arithmetic. We will
continue with this lecture with another example since we started our discussion with an
example that Z8 forms a ring, but not a field because under Z8 multiplicative inverse does
not exist. We have seen Z7 because 7 is a prime number so, it forms a field.

Now, this example will show that Z8 under normal modular arithmetic it does not form a
field, but Z8 under modular polynomial arithmetic it forms a field and will show this
thing.

(Refer Slide Time: 01:20)

So, we continue our discussion on Modular Polynomial Arithmetic. So, we here; we


have to; we are considering the example; example of we are taking it is Z23 because we
want to show Z23, Z8 forms a field under modular polynomial arithmetic. So, first we
have to take the set of polynomials.

526
Again what are the; we see the set of polynomials since it is pn, p = 2, n = 3; p = 2 is, p
is, Zp is 0 and 1 because it is Z2. So, we write it is Z2 is 0 1 1, n = 3. So, the polynomials
are f(x) is of the form a2 x2 + a1 x + a0 and earlier we have seen already this set of
polynomials S; if I consider the set of polynomials S = 0, 1, then x, x + 1, then x2, x2 + 1,
x2 + x earlier one example we have seen that already we have read this part that how we
get the full set of polynomials, because this is nothing but all possible combinations of
a2, a1, a0 where a2, a1, a0 all are elements of 0 and 1; Z2.

So, now this is my set of polynomials and we have to show that under a modular
polynomial arithmetic this thing so, I need a polynomial irreducible polynomial. So,
what is my irreducible polynomial; m(x) we have last class we have defined a irreducible
polynomial of degree 3 here because my degree n, say n = 3 for this example. Now there
are 2 irreducible polynomial m(x). There are 2 irreducible polynomial of degree 3; of
degree 3 and they are I can write one is m1(x) what is 1 + x + x3, another I can write
m2(x) is 1 + x2 + x3. So, I have to choose any one of this.

Let we will choose the m1(x); we consider m1(x) and we start to form the addition table
and the multiplication table.

(Refer Slide Time: 07:02)

So, first we formed our modular; the first we our m(x) we have chosen m(x) is 1 + x + x3
I write later, since I have polynomial 0, then I have polynomial 1, I have polynomial x, I

527
have polynomial x + 1, I have polynomial x2, then I have polynomial x2 + 1, I have
polynomial x2 + x and x2 + x + 1 these are my 8 polynomials.

First I do the addition and we are considering the m(x) is 1 + x + x3, now I have 0, 1, x, x
+ 1, these are my elements of the sets the all polynomials x2 + 1, x2 + x and x2 + x + 1.
So, here I have to do modular addition. This becomes 0, 1, x because already we have
seen additive identity is 0, x + 1. So, we will be getting the polynomial only, x2 + 1, x2 +
x, x2 + x + 1, if it is 1 + 0, 1 + 1 modulo 2 since my it is Z2 is 0, 1 so, modulo 2 addition.
So, this becomes 0, this becomes x + 1, this is x, x2 + 1, this is x2, because 1 will vanish,
this becomes x2 + x + 1, this becomes x2 + x.

If I add x this becomes x + 1, 0, 1, x2 + x, then x2 + x + 1, then x2, then x2 + 1, x + 1; x, no


x will vanish because x + x, 0 again this becomes 0, then x2 + x + 1. Now x + 1 + x2 + 1
means 1 will vanish; x2 + x, x + 1, x will vanish; x2 + 1 and this becomes x2, first against
the similar way I can compute the sum this becomes 0, this becomes 1, this becomes x,
this becomes x + 1, because x2 + x2, 0.

This is x2 + 1, this is x2, this is x2 + x + 1, then this is x2 + x, this is 1, this is 0, and this is
x + 1 and this is x. Now if I add x2 + x + 1, then x2, then x2 + 1 because x will vanish,
now x, then x + 1, then x2 + x; x will be 0, x2 + x this will be 1. Now x2 + x + 1, x2 + x, x2
+ 1, now x2, now this becomes x + 1, now this becomes x, this becomes 1, this becomes
0.

So, we observe some properties here; see the first thing is all the rules if I consider that
consists of all the elements of the set every row; that means, 0, 1, x, x + 1, x2, but in
different order it is there. Now we see the additive identity 0 + 0, 0; 1 + 1, 0; x + x, 0;
because we are taking the modulo 2 sum. So, additive inverse exist, if it is first thing is
this is additive identity. So, I write additive identity is 1 sorry additive identity is 0 and
additive identity that is 0 and then if I take the see additive inverse there must be additive
inverse. So, I get 0 + 0, 0; 1 + 1, 0; x + x, 0; that means, additive inverse is the element
itself. So, additive inverse of x is x itself; is x.

And see this is a closure property, because already we have seen that that table contents
only the set of elements of S only those polynomials. And since I want the additive
identity 0 and additive inverse and again it will be associative and closure, then
commutative, all the properties will be satisfied. So, under modulo addition that modulo

528
m(x) addition; it satisfy all the property. Now if we consider the modulo multiplication.
So, we write that this is our addition modulo, addition table modulo m(x) addition table.

Now, we consider the multiplication table.

(Refer Slide Time: 17:01)

So, I consider multiplication I have 0, 1, x, x + 1, x2, x2 + 1, I have x2 + x, and I have x2 +


x + 1 the all set of polynomials. Then I have 0 same 0, 1, x, x + 1, x2, then x2 + 1 and I
have x2 + x and x2 + x + 1.

Now, I write my m(x) because this time I have to take m(x) = 1 + x + x3 and I have to do
here since it is multiplication. So, I have to take the r(x) which is [f(x) x g(x)] mod m(x)
and here my f(x) and g(x) is belongs to S, where S is the set of all these polynomials. So,
S 0, 1, x, x + 1, x2, x2 + 1, x2 + x and x all 8 polynomials x + 1.

Now, if we do the multiplication modulo m(x) then 0 so, it will be 0 only, because 0
multiplied by any polynomial it will be 0. Now it is multiplied by 1 only so, the
polynomial itself. If I multiply with x; now this time I if the degree of the product
polynomial is more than the; more than 3 then I have to take the remainder. So, x into 0
is 0, x into 1 is x, x2 so less than x3 so, x2 I put this is x2 + x, this is x3, now it is x3 so, I
have to take the remainder. So, that mean x3 divided by 1 + x + x3 and we have seen that
is nothing but x + 1.

529
Now, again x into x2 + 1. So, it is x3 + x, x3 + x and this is x3 + x is there so, it will be 1
only. Similarly x3 + x2 so, now, if I divide x3 + x2 so, this becomes x3 will vanish, but x2 +
x + 1, now this becomes product is x3 + x2 + x so, this will be x2 + 1. So, I now I have to
take the remainder. So, similarly if I now compute that this will be 0, this is x + 1, now
x2 + x, now (x + 1)(x + 1), earlier we have seen this is x2 + 1 if I multiply and then take
modulo m(x) then this is x2 + x + 1, it is x2, then it is (x + 1) into this, this becomes 1 and
this becomes x only.

Similarly we can for x2 into 1 is x2. This is x3, so, divided by this; these becomes x + 1
again (x + 1)x2. So, x3 + x2, I can do the divided by this so, x2 + x + 1. Now, x4, if I
divide then x4 + x2 + 1 so, this becomes x2 + x. We can do quickly here that x2 and if it is
x4.

(Refer Slide Time: 23:59)

Just if I see that x4 and I divide it by x3 + x + 1 so, it will be x only so, x4 + x2 + x so, this
becomes x2 + x; so we write x2 + x. Now similarly if I do the, this one it becomes x, it is
x2 + 1 and this becomes 1.

Now, this is 0, this is x2 + 1, this is x3 + x so, this becomes 1, now this becomes x2, this is
x, this is x2 + x + 1, now x + 1 and this becomes x2 + 1 into this; this becomes x2 + x.
Similarly this becomes 0, x2 + x; now x3 + x2 so, this becomes x2 + x + 1, now this is 1,
this becomes x2 + 1, this is x + 1, now x and this becomes if I multiply it will be getting
x2 mod m(x) we are taking.

530
Now, this is 0, this is x2 + x + 1, now this is x2 + 1 because if I multiply x3 + x2 + x so, x
and x3 will go x2 + 1. So, this becomes x, this becomes 1, x2 + x, this becomes x2 and this
becomes x + 1. Now again if we observe the properties first other than 0; other than 0
elements we see that we have the 1 multiplicative identity in each row; that means, for all
elements I am getting 1; multiplicative identity is there and again here also we see that
for each the every row if we observe that all the elements appear in each row; that
means, for every multiplication modulo m(x) for one element we are getting all the set of
full set of elements.

So, multiplicative identity is there we write this thing is the modulo m(x) multiplication
table. So, what we observe that first is multiplicative identity exists and that is equal to 1
and we get also multiplicative inverse. Since for each element we are getting
multiplicative inverse like if we see that say for 1 it is 1 for x multiplicative identity is x2
+ 1, for x + 1 multiplicative identity is x2 + x because x + 1 in terms of it is 1.

So, we will be getting the multiplicative identity and if we remember that for under
modulo m(x) multiplication we will see also that it is a closure since all the set full set of
elements which we have seen that all the elements are under S. So, it is a closure
property then associative under because it is polynomial multiplication that already we
have seen and now we see that it is and again since it is multiplication of polynomial. So,
commutative also now multiplicative identity exists and multiplicative inverse also
exists. So, mainly multiplicative inverse is there; so it is integral domain now it is inverse
is there so, it forms a; this forms a field.

So, what we see that Z8; that means, Z8 forms a field under modulo under modular
polynomial arithmetic. Now we can see the how we can get the you can find the GCD
also by this method, since we know that GCD(a, b) = 1; that means, there will be no
factor; we can use that thing. Now another thing is we or sometimes we use in many
applications it is called the residue class.

531
(Refer Slide Time: 30:44)

For particularly for modular arithmetic this is very important so, we just do that thing
residue class see if it is defined normally that we here mainly that modular arithmetic we
use the remainder.

So, we can write this that as if a, when a is an integer; earlier we have defined and a is
congruent to r mod n. So, we can write all r’s whose remainder is same a is congruent r
mod n so, we can define this as a residue class. So, quickly if I just see; that means, if we
take residue class modulo 4; if I consider residue class modulo 4, then I can write
modulo 0 or class 0 this will be say if I start with 0 then 0, 4, 8, 12, all the elements I will
be getting that are multiple of 4. I will be getting that remainder 0 and here negative also
I will be getting - 4, - 8, all these elements I will be getting.

So, this is my set; now if I consider since modulo 4 means I have only set [0], [1], [2],
[3]. So, it is 1; if I write then similarly I can write it will be 5, 4 + 1, 9, 13, 17, like that
and similarly here - 3, - 4, + 1, - 7, etcetera and I give 2; then it is - 6, - 2, 0, 6, 10, 14, 18,
I again I add and 3; I will be getting similar way - 5, - 1, 0, 7, because 7 modulo 4 is 3,
then 11, 15, 19 in this way.

532
(Refer Slide Time: 33:52)

Now, when I am taking the polynomial this same thing we can do that if say if my S(x) is
1 + x + x2 then I can write because I am taking the modular S(x). So, I can write similar
way that this [0] is I take the set it is 0, 1 + x + x2, then x (1 + x + x2) this will be the
multiple of (1 + x + x2) and my set is x + 1. So, in this way I will I will be getting
similarly if it is [1] we have to add 1 just the way we have done 0 + 1, 1.

So, (1 + x + x2) this become (x + x2), these x (1 + x + x2) + 1, then this is (x + 1) (1 + x +


x2 + 1) + 1 in this way we will be getting. And if I continue I can get this is 2 then it is,
sorry, this is 0, 1, x sorry; this is polynomial we are taking. So, this is I have to take the
[x]. So, this becomes x, now (1 + x + x2) this become (x2 + 1), then this become x(1 + x
+ x2 + 1) + x, this becomes (x + 1)(1 + x + x2) + x and so on.

So, similarly in this way I can the I can form this residue class and it is of very important
when I have we do some applications and application area particularly in cryptography
we use and coding theory also we use this thing. So, we can write the totally similar way
only the, we are considering the polynomial is modulo S(x) we are doing.

So, here we are doing the modulo S(x). So, in this lecture what we see that how we can
form the finite field and even that it is normal modular arithmetic it is not a field, but
using modular polynomial arithmetic it forms a field.

533
(Refer Slide Time: 37:06)

So, actually this lecture we have mainly considered the construction of field using
modular polynomial arithmetic and there mainly we have used some of the, some
concepts irreducible polynomials as if a, like a prime and we have taken the remainders
when or the residues now I can take because just now we have defined the residue class.
So, residues when it is divided by that irreversible polynomial; result is divided so, we
have taken.

So, with this we finish our finite field and these applications of finite field lectures, and
with this finite field lecture also we actually our discrete mathematics class ends here. I
hope that some I have tried to explain the basics of discrete mathematics and it will be of
use and particularly in computer science and mathematics other branches also that how it
will be used, how the basic mathematics; the discrete mathematics is used. So, this class
will be useful to understand all those things.

Thank you.

534
THIS BOOK
IS NOT FOR
SALE
NOR COMMERCIAL USE

(044) 2257 5905/08


nptel.ac.in
swayam.gov.in

You might also like