0% found this document useful (0 votes)
789 views114 pages

Discrete Mathematics Notes Quantum City

Uploaded by

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

Discrete Mathematics Notes Quantum City

Uploaded by

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

DISCRETE MATHEMATICS

COURSE OF

Lectures by Deepak Poonia

References :
• Discreate Mathematics and its application by Kenneth H. Rosen 8th
edition
goclasses.in

INDEX
1. Mathematical Logic (2 to 7) - 6
2. First order logic (8 to 18) - 11
3. Set theory (19 to 46) - 28
4. Function (47 to 50) - 4
5. Group theory (51 to 62) - 12
6. Combinatorics (63 to 84) - 22
7. Graph theory (85 to 109) - 25

By Quantum City

Discrete
Mathematics course
of
Lectures by Deepak Poonia

Made by Quantum City


goclasses.in

1. Mathematical Logic

1.1) Introduction to Mathematical Logic :

Language for mathematics : Mathematical logic gives precise, Unambiguous meaning to mathematical
statements/theorems etc.

But why do we need a new language/logic for mathematics/computers?? Why can’t we use a natural
language, like English?? – Answer is Because all the natural languages are ambiguous. Example : “The
sun is shining and I feel happy.” What does this statement mean?

1. Does it mean that your friend is happy because the sun is shining?
2. Sun shining and his happiness are completely independent things?

Now, consider another statement “Cats are furry and elephants are heavy.” Both these statements
have exactly the same structure, but nobody would assume that elephants are heavy because of the
furriness of cats.

Mathematical logic resolves this ambiguity.

1.2) Propositional Logic :

Simply a world of true, false. The variable used is known as propositional variable or Boolean variable.

A proposition is a declarative sentence (that is, a sentence that declares a fact) that can be either true
or false; it must be one or the other, and it cannot be both. A proposition/statement is a declarative
sentence to which It is possible to assign a value of either true or false.

Example of propositions :

1. “Jaipur is the capital of the India.”


2. “Some cows are brown.”
3. “2 x 2 = 5.”

But What is NOT a proposition then? Answer is commands are not proposition, questions cannot be a
proposition and “x+2 = 2x” is not a proposition. Now consider following sentence : S : “S is false”. This
is declarative sentence but still if you assign S to true then it says S is false. Same sentence has two
values i.e. true and false. This type of sentence is called paradox.

Each proposition will be represented by a propositional variable. (generally, by any Upper alphabet
letter). Example : S = false. Then false is the truth value of proposition S.

1.2.1) Atomic and compound proposition :

An Atomic proposition is one whose truth or falsity does not depend on the truth or falsity of any
other proposition.

For example : “4 is a prime number.” This is propositioning whose value is false but it cannot be derived
from any other proposition. “4 is prime number, and New Delhi is the capital of India.” This is also
proposition but it is not atomic, is truth value depend on the truth values of two proposition. Atomic
proposition is, by itself true or false.

A single Boolean(propositional) variable p is referred to as an atomic proposition, since it does not


reduce further to other more basic propositions.

Made by Quantum City


goclasses.in

Note : New propositions (Compound) can be created from Atomic propositions with the help of
Logical connectives.

Associative (Anderbahar) : (a + b) + c = a + (b + c) and communicative : a + b = b + a

Examples of logical connectives :

Let P : 4 is prime number, Q : New Delhi is the capital of India.

1. 4 is prime number, AND New Delhi is the capital of India.


2. 4 is NOT a prime number.
3. New Delhi is the capital of India OR 4 is not prime number.

A Compound propositions are the propositions which are constructed by combining one or more
atomic propositions.

Some standard logical connectives :

1. NOT 4. Exclusive 6. Bi- 7. NAND


2. AND OR implication or 8. NOR
3. OR 5. Implication Double implication

1.2.2) Logical Connective :


Conditional Statements : The statement p → q is called a conditional statement because p → q asserts
that q is true on the condition that p holds. A conditional statement is also called an implication.
𝑆∶𝑃→𝑄
Question :
1) Filling the GATE exam application form is __ for cracking the GATE exam.
Answer : Always remember that sufficient means enough. So, filling the game exam application form
is enough for cracking the GATE exam. False because in addition to this you should have marks more
than cutoff then you are said to crake GATE exam. So, filling the GATE exam application form is
necessary for cracking the GATE exam. Necessary means without gate exam application form you
cannot crack GATE but it is one of the required conditions not sufficient condition. Necessary is subset
of sufficient. Answer is necessary but hold on. If you not fill the GATE exam application then you
cannot crack the GATE exam. This is true. If you write it in symbolic form then ¬p → ¬q. This is same
as q → p. so, P is necessary condition for q is same as q → p.
2) “Being Natural number” is __ for “Being integer number”
Answer : If I want integer and you give me some natural number then it is not necessary but it is
sufficient information that it is going to be integer only because every natural number is subset of
integer. So, answer is sufficient. This is same as If one number is natural number then it is also integer
number. But put that into reverse if one number is integer number then it is natural number. This is
false because integer number can be negative which is not natural. So, first statement is correct. i.e.
If one number is natural number then it is also integer number. This is nothing but p → q. So, P is
sufficient condition for q is same as p → q.
3) Studying chemistry is __ for cracking GATE CSE exam.
Answer : Sometimes question itself is wrong in this case it is neither necessary nor sufficient.
4) N being even is __ for N+2 being even.
Answer : if N is even then N+2 is even so it is sufficient. But if N is not even then N+2 is not even. So,
it is necessary also.

Made by Quantum City


goclasses.in
Different meanings of p → q :
• if p, then q” • “a sufficient condition for • “a necessary condition for
• “p implies q” q is p” p is q”
• “if p, q” • “q if p” • “q follows from p”
• “p only if q” • “q whenever p” • “q unless ¬p”
• “p is sufficient for q” • “q when p” • “q provided that p”
• “q is necessary for p” • “p only when q”

Converse, Contrapositive, And Inverse :


The proposition q → p is called the converse of p → q.
The contrapositive of p → q is the proposition ¬q → ¬p.
The proposition ¬p → ¬q is called the inverse of p → q.

Biconditional Statement : The biconditional statement p ↔ q is the proposition “p


if and only if q.” The biconditional statement p ↔ q is true when p and q have the
same truth values, and is false otherwise. Biconditional statements are also called
bi-implications. This means p ↔ q is equal to p → q and q → p. Now p → q means
q if p and q → p means q only if p so, if you combine them you get q if and only if p
or p if and only if q.
Different meaning :
“p is necessary and sufficient for q” “p iff q.”
“if p then q, and conversely” “p exactly when q.

1.2.3) Propositional formula/expression :


Every propositional variables or combination of variables are propositional formula or expression.
Example : ( q → ¬p ) → ( ¬t → r )
Examples which are not propositional formula : p q ¬, p → q r ¬

Propositional logic is collection/set of all propositional formulas.

Truth table : Truth table tell us about the truth values of a compound proposition for each
combination of truth values of atomic propositions.
Tautology (valid) : A Tautology is a wff (well-formed formula) for which all truth table values are T.
Contradiction(fallacy OR unsatisfiable): A contradiction is a wff for which all truth tables values are F.
Contingency : A contingency is a wff that is neither a tautology nor a contradiction.
Example : P ∨ ¬P is a tautology. P ∧ ¬P is a contradiction. P → Q is a contingency.

NOTE :
1) P is necessary condition for q only implies that without P, Q cannot happen (¬p → ¬q) which
in turn implies q → p.
2) Implication tells us property and Bi-implication tells us definition. p → q This also means q
is property of p. p ↔ q this means p is definition of q or q is definition of p.
3) Precedence of EXOR, NOR, NAND operator is not universally defined, it will be given in
question. Or you can solve those by expanding them to simpler logical connectives.
4) Propositional formula and compound proposition are same.

Made by Quantum City


goclasses.in

1.3) Case method :

We assign one truth value to one variable then check for truth value of expression. We do not have to
draw truth table.
Example : Consider p ∧ ¬(q ∨ p), Now consider only two case i.e. when p is true and when p is false.
So, when p is true. T ∧ ¬(q ∨ T). which is false and when p is false expression is false so expression is
contradiction.

1.4) Logical Equivalence :

The propositions are equal or logically equivalent if they always have the same truth value. If P and Q
are logically equivalent, we write P ≡ Q. Some author uses  this symbol.

1.5) English statements to propositional expression :

In logic, we have, AND = But = Although = Though = Even Though = However = Yet = Still = Moreover
= Nevertheless = Nonetheless = Comma.

1.5.1) Logic translation of different English word :

Unless : here is an example, (imagine a stubborn child “jen”)

Made by Quantum City


goclasses.in

“Jen won’t go to the party UNLESS Mary goes to the party.”; This sentence means if Mary doesn’t go
to the party then jen won’t go to the party.

Let, p = Jen won’t go to the party and q = Mary goes to the party. Above sentence can be written as
¬q → p

Another example, “I won’t study UNLESS you complete my demand”;

Let, p = I won’t study and q = you complete my demand. If you don’t complete my demand then I
won’t study (¬q → p).

Unless P, Q = ¬P → Q (just replace UNLESS with IF NOT/OR)

P unless Q = P if not Q = ¬Q → P = Q ∨ P. Which means unless is same as OR operation.

Another example : If you study well, you will crack GATE exam unless you make silly mistakes. Now
the question is which sentence to solve first. So, the answer is in English do not use precedence table.
Just go with the feel. In above example, we take “if you study well, you will crack GATE exam” as first
sentence so, let p = you study well, q = you will crack GATE exam and r = you make silly mistakes. So,
(p → q) ∨ r. because OR = UNLESS.

1.6) Logical arguments :

Argument in propositional logic is a sequence of propositions which includes premises/knowledge-


base/hypothesis/antecedents and conclusion.

Using only these standard rules of inference we can check validity of any arguments.

Example : “If it is raining, He’ll take umbrella.”, “It is not raining.” (This is called premises)

Can we infer “He’ll not take umbrella” ? (This is called conclusion)

Made by Quantum City


goclasses.in

Answer is yes, modes ponens.

Argument = Premises + Conclusion

We say that above argument (example) is valid. Argument is valid if, whenever the premises are true,
then the conclusion is true.

1.6.1) The inference symbol :

P1, P2, P3 hence C. This statement is valid argument iff P1 ꓥ P2 ꓥ P3 → C is a Tautology. We can also
write this statement in short mathematical form. P1, P2, P3 |= C or P1, P2, P3 Ⱶ C.

KB(knowledge base) |= y is equivalent to KB infers y; KB entails y; KB implies y; y is a consequence of


KB.

Fallacy of affirming the conclusion : ((p → q) ∧ q) → p (For p false and q true)

Fallacy of denying the hypothesis : ((p → q) ∧ ¬p) → ¬q (For q true and p false)

Made by Quantum City


goclasses.in

2. FIRST ORDER LOGIC


First order logic also known as Predicate calculus/ Predicate logic/ Quantificational logic.

WHY we need another type of logic when we already have propositional logic ? – Consider one
argument. “All men are mortal. Socrates is a man.”, “Hence, Socrates is mortal.” Unfortunately, there
is really no way to express this in propositional logic. Propositional logic has very limited expressive
power. But we know that above argument is valid. But we can’t prove so we extend our idea to first
order logic and second order logic.

So, what is the problem with propositional logic ? – It treats everything as True or false. We cannot
assign number to any variable. In real world we should talk about more than true or false. So, we
follow first order logic and higher order logic.

Definition : A world of objects, their properties, their relationships, their transformation(function)

So, what does FOL have, that propositional logic doesn’t ??

• First-order logic speaks about objects, which are the domain of discourse or the universe.
• First-order logic is also concerned about properties of these objects.
• Also, we have relations over/between/among objects (called predicates)
• In FOL, we also have functions of objects
• Another significant new concept in first-order logic is quantification: the ability to assert that
a certain property holds all elements or that it holds for some element.

First order logic = Proposition logic + Objects (Domain) + Their properties (Predicate) + Multiple
objects (Quantifier)

We are done with proposition logic. So, let’s start with remaining one.

Objects (Domain) : Set of value a variable can take. It is also called Universe. For exmple, the universe
of propositional logic is true or false. The universe of age is number. So, domain cannot be empty
unless it is explicitly given in question. And values in domain are called constant.

Predicate (Their properties and relationship) : Consider Domain be set of people : {ram, john, sita,
gita}. Let say x is variable from this domain. This domain has different properties like ram is male. Sita
is female. And They can also have relationship for example, ram is husband of sita. John is brother of
gita, etc. We represent these predicates by alphabet for example, C(x) = “x is clever”. And some x of
domain satisfies this property some don’t. This is called unary predicate. F(x, y) = “x is father of y”.
where x and y have domain of set of people. This is called binary predicate. And we also have ternary
predicate. So, predicate is a sentence containing variables (every variable refers to the domain) such
that it becomes a proposition once we replace each variable with specific value from its domain.

This is same predicate that we had seen in last chapter. But here we learnt it more rigorously.

Quantifiers : Quantifiers tell us about quantity of objects. For example, some, many, all, none, etc. In
FOL we have two quantifiers namely, for all and there exists or Universal quantifier and existential
quantifiers respectively. For example, consider of FOL where domain : set of all people, Predicate :
M(x) = “x is male”. And we say there exists x in the domain, M(x) is true. Which simply means every
person is male which is false. But it is predicate.

Made by Quantum City


goclasses.in

Universal Quantification : The universal quantification of P(x) is the proposition “P(x) is true for all
values x in the universe of discourse”. “For all x P(x)” or “For every x P(x)” is written ⱯxP(x). Here Ɐ is
called the universal quantifier. “An element for which P(x) is false is called a counterexample of ⱯxP(x)”

Let’s consider domain made up of {a,b,c,d} a finite set and a predicate P(x). Now, ⱯxP(x) means P(a) ꓥ
P(b) ꓥ P(c) ꓥ P(d). Ɐ is conjunction over finite domain.

Existential Quantification : The Existential Quantification of P(x) is the proposition “There exists an
element x in the universe of discourse such that P(x) is true”. “There exists x such that P(x)” or “There
is at least one x such that P(x)” is written ꓱxP(x). ꓱxP(x) is true iff there is at least one witness (an
element for which P is true). Here ꓱ is called existential quantifier. “All element for which P(x) is false
is called a counterexample of ꓱxP(x).

Let’s consider domain made up of {a,b,c,d} a finite set and a predicate P(x). Now, ꓱxP(x) means P(a) ꓦ
P(b) ꓦ P(c) ꓦ P(d). ꓱ is disjunction over finite domain.

Question :

1) If the domain is explicitly given as Empty, then How do Quantifiers behave ?

Answer : ⱯxP(x) this will be false if there is counterexample. So, if we have empty domain, we cannot
have any counterexample. So, Universal quantifier is true. Talking about existential quantifier ꓱxP(x),
ꓱ is true if we have one witness but if the domain is empty then we cannot have any witness. So, if
domain is empty then existential quantifier is always false.

Domain is always non-empty unless it is explicitly given

2) If there is no free variable then how does quantifier behave ?

Answer : Consider one proposition, P : “2+2 = 4”. We know that this statement is true. So, for every
element of domain this statement is true. That is why Universal quantifier is true. And if proposition
would be “2+2=9” Then for every element this sentence is incorrect. That is why universal quantifier
is false. Similar logic you can apply for Existential quantifier. Predicate will become proposition when
there is no variable or no free variable (which we shall see later in this chapter). That means if we put
value of x in predicate it will become proposition.

2.1) English-FOL translation :

Let, Domain : Set of all animals. And Predicate, cute(x) : x is cute.

1. Every animal is cute. = Ɐx cute(x)


2. Some animal is cute. = ꓱx cute(x)
3. Every rabbit is cute. = Now, Ɐx(rabbit(x) ꓥ cute(x)) This representation seems correct. But it is
not. It says “Every animal is rabbit and cute”. Correct alternative should be Ɐx(rabbit(x) →
cute(x)). If x is rabbit then it should be cute.
4. Some rabbit is cute. = ꓱx(rabbit(x)→cute(x)). This is false. Consider domain consists of {lion,
rabbit(which is not cute), tiger(which is cute)}. So now we know that there is no rabbit which
is cute. But ꓱx(rabbit(x)→cute(x)) this says it is true rabbit(x) is false for lion so the whole
expression is true. Because false implies anything is true. ꓱx(rabbit(x) ꓥ cute(x)) this is true.
Because it says There should be at least one x which is rabbit and cute. Now, consider previous
domain (lion domain). This expression is true.

Made by Quantum City


goclasses.in

In general, we can say that

All A’s are B’s. = Ɐx(A(x)→B(x)); Some A’s are B’s = ꓱx(A(x) ꓥ B(x)). That mean for Universal quantifier
we use implication and for existential quantifier we use conjunction.

5. Consider R(x) is “x is a rabbit” and H(x) is “x hops” and the domain consists of all animals. Then
translate ꓱx(R(x)→H(x)). It does not say “Some rabbit hops”. In this type of question where
existential quantifier is given with implication, we write ꓱx(¬R(x) ꓦ H(x)). Answer is “There are
animals which are not rabbit or hops”.
6. Consider domain : Set of all people and predicate, Male(x) : x is a male; Army(x) : x is in army.

Only males are in army. - Ɐx(Army(x)→Male(x)) it also means Ɐx(-Male(x)→-Army(x)).

All and only males are in army – This is combination of all males are in army and only males are in
army. First means Ɐx(Male(x)→Army(x)). And second means Ɐx(Army(x)→Male(x)). If we combine
these two, we get double implication.

2.2) Bounded variable and Free variable :

2.2.1) Bounded variable :

Consider : set of all-natural number. E(x) = x is even.

Ɐx E(x) – This is false we know but it is proposition. It says “All-natural number are even”. But
proposition should not contain any variable. And we know that each sentence means the same. So,
does it really contain variable ?

Again, let’s take another example,

Consider, Domain : {a,b,c} predicate, N(x) : x is nice.

Ɐx N(x) – N(a) ꓥ N(b) ꓥ N(c). Both means same. But one contains variable and one doesn’t. This variable
is called dummy variable or bounded variable or quantified variable. Why bounded because it is
bounded by quantifier.

So, does it really contain variable ? – Answer is yes. (dummy variable)

2.2.2) Free variable or Real variable :

Now, consider, Domain : Set of all-natural numbers.

E(x) : x is even. Clearly this is not proposition because it contains variable. But here one thing to note
that x can take any value. It can take one or more than one value. Don’t think about it is true or false.
But it is not bounded by any quantifiers so it is called free variable. In dummy variable, we cannot
assign value to variable. For example, let’s say similar domain but Ɐx E(x) and take x = 3. Ɐ3 E(3) this
makes no sense. But if you consider previous sentence E(x) only, it makes sense. That’s the difference
between these two variables.

Question :

1) Consider Domain : Set of all integers. Convert the following into a proposition. S(y) : ꓱx(x>y)

Answer : ꓱx(x>y) here x is not main variable it is bounded variable. Free variable is always main
variable. So, y is main variable that is why S(y) is given. Y is free to take any value under given domain

Made by Quantum City


goclasses.in

so this is not proposition. So, first we convert this sentence into proposition by putting some value
into y. S(4) = ꓱx(x>4) which says there must be one integer which is greater than 4 and yes, it is true.
You can put any integer into y. Let’s look at another approach.

Second approach, to convert any predicate into proposition is to remove free variable by converting
it to quantified variable. As we know that y can take any integer value, we use universal quantifier and
make y a quantified variable. Ɐyꓱx(x>y) This says for all integer there exists integer which is greater.
And yes, it is also true. Now we use existential quantifier instead of universal and check for the truth
value of proposition. ꓱyꓱx(x>y) which says there exists integer for which there exists integer greater
than it. which is true. It is not necessary to use both universal and existential, you can use only one.

A proposition can only contain bound variables, no free variables.

NOTE :

1) If “A” doesn’t have any free variable x then ꓱxA = A, ⱯxA = A.


2) While solving English to quantifier always go with meaning of statement. What you have
done is you have selected one correct option which matches with meaning of statement
then you have tried to select those option which is derived from selected option. Method is
correct like those options are also correct but look for meaning also.

2.3) Scope of quantifier :

A part of logical expression to which a quantifier is applied is called the scope of this quantifier.

What is the importance of scope of quantifier ?

Consider, Ɐx(smile(x) → wearhat(x)) and Ɐx(smile(x)) → Ɐx(wearhat(x)). Both have different meaning.
First say that “Every smiling person wear a hat” and second says “if all people are smiling then all
people wears hat”. So, in second one we can change dummy variable in second scope. i.e.
Ɐx(smile(x))→ Ɐy(wearhat(y)).

Consider domain consists of integer and you have predicate I(x) : x is integer, R(x) : x is real. If I(x)
appears in any quantified predicate then we know that I(x) is always true. And it is correct
representation (translation) if something about integer is asked and I(x) is used in it.

2.4) Nested Quantifier :

ⱯxⱯy (xy = yx) is the example of nested quantifier. But why do need nested quantifiers ? – Many
interesting statements in first-order logic require a combination of quantifiers. Eg. For every natural
number, there exists a greater natural number, some natural number is less than or equal to every
natural number. Note that the quantifier must be read from left to right. Eg.

Made by Quantum City


goclasses.in

For all x, there is a y, P(x,y) is true. We will study four combination of nested quantifier namely,

ⱯxⱯy P(x,y) ꓱxⱯy P(x,y)

Ɐxꓱy P(x,y) ꓱxꓱy P(x,y)

• ⱯxⱯy P(x,y) : This means for every value of x and for every value of y has property P(x,y).
• Ɐxꓱy P(x,y) : This means for all value of x there exists y such that P(x,y) is true. Remember here
for all value x there may be different value. Eg. Let x be student and y be course then all
students have taken some course.

• ꓱxⱯy P(x,y) : There exists one value x for all y such that P(x,y) is true. There is a student x has
taken all y course.

• ꓱxꓱy P(x,y) : There is one value for one value such that P(x,y) is true. Some student x has taken
some y course.

NOTE :

1) If quantifiers used in sentence is same then you can change the order of quantifier. But if
the quantifiers used is different for example, ꓱxⱯy to Ɐyꓱx or vice versa then it is not valid.

2.4.1) Numerical Quantification :

Now we will learn how to use FOL to express numerical quantifiers as the following : at least two, at
most one, exactly one, at least three , at most three, at most two, exactly two, etc.

Let’s take simple example and then we will eventually take hard as it goes…

Question :

1) There is at least one cube. - ꓱx Cube(x)


2) There are at least two cubes. - ꓱxꓱy (Cube(x) ꓥ Cube(y) ꓥ (x ≠ y)) why we have not used
implication because we have existential quantifier. You can extend this idea to at least three
also. Just add another variable z and make three condition which includes ≠. But here is
another question how do you express sentence when we say “There are at least 2 elements
in the domain” – Here we know that values are from domain directly so we do not have to
create any Cube(x) or something like that we can directly write ꓱxꓱy (x ≠ y). Similarly, for
“There are at least 3 elements in the domain” - ꓱxꓱyꓱz (x ≠ y ꓥ y ≠ z ꓥ x ≠ z ).
3) There is at most one cube. – Meaning in a domain if we have many cubes those cubes must
be same. Here you noticed we have used “if” and “many”. ⱯxⱯy ((Cube(x) ꓥ Cube(y))→(x=y)).
Similar to question 2 we ask for “There is at most one element in the domain” - ⱯxⱯy (x=y).

Made by Quantum City


goclasses.in

4) There is exactly one cube – There are two methods let’s see first. Exactly means at least one
and at most one. We have seen these cases previously. First is at least one means ꓱx Cube(x)
and at most means ⱯxⱯy ((Cube(x) ꓥ Cube(y))→(x=y)). We combine this expression with and
operator. So, final answer will be ꓱx Cube(x) ꓥ ⱯxⱯy ((Cube(x) ꓥ Cube(y))→(x=y)). Second
method is to observe that exactly means at least one and if that at least one cube matches
with all cube then both must be same. i.e. ꓱx (Cube(x) ꓥ Ɐy (Cube(y)→x=y)). At least one cube
will make surety that there must be cube and comparing this cube with other make sure that
selected cube is same as the cube in domain. Here x implies every shape in box or domain.
But if we assign x to be cube only then we can have another representation as follows, ꓱx Ɐy
(Cube(y) ↔ (x=y)). Why double implies because if we know x is cube(let’s say C1) and if all
shape is equal to x(C1) then they are also cube and C1.
5) There is at most 2 cubes – We follow the similar pattern as with at most one cube. We take
three cubes from all element in the domain and if they are cube then two of them must be
same. ⱯxⱯyⱯz ((Cube(x) ꓥ Cube(y) ꓥ Cube(z))→(x=y ꓦ y=z ꓦ x=z)).
6) There are exactly two cubes. – for exactly two cubes we should be at least two cubes then and
both should be different. Then we take all element and if that element is cube then it must be
equal to first or second cube. ꓱxꓱy ((x ≠ y) ꓥ Cube(x) ꓥ Cube(y) ꓥ Ɐz(Cube(z) → (x=z) ꓦ (y=z))).

Now we will see example of each 1 to 6 question.

E1) “For every number there is a larger number” Assume domain is set of numbers. –

E2) “There is a number that is larger than every other number”. Assume domain is set of numbers.

This looks correct but it says other number meaning x should not be equal to y.
Correct answer is

E3) “If one number is less than another, then there is a number properly between the two”. Assume
domain is set of numbers. -

This also looks correct but here they are not talking about specific two numbers. They are saying if
one number is less than another meaning for all numbers. They are not saying there is a number which
is less than another number. And you do not have to include not equal to condition because x<y make
sure that they are not equal.

E4) “There are infinitely many numbers which are prime.” Assume domain is set of numbers.

This is incorrect. It says at least. “Infinitely many numbers” is nothing but some number which is
greater than all other number and it should be prime.

E5) X is even number. – This means x can be represented as 2*something.

E6) P(X) : X is prime. – This means number should be greater than 1 and any number other than 1 or x
should not divide x.

2.4.2) Negation of quantifier :

We directly go to example,

E1) At least one person has a car. –

In short,

Made by Quantum City


goclasses.in

2.5) Validity, satisfiability in FOL :

Let M be a first order logic expression.

• M is valid iff M is always true (Whatever non-empty domain we take and whatever predicate
we take)
• M is satisfiable iff M is possible to be true (for some domain and some predicate)

So, is it valid ? Is it satisfiable ?? – yes If we have domain as natural number and


predicate as x > -1 then we can make S satisfiable. But can we say it is valid or always true no we can
have cases where it is not always true. See the definition it says you give me anything and it should be
always true then it is valid. I can take domain as natural number and predicate as x is even. Which is
false as natural numbers being not only even. Similarly, for existential quantifier.

Let’s take another example, this is satisfiable as we can always create specific
case where it is true. But is it valid ? – We know that x and y have common domain by default, this is
false when P(x) is false always and other is false. Let’s say P(x) is false means there does not exist a
single element for which P(x) is true. Which means ¬P(y) is true because as it says It is true when there
does not exist a single element. So, it is always true. And that is why it is valid.

Question is how to check if a FOL expression M is valid or not ?

Method 1 : Intuition and logical thinking (we saw this)

Method 2 : A systematic procedure

Procedure :

1. Take an abstract domain (abstract means don’t take natural number or something like that
take domain with no meaning or relationship like abcd), like {a,b,c,d,…}
2. Try to make M false somehow…
• If you can, M is invalid
• If you can never, M is valid.

Similarly, how to check if a FOL expression M is satisfiable or not??

Method 1 : Intuition and logical thinking (we saw this)

Method 2 : A systematic procedure

Procedure :

1. Take an abstract domain, like {a,b,c,d,…}


2. Try to make M True somehow…
• If you can, M is satisfiable.
• If you can never, M is not satisfiable.

Question :

1)

Answer : First saying for all element, P is true. But second is saying for at least one value P is false.
Which cannot happen simultaneously. This is contradiction meaning it is not valid and not satisfiable.

Made by Quantum City


goclasses.in

2)

Answer : This is not satisfiable and not valid. Because they can’t happen together. If OR connective is
given then it is satisfiable and talking about validity so we have some property which is false for some
element and true for some element in that each quantified predicate is false. So, not valid.

3)

Answer : It says P can be true for some element and false for another element. Yes, it is satisfiable.
But Consider for all element P is true, then as cannot have element for which P is false which contradict
second predicate. So, it is invalid.

4)

Answer : It is always true because if every element satisfies P then some element also satisfies P.
Which means it is valid and satisfiable. Now, here’s a cache, assume domain to be empty. Now first
predicate is true always and second predicate is false always so T→F is F. so; it is invalid after all?
Answer is no. Both cases are correct. In second case we have assume that domain is empty. And that
is why we do not take domain empty unless it is explicitly given.

Now, let’s see more on implication…

5)

Answer : We have to make first predicate true and second one false. This is always true because
properties of universal quantifier. In fact, reverse is also true. In short, we can put double implication
instead of implication.

6)

Answer : We know that for LHS to be true we have to make first and second predicate true. First says
P is true for all element and Q is also true for all element which implies that P is true for all element.
Which is always true. Now, take reverse i.e.

LHS says that P is true for all element and second predicate implies that P is true for element and Q is
also true. Now, we know that first and second are equal but consider a case where Q is false for all or
some element which means it is not always true. It is satisfiable but not valid.

7)

Answer : This is satisfiable. If for all P and Q is true. It is invalid because if some half of the element of
domain satisfies P and half of them satisfies Q then LHS is true but RHS is false. So, invalid. But take
reverse direction. It says for all P element P is true or for all element Q is also true. Which means If
one them is false then also RHS is true. So always true.

Distributive properties of quantifiers :

This is distribution of quantifier over logical connectives : let’s represent quantifier by some common
notation ( ) and connectives by ( ). We have to check,

Made by Quantum City


goclasses.in

Let’s take examples,

E1) - LHS says there is someone for


which both P and Q is true simultaneously while RHL says there is x such that P and there is x (may or
may not be same) such that Q. so it is true. Take reverse, it LHS says there is x for which P is true and
there is x (may be different from P) such that Q is true. Now, both x can be different for which P and
Q is true. So LHS is true but RHS is false. Meaning this is invalid.

E2) - It is invalid. As we can have some


common x for which P is true but Q is false. By doing so we have LHS true. But we can have some x
(not common) for which P is true and Q is also true. Then RHS is false. So invalid. But reverse is valid.
Because ExOR is true for either one of them should be true. So, let to be true and to
be false. . LHS says there is x for which P is true and for all x Q is false. So
RHS will automatically be true.

Similarly, we can prove many more and make table…

We define a new quantifier, uniqueness quantifier, the symbol of which is ∃!. For any predicate P and
universe U, ∃!xP(x) means there is exactly one element in the universe for which P is true.

E3) ∃!x(P(x) ∧ Q(x)) ⇒ ∃!xP(x) ∧ ∃!xQ(x) – First it seems like it is valid but look carefully, if we have
exactly one x for which both P and Q are true then RHS says we have exactly one x for which P is true
and exactly one for which Q is true. But in domain we can have some x which is not true for both but
it is true for either P or Q. In that case this will be false. Note that uniqueness means exactly one case
should exists (not at least or at most). P is prime minister and Q is women then there may be some
women who are not prime minister. In this case it fails.

Negation of uniqueness quantifier : Negation of uniqueness quantifier is nothing but either all should
not satisfy or at least two witness for which it satisfies. We can say that ¬∃!xP(x) is for every x in
domain either is should false or if there exists some x such that first witness and second witness is
different. i.e.

NOTE :

1) If you try to find truth value of ∀x[p(x)→¬r(x)] don’t replace it with expanded form. You can
replace one wff by other wff when it is double implication. Here only one direction
implication is there. i.e. ∀x[p(x)→¬r(x)] → [∀xp(x)→ ∀x¬r(x)] so you can’t replace first by
second. Try to find meaning instead, it says p(x)→¬r(x) should be true for all x. so come up
with counterexample. In short if anything is given like ∀x or ∃x then follow definition.

Made by Quantum City


goclasses.in

NULL Quantification :

We saw distributive properties of quantifier, Now see this

If A : “2+2=10” and we know that

We call this NULL quantification. Which means A has no free x. Which also mean that if some part of
expression has no free variable then expression is called NULL quantification. So, what so special about
it ? Let’s see one example,

i.e. If “A” does not have any free variable x then : create two cases : A = true ; A = false.

Expression is valid iff valid in both cases. If in some case invalid, then expression invalid. Do not blindly
see null quantification and select options, prove from above bold expression.

Sometimes we can use alternative form, example 𝐴 → 𝐵 ≡ ¬𝐴 ∨ 𝐵

2.6) Interpretation, Model in logic :

2.6.1) Interpretation, model in propositional logic :

If we have some propositional formula Let’s say G :

Then Interpretation means some truth combination of G (it might be true or false)

Definition : An interpretation I assigns a truth value to each atom.

So, let’s say I1 : a = T, b = F, c = F and we say I1(G) = T

For 2 variables How many interpretations of G ? – 22 interpretation. For n variable – 2n

We know that for some interpretation expression has true value and some have false values. In
propositional logic, Model is an interpretation for which expression is true. So, if we have system
consists of n variables and expression contains only m variable and P are models for expression then
we have total of 2(n-m) x P models. Co-model is an interpretation for which expression is false.

Interpretation = Model + Co-model

Let set of propositional logic expressions

KB = {E1, E2, E3,… En} then model is an interpretation for which E1 and E2 and … and En is true.

Example, KB = # interpretation = 8, #model = 2, #co-model = 6.

So, in propositional logic in terms of interpretation and models we can say that,

Made by Quantum City


goclasses.in

Tautology : Every interpretation is model, Contradiction : There is no model, Satisfiable : There exists
a model, Valid = satisfiable (both have same meaning in propositional logic but not in FOL)

2.6.2) Interpretation and model in first order logic :

Consider G :

What do we need to “interpret” G ? – You want predicate P(x) and domain. Combination of these two
things is called interpretation in first order logic.

Finite model : model with finite domain. Similarly, we can define finite co-model. Above example was
finite co-model.

Consider, we know that it is true if domain is not empty. But what if


domain is empty then is it true ? – Yes, it is always true (whatever interpretation we take and whatever
predicate we take). Every interpretation is a model in this example. So, we call this expression valid.

So, in first order logic, valid : always true (no co-model), satisfiable : there exists a model, unsatisfiable
: All interpretation is co-model.

Tautology in first order logic : A tautology in first-order logic is a sentence that can be obtained by
taking a tautology of propositional logic and uniformly replacing each propositional variable by a first-
order formula (one formula per propositional variable). For example, because is a tautology
of propositional logic, is a tautology in first order logic. Here expression
only contains one variable i.e. A. But if we have more than one variable then we assign each variable
(like A, B, C) a unary relation symbol ( ).

In short, we can summarize the meaning of each terms


Terms Propositional Logic First order logic
Valid There exists a model There is no co-model
Satisfiable There exists a model There exists a model
Unsatisfiable There is no model There is no model
Tautology There is no co-model Discussed
Contradiction There is no model There is no model

Made by Quantum City


goclasses.in

3. Set theory

3.1) Introduction :

Definition : Set is a collection of objects.

Set notation : Curly braces with commas separating out the element.

For example, set of English vowels can be represented by {a, e, i, o, u}.

Two sets are equal when they have the same contents, ignoring order. {a, b, c} = {b, a, c}

Set cannot contain duplicate elements. Any repeated elements are ignored. {a, b, b, b, c, c} = {a, b, c}

Set may contain anything. {a, b, c, 1, 2, {Gujarat, Bengal, Maharashtra}, hoes, b*tch}

So more formally we can say that A set is an unordered collection of distinct objects, which may be
anything (including other set}.

How many elements does the following sets have ? – {a, b} = 2 elements; {a, b, a, a} = 2 elements; {b,
a} = 2 elements; {a, b, a, a, 1, 1, 2, 3, 2, 2} = 5 elements.

Membership : Let S = {a, b, c}, we say element “a” belongs to set S. We represent this using a ∈ S,
element “d” is not belonging to set S can be represented by d ∉ S. ∈ is called set membership symbol.

Question :

1) 1 = {1} Are these objects equal ? – first 1 is number and {1} is set containing 1 number. So,
both are different things.
2) Let S = {a, b, c}.
(i) a ∈ S – True. Because a is element of S.
(ii) {a} ∈ S – false. Because {a} is not element of S.
(iii) {a, b, c} ∈ S – False. Because {a, b, c} is not an element of S.
(iv) {a, b} ∈ S – False.
3) What is the set of all prime numbers between 14 to 16 (inclusive) – We know that there are
no prime number between 14 to 16. Therefore, S = { } = ∅. This is called NULL set or Empty set
where number of elements in set is zero. We represent this empty set by ∅ symbol.
4) S = {∅} = ∅ are these objects equal ? – first is set containing empty set and second is empty
set. So, cardinality of first set is 1 and that of second is 0.

Terminology related to sets :

• Finite set : A set with a limited number of elements or A set in which number of elements is
equal to some whole number (0, 1, 2, 3,..). Example : D = {dob, cat, fish, frog}
• Infinite set : A set with an unlimited number of elements. Example : N = {1, 2, 3, 4, …}
• Cardinality of Set : Number of elements it contains. (already discussed)

3.1.1) Set representation :

Consider the set of all prime numbers less than 10.

Above question is also a representation of some set it is called verbal representation. {2, 3, 5, 7} this
is called list representation or roster representation. Below is called Venn diagram.

Made by Quantum City


goclasses.in

Another representation is famous known as Set-builder representation.

S = {x|some property that x must satisfy} = { x | p(x)}

In our example, we write S = {2, 3, 5, 7} = { x | x is prime and x < 10}

Let’s take another example, Even natural numbers can be represented as

{ n | n ∈ N and n is even }

3.1.2) More about sets :

1) Subset : It is sub collection of set. If set A is subset of set S then we represent it as 𝐴 ⊆ 𝑆. We


can represent 𝐴 ⊆ 𝑆 in first-order logic as ∀𝑥(𝑥 ∈ 𝐴 → 𝑥 ∈ 𝑆). ⊆ this symbol is called “subset
of”.

Let S = {a, b, c}, subsets of 𝑆 ∶ ∅, {𝑎}, {𝑏}, {𝑐 }, {𝑎, 𝑏}, {𝑏, 𝑐 }, {𝑎, 𝑐 }, {𝑎, 𝑏, 𝑐 }

From above subset of S we can conclude that every set is subset of itself. Which means 𝑆 ⊆ 𝑆, ∅ ⊆ ∅

Note that if we have S = {a, b}, ∅ ⊆ 𝑆. This is true because empty set is subset of every set. ∅ ∈ 𝑆 This
is false because empty set is not an element of S.

Let’s take one beautiful example,

S = {1, {2, 3}, 4}. We know that it has three elements. Now answer following question.

1) {1} ⊆ 𝑆 True. Because {1} is subset of S. but 1 ⊆ 𝑆 this is false. As here 1 does not represents
set it represents number 1 not set.
2) {1} ∈ 𝑆 False. Because {1} is not member of S. But 1 ∈ 𝑆 this is true. Because 1 is member of
S it is not subset of S.
3) {2} ⊆ 𝑆 false. Because in {2} we have element 2 but in set S we don’t have element 2 we have
{2,3} as an element.
4) {2, 3} ⊆ 𝑆 false. Because {2, 3} is not set it is element but {{2,3}} ⊆ 𝑆 is true and {2, 3} ∈ 𝑆 is
true.

2) Proper subsets : A proper subset of a set S is a set T such that


• 𝑇⊆𝑆
• 𝑇≠𝑆

There are multiple notations for this; they all mean the same thing: 𝑇 ⊂ 𝑆, 𝑇 ⊊ 𝑆.

Let S = {1, 2} proper subsets of S are ∅, {1}, {2}

3) Powerset of a set : The set of all subsets of a set S is called powerset of S. The notation for the
powerset of S is P(S). 𝑆 ∈ 𝑃(𝑆) and 𝑆 ⊈ 𝑃(𝑆)

Made by Quantum City


goclasses.in

Let S = {a, b, c}, subsets of 𝑆 ∶ ∅, {𝑎}, {𝑏}, {𝑐 }, {𝑎, 𝑏}, {𝑏, 𝑐 }, {𝑎, 𝑐 }, {𝑎, 𝑏, 𝑐 } and powerset of S (set of all
subsets of S) : {∅, {𝑎}, {𝑏}, {𝑐 }, {𝑎, 𝑏}, {𝑏, 𝑐 }, {𝑎, 𝑐 }, {𝑎, 𝑏, 𝑐 }}. Cardinality of powerset is 2n. where n is
number of elements in set S.

Now, what is P({}) or 𝑃(∅) ? – Powerset of ∅ : {∅}. We know that |∅| = 0 but |𝑃(∅)| = |{∅}| = 1. If
you have doubt then in powerset or while taking subsets we select element from { } we do not consider
whole { }.

Again, what is P({∅}) ? – powerset of {∅} : {∅, {∅}}. We know that |𝑃({∅})| = |{∅, {∅}}| = 2

What is |P(P(S))| ? – It is talking about cardinality of powerset of powerset. We know that if set
contains n element then powerset contains 2n element. Now, cardinality of powerset of those 2n
element will be 2(2^n).

3.1.3) Set operations :

Universal set : The Universal set U is the set containing everything currently under consideration.
Content depends on the context. Sometimes explicitly stated, sometimes implicit.

Let’s take an example of problem which includes vowels. Then possible universal sets are :

1) {a, e, i, o, u}
2) English alphabet
3) All alphabets of all languages
4) {a, e, i, o} – This cannot be universal set as it does not contain element u which completes set
asked in problem.

Recall that we have +, -, x,… operations for numbers and we have ∧, ꓦ, →,… for propositions. So,
question is what kind of operations do we have for sets ? – Union, intersection, difference,
complement, … and not only that but we apply operations on number we get number as output, we
apply operations on propositions we get proposition as output. Similarly, we do operations on set and
we get output as set only.

1) Intersection : Suppose M is the set of students who love mangoes, and N is the set of students
who love kiwis. Then, 𝑀 ∩ 𝑁 : the set of students who love mangoes and kiwis. We represent
it in set builder form as 𝑀 ∩ 𝑁 = {𝑥|(𝑥 ∈ 𝑀)⋀(𝑥 ∈ 𝑁)}.
If A and B are sets and 𝐴 ∩ 𝐵 = ∅ then we say that A and B are disjoint, or disjoint sets.
2) Union : Suppose we take same set as in intersection. 𝑀 ∪ 𝑁 = {𝑥|(𝑥 ∈ 𝑀)⋁(𝑥 ∈ 𝑁)} = The
set of students who love mangoes or kiwis (or both).
3) Set difference : The set of students who love mangoes but not kiwis = 𝑀 − 𝑁 =
{𝑥|(𝑥 ∈ 𝑀)⋀(𝑥 ∉ 𝑁)} = 𝑀 ∩ 𝑁 ̅
4) Symmetric difference (exclusive or) : The set of students who love or mangoes but not both.
𝑀 △ 𝑁 = 𝑀 ⊕ 𝑁 = {𝑥|(𝑥 ∈ 𝑀) ⊕ (𝑥 ∈ 𝑁)} = (𝑀 ∪ 𝑁) − (𝑀 ∩ 𝑁) = (𝑀 − 𝑁) ∪ (𝑁 −
𝑀)
5) Complement : The set of students who don’t love mangoes = 𝑀 ̅ = {𝑥|𝑥 ∉ 𝑀}
6) Cross product : The set of ordered pair of students = 𝑀 × 𝑁 = {(𝑥, 𝑦)| 𝑥 ∈ 𝐴, 𝑦 ∈ 𝐵}

These operations are not binary in nature you can apply operation on multiple set also.

Let’s look at some membership problem which includes set operations :

1) 𝑥 ∈ (𝐴 ∩ 𝐵) – means 𝑥 ∈ 𝐴 𝑎𝑛𝑑 𝑥 ∈ 𝐵
2) 𝑥 ∈ (𝐴 ∪ 𝐵) – means 𝑥 ∈ 𝐴 𝑜𝑟 𝑥 ∈ 𝐵 𝑜𝑟 𝑏𝑜𝑡ℎ

Made by Quantum City


goclasses.in

3) 𝑥 ∈ (𝐴̅ ∩ 𝐵) – means 𝑥 ∉ 𝐴 𝑎𝑛𝑑 𝑥 ∈ 𝐵

3.1.4) Set equality : Suppose A and B are sets. Then 𝑨 = 𝑩 if and only if 𝑨 ⊆ 𝑩 and 𝑩 ⊆ 𝑨. This fact
is often used to prove set identities.

Let’s discuss two approach to conclude that two sets are equal.

(𝐴̅ − 𝐵) − 𝐶 = (𝐴̅ − 𝐶 ) − (𝐵 − 𝐶)

Method 1 : using Venn diagram,

Method 2 : Using analysis, we use definition of A = B discussed above.

Similarly, we prove that

Made by Quantum City


goclasses.in

Question :

1) How may subsets and proper subsets does set A have if it contains 3 elements ?

Answer : n = 3, subsets = 2n = 23 = 8, proper subsets = 2n -1 = 7

2) For any sets A, B, C, D and E where 𝐴 ⊆ 𝐵 ∪ 𝐶, 𝐵 ⊆ 𝐷, 𝑎𝑛𝑑 𝐶 ⊆ 𝐸, show that we have 𝐴 ⊆


𝐷 ∪ 𝐸.

Answer :

3.1.5) Set Identities :

• Identity laws : 𝐴 ∪ ∅ = 𝐴, 𝐴∩𝑈 =𝐴

Let # be any operator on set, Identity element “e” for operation should satisfy X # e = X and e # X = X.

𝐴 ⊕ ? = 𝐴 ⟹ 𝐴 ⊕ ∅ = 𝐴 so, here identity element is ∅ for ExOR operation. But for set difference
operator 𝐴 − ∅ = 𝐴 is true but ∅ − 𝐴 ≠ 𝐴. So, no identity element exists for set difference operator.

Similarly, 𝐴 × ∅ ≠ 𝐴 Not only this but there does not exits identity element for cross product operator.
But 𝑨 × 𝑩 = 𝑨 𝒊𝒇𝒇 𝑨 = ∅

• Domination laws : 𝐴 ∪ 𝑈 = 𝑈, 𝐴 ∩ ∅ = ∅
• Idempotent laws : 𝐴 ∪ 𝐴 = 𝐴, 𝐴 ∩ 𝐴 = 𝐴
• Complementation law : 𝐴̿ = 𝐴
• Complement laws : 𝐴 ∩ 𝐴̅ = ∅, 𝐴 ∪ 𝐴̅ = 𝑈
• Commutative laws : 𝐴 ∪ 𝐵 = 𝐵 ∪ 𝐴, 𝐴 ∩ 𝐵 = 𝐵 ∩ 𝐴
• Associative laws : 𝐴 ∪ (𝐵 ∪ 𝐶 ) = (𝐴 ∪ 𝐵) ∪ 𝐶, 𝐴 ∩ (𝐵 ∩ 𝐶 ) = (𝐴 ∩ 𝐵) ∩ 𝐶
• You know distributive laws and De Morgan’s laws :
• Absorption laws : 𝐴 ∪ (𝐴 ∩ 𝐵) = 𝐴, 𝐴 ∩ (𝐴 ∪ 𝐵) = 𝐴

Precedence of set operators : 𝐴̅ > ∩ > ∪

3.1.6) Proofs involving power sets :

1) We know that if 𝑥 ∈ 𝑃(𝐴) then 𝑥 ⊆ 𝐴 and if 𝑥 ⊆ 𝐴 then 𝑥 ∈ 𝑃(𝐴). From these two sentences
we can conclude that 𝑥 ∈ 𝑃(𝐴) 𝑖𝑓𝑓 𝑥 ⊆ 𝐴.
2) Every element in P(A) is a set. (empty or non-empty)

Now, using these two properties let’s prove see one example,

For any sets A and B, show that we have 𝐴 ∩ 𝐵 = 𝐴 if and only if 𝐴 ∈ 𝑃(𝐵) – Here if and only if is given
which means we have to prove in both directions. First let’s prove right implication. From first we can
say that RHS is equivalent to 𝐴 ⊆ 𝐵. Therefore, now we have to prove if 𝐴 ∩ 𝐵 = 𝐴 then 𝐴 ⊆ 𝐵.

Converse is also true. Means both directions are valid.

Made by Quantum City


goclasses.in

Suppose A and B are sets. Show that 𝑃(𝐴) ∩ 𝑃(𝐵) = 𝑃(𝐴 ∩ 𝐵). – This P is not of probability. This is
powerset notation. LHS means some subsets of A and B are common. This also means some element
of A and B are common which is nothing but RHS.

Show that if A and B are sets, and 𝑃(𝐴) ⊆ 𝑃(𝐵), then 𝐴 ⊆ 𝐵. – Powerset contains all the possible
subsets of a set. If one set of subsets are subsets of some other set of subsets meaning those elements
are common in both sets. So, 𝐴 ⊆ 𝐵.

3.1.7) Ordered Pairs and Cartesian (cross) Product :

It is a sequence of two elements a, b, where order matters and repetition matters. Notation : (a, b)

You can also compare it’s features with sets : In set, Order doesn’t matter, repetition doesn’t matter.
In ordered pairs, order matters, repetition matters.

When can we say that ordered pairs are equal ? – this is same as asking when (a, b) = (c, d). This can
only happen when a = c and b = d.

Similarly, we also have another type of structure also called sequence.

1) Set (finite or infinite) : Order doesn’t matter, repetition doesn’t matter.


2) Ordered n-tuple (finite) : Order matters, repetition matters.
3) Sequence (finite or infinite) : Order matters, repetition matters. Notation for sequence is < >
where we can write <1, 2, 3, 4, …> Only difference between ordered n-tuple and sequence is
that ordered n-tuple is finite and sequence can be finite or infinite and yes notation.

Cartesian Product :

𝐴 × 𝐵 = {(𝑥, 𝑦)|𝑥 ∈ 𝐴 𝑎𝑛𝑑 𝑦 ∈ 𝐵}

𝐵 × 𝐴 = {(𝑥, 𝑦)|𝑥 ∈ 𝐵 𝑎𝑛𝑑 𝑦 ∈ 𝐴}


In general, we can say that 𝐴1 × 𝐴2 × … × 𝐴𝑛 = {(𝑥1 , 𝑥2 , 𝑥3 , … )|𝑥𝑖 ∈ 𝐴𝑖 }

Cardinality of cartesian product : Let we have set A and B such that |A|=m and |B|=n then |𝐴 × 𝐵| =
𝑚𝑛
What is 𝐴 × ∅ ? – Let’s say A = {1, 2} so, 𝐴 × ∅ = {(𝑥, 𝑦)|𝑥 ∈ 𝐴; 𝑦 ∈ ∅}. 𝐴 × ∅ = {(1, ? ), (2, ? )} but
∅ does not contains any elements so, no pairing is possible and it will be empty set. 𝐴 × ∅ = ∅.

When 𝐴 × 𝐵 = 𝐵 × 𝐴 ? – if A = B or if 𝐴 = ∅ 𝑜𝑟 𝐵 = ∅.

Some useful properties of cartesian product : it is neither associative nor commutative.

Q : What is the meaning of {1, 2}4 ? – we know that simple {1, 2} is it a set now, {1, 2}2 meaning it is a
relation {1, 2} × {1, 2} = {(11), (12), (21), (22)} similarly {1, 2}4 = {(1111), (1112), (1121),…(2222)}

3.2) Relations :

Made by Quantum City


goclasses.in

Relation can be seen in many areas. Let’s take Facebook friendship example,

We write it as a R 3 or b R 1… Can we say cross product is relation because it is also ordered pair (a, b)
where a is related to b ? – Answer is yes. Let’s look at definition,

Definition : A binary relation R between two sets A and B (which may be the same) is a subset of the
Cartesian product A X B. If the element 𝑥 ∈ 𝐴 is related by R to the element 𝑏 ∈ 𝐵, we denote this fact
by writing (𝑎, 𝑏) ∈ 𝑅, or alternately, by a R b. We say that R is a relation on A and B.

A relation on a set A is a subset of A x A.

Let’s answer some interesting question,

1) Is relation from A to B are one-way ? – question asks to prove if a R b then b R a ?. Consider


following example of relation between student and course offered.

Can C1 R a ? – Definitely not how come course can take student this is nonsense sentence.

Let’s take some problem related to notation,

2) If A is related to B we write 𝑅 ∶ 𝐴 → 𝐵. we also write this as x T y iff R (some relation like x+y=1
or something). How to write 𝑇: 𝑁 × 𝑁 → 𝑁 ?

Answer : Note that relation is from N x N to N which means we have (a, b) relation on LHS and a on
RHS. So, we write (a, b) T y iff a+b=y. Here a+b=y defines the relation and (a, b) represents the terms
of N x N. we can also say that relation 𝑇 ⊆ (𝑁 × 𝑁) × 𝑁.

3) We know that 0 ÷ 0 = 𝐼𝑛𝑑𝑒𝑟𝑚𝑖𝑛𝑎𝑡𝑒 but what is 0 / 0 ?


Answer : Remember 0 ÷ 0 here answer is some number and 0/0 is asking is 0 divides 0. In such cases
we have to apply definition. a/b means b = an where n is some integer. So, 0/0 is also true as 0 = a. 0.

3.2.1) Counting number of relations :

Now, let’s take one question say if we have two sets A and B. How many different numbers of
relationship can they have ? – Let’s say A = {1, 2} and B = {a}.

We know that 𝑅: 𝐴 → 𝐵 𝑎𝑛𝑑 𝑅 ⊆ 𝐴 × 𝐵.

Made by Quantum City


goclasses.in

i.e. every relation from A to B is subset of A x B. Every subset of A x B is a relation from A to B. Which
means Number of relations = Number of subsets of A x B. = 2|A x B| = 2|A| x |B|

3.2.2) Relation on a set :

Say we have relation 𝑅: 𝐴 → 𝐴. Then which of the following is true ?

a is related to c – True

c is related to a – False

a, c are related – Ignore writing this this is nonsense

a, c are related to each other. – It means a R c and c R a which is false here in this case.

In above example we saw interesting type of relation which is 𝑅: 𝐴 → 𝐴. We call it R is on set A. Which
means if I say R is on set N x N. it means 𝑅: 𝑁 × 𝑁 → 𝑁 × 𝑁. Which also means 𝑅 ⊆
(𝑁 × 𝑁) × (𝑁 × 𝑁).

When we say R is on set N x N. we know all about this from previous example. How to represent it in
a R b iff R form. Answer is (a, b) R (c, d) iff a = c or b = d. From this answer following question :

1) (1, 1) R (1, 1) – Correct because a = c or b = d


2) (0, 1) R (0, 2) – Incorrect because (0, 1) is not in our base set N x N (here N is natural number
and 0 is not natural number)
3) (-1, 1) R (-1, 1) – Incorrect because (-1, 1) is not in our base set N x N.

Representations of Relations : We have already seen one type of graph representation. Consider R
on set A. and A = {1, 2, 3} and x R y iff x<y. Therefore, R = {(1, 2), (1, 3), (2, 3)}

Matrix representation : Another type graph representation :

3.2.3) Type of Binary Relations :

When a relation is defined on a set A : 𝑅: 𝐴 → 𝐴

Some special types of relations :

1) Reflexive, irreflexive
2) Symmetric, Anti-symmetric, Asymmetric
3) Transitive

Remember that this categorization is not for relation of the type 𝑅: 𝑁 → 𝑍, meaning this
categorization is only for relation on set type.

1) Reflexive Relation (reflexive, not reflexive, irreflexive) :

If every element is related to itself then we call this type of relation as reflexive relation. In other
words, If we have relation R on set A (Base set) ≡ 𝑅: 𝐴 → 𝐴 then relation R is reflexive iff every element
∀𝑥 ∈ 𝐴 is related to itself.

Made by Quantum City


goclasses.in

Let’s look at some example, A = {1, 2, 3}

• R = {(1, 1), (1, 2), (3, 3)} – False (Not reflexive)


• R = {(1, 1), (2, 2), (3, 2), (3, 3)} – True (Reflexive)
• R = {(1, 1), (2, 2)} – False

From above example, Reflexive relation R on A : R = {(1, 1), (2, 2), (3, 3), (1, 2), …}

So, in FOL we say Relation R on set A is reflexive iff ∀𝒙∈𝑨 (𝒙 𝑹 𝒙)

Question :

1) Equality relation on Z is reflexive ?

Answer : Question asks us for 𝑅: 𝑍 → 𝑍; aRb iff a=b. This is true because for every pair (a, b) as a = b
we can write (a, a) which is obviously reflexive.

2) Let A = {1, 2, 3} and we ask subset relation on P(A) is reflexive ?

Answer : We can simplify question as 𝑅: 𝑃(𝐴) → 𝑃(𝐴); a R b iff 𝑎 ⊆ 𝑏. Is this reflexive ? Yes, because
every subset is subset of itself. One thing to note that in all problems of relations we first find out
base set and then move to actual problem.

3) What will be matrix representation and graph representation of reflexive relation ?

Answer : Let A = {a, b, c, d}; Relation R on A.

We have discussed reflexive and not reflexive relation. Now, we understand irreflexive relation.

Irreflexive and not reflexive are not same. Irreflexive is extreme opposite of reflexive relation. It says
no element should be related to itself.

So, in FOL we say Relation R on set A is irreflexive iff ∀𝒙∈𝑨 (𝒙 𝑹/ 𝒙). Consider A = {a, b, c} then

2) Symmetric Relation :

We are now going to see symmetric, anti-symmetric and asymmetric relation.

If a R b then b R a then relation is symmetric relation.

Made by Quantum City


goclasses.in

If Base set : A

Relation R on A ≡ 𝑅: 𝐴 → 𝐴

Relation R is symmetric iff

One thing to note that if a R a then there is no problem to symmetric relation and if a !R a then also
there is no problem to symmetric relation. Where !R is called “not related to”.

Questions :

1) Equality relation on Z is symmetric ?

Answer : Z is set of integers (positive or negative). 𝑅: 𝑍 → 𝑍; 𝑎𝑅𝑎 𝑖𝑓𝑓 𝑎 = 𝑏. Yes, it is true as if two
integers are equal then it is reflexive so it is also symmetric.

2) Let set A = {1, 2, 3} and subset relation on P(A) is symmetric ?

Answer : Base set is P(A) and question is 𝑅: 𝑃(𝐴) → 𝑃 (𝐴); 𝑎𝑅𝑏 𝑖𝑓𝑓 𝑎 ⊆ 𝑏. Here a and b should be
element of P(A) and we have counter example as {1} ⊆ {1, 2} but {1, 2} ⊈ {1}. So, not symmetric.

3) Matrix and graph representation of symmetric relation. If base set A = {1, 2, 3} and some
random relation

Answer :

In short, we can say that if graph representation is given and if relation is symmetric then there should
be no unidirectional edges.

4) When can you say that relation is “not symmetric” ?

Answer :

5) When (a, b) R (c, d) is called symmetric ? Remember here base set is A x A not A and
𝑅: 𝐴 × 𝐴 → 𝐴 × 𝐴.

Answer : Relation is reflexive when (a, b) R (a, b) satisfy. It is symmetric when (a, b) R (b, a) satisfy ?
It’s wrong it is symmetric when (a, b) R (c, d) and (c, d) R (a, b) satisfies plzz read this again. It is
transitive if (a, b) R (c, d) and (c, d) R (e, f) then (a, b) R (e, f).

Anti-symmetric relation : If you have two different element a, b then this should not happen
𝑎 𝑅 𝑏 𝑎𝑛𝑑 𝑏 𝑅 𝑎. Which means

𝑅: 𝐴 → 𝐴 and R is antisymmetric iff ∀𝑎,𝑏∈𝐴 ((𝑎 ≠ 𝑏 ∧ 𝑎 𝑅 𝑏) → 𝑏 𝑅 𝑎))

OR 𝑅: 𝐴 → 𝐴 and R is antisymmetric iff ∀𝑎,𝑏∈𝐴 ((𝑏 𝑅 𝑎 ∧ 𝑎 𝑅 𝑏) → 𝑏 = 𝑎))

Asymmetric Relation (counter-symmetric relation) : Asymmetric relation means relation should be


anti-symmetric and irreflexive. This is extension of anti-symmetric relation.

Made by Quantum City


goclasses.in

In short, we can say that asymmetric relation is anti-symmetric relation with no self-loop in graph
representation.

3) Transitive relation :

It says if a R b and b R c then a R c.

Now, it is very simple to prove that equality relation is transitive. And subset relation is also transitive
because if x is subset of y and y is subset of z then x is subset of z. But now consider same subset
relation on P(A) i.e. power set of A then also it is transitive.

But when relation is “not transitive” relation ? -

Graph representation of transitive relation :

Is this transitive ? - This is not transitive as a R b and b R a but a !R a.

3.2.4) Different type of closure :

If R is relation on a set A, it may or may not have some property P, such as reflexivity, symmetric, or
transitivity. When R does not enjoy property P (same as saying when R does not have property P, this
means some element of R satisfy and some not), we would like to find the smallest relation S on A
with property P that contains R.

Which means we have to find out those relation pairs who satisfies property P and it is in A x A but it
is not in Relation R. For example, the relation R = {(1,1), (1, 2), (2, 1), (3, 2)} on the set A = {1, 2, 3} is
not reflexive. How can we produce a reflexive relation containing R that is as small as possible ? – This
can be done by adding (2, 2) and (3, 3) to R, because these are the only pairs of the form (a, a) that
are not in R but they are in A x A. So, now S = {(1, 1), (2, 2), (3, 3), (1, 2), (2, 1), (3, 2)} is reflexive closure
of R.

Similarly, we have symmetric closure, transitive closure.

The time complexity of computing the transitive closure of a binary relation on a set of elements is
O(n3)

3.2.5) Equivalence relation :

A relation R is equivalence relation iff it is reflexive, symmetric and transitive.

Example, Consider relations on the set of integers. R = {(a, b) | a = b or a = -b} – If you look carefully it
is absolute function i.e. |x| so, R = {(a, b) | |a| = |b|}. It is reflexive as a R a. It is also symmetric. Which
means it is not asymmetric. It is also not anti-symmetric as 2 R -2 and -2 R 2 but 2 != -2. It is transitive.
So, it is reflexive, symmetric and transitive and that is why it is equivalence relation.

Partition of a set :

Consider you have an apple, and you don’t want to eat it alone. You want to share it with family so do
partition of apple.

Made by Quantum City


goclasses.in

There is some observation that we can make

• 𝐴𝑖 ⊆ 𝐴
• 𝐴𝑖 ∩ 𝐴𝑗 = ∅ 𝑓𝑜𝑟 0 < 𝑖, 𝑗 ≤ 4 𝑎𝑛𝑑 𝑖 ≠ 𝑗
• 𝐴1 ∪ 𝐴2 ∪ 𝐴3 ∪ 𝐴4 = 𝐴
• 𝐴𝑖 ≠ ∅

Similar in sets consider a set S = {1, 2, 3, 4} and P : {{1}, {2, 3}, {4}} is partition of set S it is not only
partition but it is one of the possible partitions of set S.

Definition : Partition of set S is non-empty subset of S which are pairwise disjoint such that it includes
all the element of set S.

A set S is partitioned into k non-empty subsets 𝐴1 , 𝐴2 , 𝐴3 , … , 𝐴𝑘 if :

1. Every pair of subsets is disjoint.


2. 𝐴1 ∪ 𝐴2 ∪ 𝐴3 … ∪ 𝐴𝑘 = 𝑆.

But we are not concern about partition of set we want total no. of partition possible. Let’s take one
example,

Let S = {1, 2, 3}, we know that we can divide this set to at most 3 parts. We have to make partition
such that all four-point discussed in apple example should satisfy.

One part partition :

Two part partition :

Three part partition :

In total there can be 5 partition of set S.

From now on we are not going to write like instead we write it like { 1, 23} (for
our convenience) Let’s answer questions.

{prime numbers, composite numbers} is a partition of N ? – False. Prime number contains {2, 3, 5, …}
and composite numbers contains {4, 6, 8, 9, …} both sets are partition but 1 element is missing i.e. 1
number. That is why not a partition of N.

Question :

1) Let A = {2, 3, 4, 5, 6, 7, 8} and R a relation over A. Draw the directed graph of R, after realizing
that x R y iff x – y = 3n for some n ∈ Z. Check that if every relation R satisfy.

Answer : x and y are pairs which should satisfy x – y = 3n condition for some n ∈ Z. x – y = 3n means x
– y should be divisible by 3. Which means

x and y should have common remainder. If x = y then 0 is divisible by 3 so it is reflexive. If x-y is divisible
3 then y-x is also divisible by 3 which means it is symmetric.

Made by Quantum City


goclasses.in

Antisymmetric : because 3 R 6 and 6 R 3 but 6 != 3

Asymmetric : because it is not irreflexive.

Transitive : because if a R b means a mod 3 = r and b mod 3 = r as they share common remainder.
Similarly, if b R c means b mod 3 = r and c mod 3 = r which means a R c. So, this is equivalence relation.

Now, we are going to introduce new notation which only applies on equivalence relation [a]R. This is
called equivalence class of “a”. where a is element of set.
[𝑎]𝑅 = {𝑏|𝑎 𝑅 𝑏} It represents all the element which a relates to under relation R.

In above example, [2]R = {2, 5, 8}, [3]R = {3, 6}, [4]R = {4, 7}

[5]R = {2, 5, 8}, [6]R = {3, 6}, [7]R = {4, 7}

One thing we can conclude with the above example that if set S is base set and R is equivalence relation
on set S then R will partition the base set.

2) Consider base set A and relation which is complete relation then do relation analysis.

Answer : If relation is complete relation then R = A x A. It is reflexive and symmetric. It is also transitive
but it is not antisymmetric but it is antisymmetric when |A| = 1. And it has only equivalence class
because [0]R = {0, 1, 2, 3, ….} and [1]R = {0, 1, 2, 3, …} and so on if A = N.

3) Let S = {1, 2, 3, …, 19, 20} and define an equivalence relation R on S by 𝑥𝑅𝑦 ⟺ 4|(𝑥 − 𝑦).
Determine the equivalence classes of R.

Answer :

What if we ask another question ? What will be the cardinality of relation R on S. can we predict it
from equivalence classes of R. Answer is yes. From equivalence classes of S we get useful information
like

We can |𝑅| = |[1]|2 + |[2]|2 + |[3]|2 + |[4]|2 ∴ |𝑅| = 25 × 4 = 100

We say that Relation R has total 4 equivalence classes.

So, from above three question we can conclude that

• Every equivalence relation R on set A gives unique partition of A. and each part of partition is
called equivalence class of R.

Made by Quantum City


goclasses.in

• If R is equivalence relation on set A and there are n equivalence classes of R which means it is
n parts in partition. Let one part or equivalence class is E1 and nth part or equivalence class is
En then

• Complete relation has only one equivalent class which is set itself.
4) Why do we call such relations to equivalence relation ?

Answer : Because in every equivalence relation, there is some sense/type of “equality” involved.
Normally, an equivalence relation R on a set A has the following structure. For all a, b in A; aRb iff a, b
has same ******.

Let’s understand with equivalence relation example,

• x and y have the same color


• x=y
• x and y have the same area
• x and y are programs that produce the same output.

Two elements a and b that are related by an equivalence relation are called equivalent. The notation
a ~ b is often used to denote that a and b are equivalent elements with respect to a particular
equivalent relation.

From question 3rd we can conclude more things like

Let R be an equivalence relation on a set A. These statements for elements a and b of A are equivalent
: (i) a R b, (ii) [a] = [b], (iii) [a] ∩ [b] ≠ ∅

Because if a R b is relation between a and b and relation is equivalence then classes of a and b should
contains same element because if a is related to some element which means that element is related
to b (by symmetric) and same as b and a is related to b (by transitive) so element in classes of a and b
are same and not null.

5) Let R be an equivalence relation on set A. Which of the following is/are true?

Answer :

• Every equivalence class of R is subset of R.


• Every equivalence class of R is subset of A.
• Set of equivalence classes of R is subset of p(A)
• Set of equivalence classes of R is subset of A.
• Two different equivalence classes are disjoint.
• Set of equivalence classes of R is partition of A.
• Set of equivalence classes of R is partition of P(A)
• Set of equivalence classes of R is partition of R.

Made by Quantum City


goclasses.in

6) What is the largest and smallest ER (Equivalence relation) on A (largest and smallest in terms
of cardinality) ?

Answer : Largest relation on A is R = A x A which has cardinality of |A|2,Which has only one equivalent
class as all element are related to each other. Smallest equivalent relation on A is when R is identity
relation. Meaning it contains all reflexive element. Cardinality of such relation is |A| and have |A|
number of equivalent class as one element is related to itself.

7) What is the No. of equivalence relation with n element in set ?

Answer : We know that equivalence relation has equivalence class which partition the base set. Which
means no. of different partition = no. of equivalence relation. Because same partition means same
class combination. No. of different partition of set with n element is given by BELL number Bn. nth bell
number can be found easily from the bell triangle as follows : Here,

𝐸(𝑖,𝑗) = 𝐸(𝑖−1,𝑗−1) + 𝐸(𝑖,𝑗−1) ; 𝑖, 𝑗 > 1,

𝐸(1,1) = 1, 𝐸(𝑖,1) = 𝐸(𝑖−1,𝑖−1) →

NOTE :

1) a | b is called divides “relation” and it return true or false. a / b is called division operator
and it return value.
2) If base set is empty and we have some relation R on empty set then obviously R = empty
set. Now, recall universal quantifier applied on empty set always results in true. So, for
reflexive, symmetric, antisy-+*mmetric, asymmetric, irreflexive, transitive it will result in
true. So, every relation on empty set is both equivalence and partial.
3) If question asks for number of equivalence class of n then remember number of equivalence
class of n = Number of partitions of n = no. of equivalence relation.

Graph of equivalence relation : If R is equivalence relation on set A having equivalence class E1, E2,
E3. Now, consider E1 = {a}, E2 = {b, c}, E3 = {d, e, f} then graph will look like this,

3.3) Partial Order relation :

When we use relation to order some or all of the element of set.

For instant, we order words using the relation containing pairs of words (x, y), where x comes before
y in the dictionary. We schedule projects using the relation consisting of pairs (x, y), where x and y are
tasks in a project such that x must be completed before y begins.

We order the set of integers using the relation containing the pairs (x, y), where x is less than y. When
we add all of the pairs of the form (x, x) to these relations, we obtain a relation that is reflexive,
antisymmetric, and transitive. There are the properties that characterize relations used to order the
element of sets.

Made by Quantum City


goclasses.in

Consider an example of gate aspirants when at the beginning of his preparation he doesn’t know the
order to which subjects should be follow. So, in that case he doesn’t get full order or total order instead
he would get partial order like

But now, consider another example of order of standard in which parents wants their child to be in.
In that case we have total order.

Now, here if you see if we want order in element of set, do we need symmetric relation ? – Answer is
no. because symmetric relation tells us that a R b and b R a which means there is no order. But we
want order so that is why for ordering elements of set we use antisymmetric order. And similarly, we
want transitive relation between element of set. Because if DM R TOC and TOC R CD then definitely
DM R CD.

But why we need reflexive relation ? - Consider new gate aspirant who want to order apt, TOC, CN
but there is no relation between subjects (apt, TOC, CN can be studied independently) so there is no
relation means there is no order in element of set. But we know we have to follow some order (to
study these subjects) that is why reflexive relation should be there in partial or total order.

Definition : A relation R on a set A is partial order (or partial ordering) for A if R is reflexive,
antisymmetric and transitive. A set A with a partial order is called a partially ordered set, or POSET.

Notation : (Base set, relation) for example, (N, <) although this is partial order relation (just example).
A set S together with a partial ordering R is called a partially ordered set, or poset, and is denoted by
(S, R)

Some standard partial order relation :

• (𝑁, ≤) is partial order relation because it is reflexive, antisymmetric and transitive.


• (𝑁, ≥) is also partial order relation it is RAT.
• (𝑃(𝐴), ⊆) is also partial order relation it is RAT.
• Divisibility relation : R on N, x R y iff x | y.

In equivalence relation if we want to express relation between two elements, we use ~ symbol, in
partial order relation we use ≼ symbol.

Some terms we need to know before moving on :

Comparable and non-comparable : If R is partial order relation on S then we say that a and b are
comparable iff one of them is related to another (𝑎 ≼ 𝑏 𝑜𝑟 𝑏 ≼ 𝑎). If none of them are related to one-
another we say they are incomparable or non-comparable.

For example, ({1, 2, 3, 4}, |} then

Made by Quantum City


goclasses.in

Comparable elements : 1 | 2, 2|4, 1|3,…

Non-comparable elements : 2|3, 3|1,…

But when we have ({1, 2, 4, 8}, |} then we have total order. Every element is comparable.

1≼2≼4≼8

Thus, Total order or Total ordering relation is relation which is partial order relation + every element
is comparable. Example, poset (𝑍, ≤) is totally ordered, because 𝑎 ≤ 𝑏 or 𝑏 ≤ 𝑎 whenever a and b
are integer.

3.3.1) Hasse diagram :

We know that any relation R on set A has many representations :

• Graph representation • Arrow diagram representation (𝐷𝑀 →


• Matrix representation 𝑇𝑂𝐶)
• Set representation
But when we have partial order relation, we have one more type of representation called hasse
diagram and there is a relationship between hasse diagram and partial order relation.

For every partial order relation → we have hasse diagram

And if hasse diagram for some relation is given → relation is partial order relation

So, in short, we can say that it is a property and definition of partial order relation.

Now, consider a partial order relation ({1, 2, 3, 4, 5}, ≤), graph representation is

So, to reduce complexity if we know that certain relation has some common property, we omit those
obvious conditions. So, if relation is partial order then we omit reflexive edges, transitive edges. By
doing so we have graph like representation which is clean but it is not hasse diagram. In hasse diagram
we also omit arrows. But after omitting arrows we lost sense of relation, for that we do this

By doing we have not lost order of relation and all property of partial order is also satisfies.

Made by Quantum City


goclasses.in

Let’s take another example, Consider POR (partial order relation) (𝑃({1, 2}), ⊆)

What are the possible hasse diagram of POR with 3 elements ? –

3.3.2) Special elements of POSET :

We shall go to see maximal, minimal, greatest, least elements of poset.

• Maximal element : It is element of poset which is not related to any element of same poset.
so, in hasse diagram there is no path from m to anyone else (no edge)
• Minimal element : It is element of poset which is not related by any element of same poset.
so, in hasse diagram, there is no path from element to minimal element.

• Greatest/ Maximum element : It is element of poset which is related by every element of


poset.
• Least/ Minimum element : It is element of poset which is related to every element of poset.

In a poset, can we have more than one greatest/maximum element ? – Let’s say they are possible then
by definition of greatest element, it is related by every element of poset. Let’s create possible cases,

Made by Quantum City


goclasses.in

Which means if greatest and least exists in some hasse then they must be unique. This also implies if
some poset has more than one maximal or minimal element then we cannot have greatest and least
element respectively.

Can we have elements which are both minimal and maximal ? – Let’s look at below example,

So, one element can be both minimal and maximal (condition is it should not be related to or by
related to any element).

If some POSET has one unique maximal element then it is maximum or greatest ? – If you think you
will say it is true but take this beautiful case where POSET is (𝑁, ≤) ∪ {(𝑎, 𝑎)} this is POSET. and if you
look at hasse diagram.

Similarly, we can conclude that if some POSET has unique minimal element then it is not necessary to
be minimum or least element.

But in above case, POSET was infinite. What if POSET is finite will it still hold ? – then answer becomes
yes in both minimal and maximal.

Now we are going to see more of these special elements namely upper, lower, greatest lower, least
upper bound. For this consider a set A and X be any subset of A.

• Upper bound : Upper bound of X is the element a ∈ A such that all the element of X is related
to a.
• Lower bound : Lower bound of X is the element a ∈ A such that all the element of X is related
by a.

So, in short, upper and lower bound is same as finding maximum and minimum element of subset of
poset. Consider example given below :

• Least Upper bound : It is the least element in the upper bound of subset of poset. (first you
find upper bound of X then you find least element)
• Greatest Lower bound : It is the greatest element in the lower bound of subset of poset. (first
you find lower bound of X then you find greatest element).

Made by Quantum City


goclasses.in

Consider following example : let’s say X = {d, k, f}

NOTE :

1) In most of the cases we want to find GLB and LUB for pair of elements. So, we denote GLB{a,
b} as a ꓥ b (also known as meet) and LUB{a, b} = a ꓦ b (also known as join)
2) In finding different cases to prove some option wrong, you can also take infinite POSET for
example, (Z, <=) this is special type of POSET where there is no minimal or maximal element.
3) (𝒂𝒐 ≼ 𝒂) means ao is related to a. which also means a0 is at bottom in hasse diagram.
4) In relation, base set is by default, non-empty unless it is explicitly mentioned.

Some standard result you must think about :

• aꓥa=a
• if a R b (comparable) then a ꓥ b = a and a ꓦ b = b
• if a and b are incomparable then a ꓦ b = Unique first joining point in upward direction. (if not
unique then a ꓦ b does not exists)

• if a and b are incomparable then a ꓥ b = Unique first meeting point in downward direction. (if
not unique then a ꓥ b does not exists)

Made by Quantum City


goclasses.in

If we have poset P (poset is nothing but partial order set P) then what is ꓥ P and ꓦ P ? - ꓥ P = LUB of
all element in set P = Greatest element, and ꓦ P = GLB of all element in set P = least element (think)

3.3.3) Hasse diagram of TOR :

Consider following poset and its hasse diagram , ({1, 2, 3, 4, 5}, >=), (N, |)

One thing to note that POR (𝑝(𝐴), ⊆) is TOR iff |A|<=1. (think)

3.4) Lattice :

Definition : A lattice is a poset (𝐴, ≼) in which any two elements a, b has an LUB(a, b) and a GLB(a, b).
which means ∀𝑎,𝑏∈𝐴 (𝑎 ∧ 𝑏 𝑠ℎ𝑜𝑢𝑙𝑑 𝑒𝑥𝑖𝑠𝑡𝑠 𝑎𝑛𝑑 𝑎 ∨ 𝑏 𝑠ℎ𝑜𝑢𝑙𝑑 𝑒𝑥𝑖𝑠𝑡𝑠)

Now what we will need to do to check for lattice. We have to check all these cases.

To check if a given poset (of n elements) is lattice or not, we have to check for EVERY pair of elements
to see if every pair of elements has LUB and GLB. It will take a lot of time as number of pairs of elements
is n2. Can we do better than this ? – Answer is check only pairs of incomparable elements. Because
Pair of comparable elements always have GLB and LUB in every poset. So, there is no need of checking
of them.

So, another definition of lattice : A POSET in which every two non-comparable elements have Unique
GLB and LUB.

Can we count cardinality of POR through hasse diagram ? – Let’s consider following hasse diagram of
POSET.

Made by Quantum City


goclasses.in

Consider total order relation instead what would be the cardinality of TOR through hasse diagram ? –

And this will be the maximum cardinality of relation with 3 elements (i.e. chain like hasse diagram).
And the Minimum cardinality of relation with 3 elements will be relation which is reflexive only.

One thing to note that in every lattice L, ∀𝑥,𝑦 ∈ 𝐿

Properties of lattices : Any lattices have the following properties. (ICAA)

• Idempotent (𝑥 ∧ 𝑥 = 𝑥; 𝑥 ∨ 𝑥 = 𝑥)
• Commutative (𝑥 ∧ 𝑦 = 𝑦 ∧ 𝑥; 𝑥 ∨ 𝑦 = 𝑦 ∨ 𝑥 )
• Associativity ((𝑥 ∧ 𝑦) ∧ 𝑧 = 𝑥 ∧ (𝑦 ∧ 𝑧); (𝑥 ∨ 𝑦) ∨ 𝑧 = 𝑥 ∨ (𝑦 ∨ 𝑧))
• Absorption (𝑥 ∧ (𝑥 ∨ 𝑦) = 𝑥; 𝑥 ∨ (𝑥 ∧ 𝑦) = 𝑥)

But Identity, complement, de-morgen, distributive properties are only satisfied by some lattices, not
by all lattices. (think why they do not satisfy in case you forgot)

3.4.1) Sublattice :

Before starting new topic, we will address some interesting questions,

If we delete an element from Base set in any POSET will it still be POSET ? – If you delete any element
from base set then its relation would also affect the same so every entry where that element appears
will get deleted from relation. And therefore, it will still be POSET because deletion of element from
base set also deletes relation associated with it so it will not affect reflexive, anti-symmetric and
transitive relation.

In short, we can say that If (A, R) is POSET then (B, R) is also POSET ∀𝑩 ⊆ 𝑨

Similarly, if (A, R) is Eq. relation then ∀𝑩 ⊆ 𝑨, (𝑩, 𝑹) also an eq. relation

Made by Quantum City


goclasses.in

If we delete some element from relation, can I guaranty that result will be POR ? – NO because If you
delete any element from relation then consider that element is of the form (a, a) then it will not satisfy
reflexive relation and that is why relation will not be POR.

But why we are explaining this under sublattice ?

So, sublattice S of L is nothing but (i) Subset of L, (ii) S should be lattice and (iii) GLB, LUB for any a, b∈S
must be same in S and L.

Intuition behind sublattice : If you take subset of lattice then take their GLB, LUB also. So, in previous
example we are taking b and c but not talking its GLB from base set.

Clearly, above diagram shows that if L is lattice and S is lattice and subset of L then it is not necessary
that S is sublattice.

Definition : A sublattice of a lattice L is a nonempty subset of L that is a lattice with the same meet
and join operations as L.

3.4.2) Types of lattice :

We know that all lattice satisfies four properties i.e. ICAA, but talking about identity, distributive,
complement then some lattices satisfy them, some don’t. So, that is why if some lattice satisfies

• Bounded lattice (lattice which satisfies identity property)


• Complemented lattice (Lattice which satisfies complement property)
• Distributive lattice (Lattice which satisfies distributive property)
• Boolean lattice (Lattice which satisfies all these three property)
1) Bounded lattice :

A lattice ⟨𝐴, ≼⟩ is bounded iff it has a minimum element and a maximum element. These are denoted
by 0 and 1 respectively.

Bounded lattice has least and greatest element which means all elements are bounded by these two
elements.

Can infinite lattice be bounded lattice ? – Answer is Not possible. Because take simple example of
TOSET (total order set) (𝑍, ≤) which do not have least and greatest element. But you are wrong, It is
possible take one beautiful example of TOSET ([𝑎, 𝑏], ≤) this is real interval from a to b including a
and b. This is infinite but it has least element (a) and greatest element (b).

Now, we know that every finite lattice has greatest and least element.

Every finite lattice is bounded

Some facts about bounded lattice :

Made by Quantum City


goclasses.in

• Suppose ⟨𝐴, ≼⟩ is a bounded lattice having minimum 0 and maximum 1, and let x be any
element in A. then

0 ∨ 𝑥 = 𝑥 = 𝑥 ∨ 0; 1 ∧ 𝑥 = 𝑥 = 𝑥 ∧ 1
0 ∧ 𝑥 = 0 = 𝑥 ∧ 0; 1 ∨ 𝑥 = 1 = 𝑥 ∨ 1

• For entire lattice we know that upper bound is greatest element and lower bound is least
element. So, another definition of bounded lattice can be lattice L is bounded iff it has entire
lattice L has Upper bound and Lower bound.
• Infinite lattice which is not bounded Infinite lattice which is bounded

Wait, we have mention involvement of identity property in bounded lattice but by far we have not
seen it. So, let’s see…

Identity property : We say “e” is identity element for operator # iff for all a, a # e = a and e # a = a.

For addition, identity element is 0 because for all a + 0 = a.

For subtraction, we don’t have identity element because 0 – a = -a and a – 0 = a both are different but
according to definition both should be same.

Similarly, for any lattice, least element (if exists) will be identity element for LUB (join or ∨) and
greatest element (if exists) will be identity element for GLB (meet or ∧).

That is why another definition of bounded lattice can be in lattice, if identity element is least element
and greatest element for LUB and GLB respectively then it is bounded lattice.

Domination law : In set theory, if M is universal set then 𝑆 ∪ 𝑀 = 𝑀. Here we say that M is dominator
because it is dominating S.

Then dominator for GLB in lattice – least element

Dominator for LUB in lattice – greatest element

For example, (𝑁, ≤), Dominator for LUB = DNE; dominator of GLB = 1.

Made by Quantum City


goclasses.in

In short, we have seen three definition of bounded lattice :

(i) Lattice with least and greatest element


(ii) Lattice with Identity element for GLB and LUB be greatest and least respectively.
(iii) Lattice with dominator for GLB and LUB be least and greatest respectively.

2) Complemented Lattice :

Lattice is complemented iff every element has at least 1 complement. First of all, complement of an
element “a” be “b” iff 𝑎 ∨ 𝑏 = 1 𝑎𝑛𝑑 𝑎 ∧ 𝑏 = 0. Here 1 means greatest and 0 means least.

And if you see carefully here greatest and least element exists which means it is also bounded lattice
so, for lattice to be complemented it first has to be bounded lattice.

Idea is in a bounded lattice, complement of a ≡ a-1

Example of complemented lattice :

Q : Can a TOSET be complemented lattice ? – From previous example it seems like answer is no. But
answer is yes, it is possible when iff <= 2 elements.

3) Distributive Lattice :

Lattice is distributive iff ∀𝑎,𝑏,𝑐 𝑎 ∨ (𝑏 ∧ 𝑐 ) = (𝑎 ∨ 𝑏) ∧ (𝑎 ∨ 𝑐 ) 𝑎𝑛𝑑 𝑎 ∧ (𝑏 ∨ 𝑐 ) = (𝑎 ∧ 𝑏) ∨ (𝑎 ∧ 𝑐)

Made by Quantum City


goclasses.in

Above lattice is special lattices.

Theorem : if Kite or pentagon sublattice then lattice is not distributive. OR L is distributive iff there is
no sublattice of L which is kite or pentagon.

Q : If lattice L has <= 4 elements then L is definitely distributive ? – Answer is yes. Because if less than
5 elements assure that there is no kite or pentagon sublattice. But if you have 5 elements than also it
is possible to have distributive lattice why because there are many lattices which do not have kite or
pentagon sublattice with 5 elements.

NOTE : To make sublattice take elements with their GLB and LUB. It is not compulsory to take
maximum and minimum element in sublattice you can even ignore both.

Theorem : If lattice is distributive then there is at most 1 complement for every element. (this is one-
way theorem)

Contrapositive is in lattice if any element has more than 1 complement then it is not distributive.

In short, to check if given lattice is distributive ;

(i) If |L|<=4 then it is distributive


(ii) If |L|=5 then distributive iff not kite or pentagon
(iii) If L is total order then always distributive because we cannot create kite or pentagon.
(iv) Find complement of elements and if some element has > 1 complement then not distributive.
But if every element has <= 1 complement then find kite or pentagon sublattice.

NOTE : If every element has exactly one complement then it is complemented (which is obvious)
but it may not be distributive (because theorem was if distributive then at most 1 complement)

Made by Quantum City


goclasses.in

4) Boolean Lattice (or Boolean algebra) :

A lattice is Boolean if it is bounded, complemented and distributed lattice. Or if it is complemented


and distributive. Because every complemented lattice is also bounded lattice.

Boolean lattice is complemented distributive lattice

Example, A = {a, b} then (𝑃(𝐴), ≤) this is Boolean algebra or lattice.

Q : Can single element lattice be Boolean algebra ? – Single element means it has greatest and least
element so it is bounded, next it has less than 5 elements so it is distributive and it is complemented
as complement of single element is that element itself.

Boolean algebra with :

1 element = 4 elements =

2 elements = 5 elements = DNE

3 elements = Not possible 6 elements = DNE

NOTE :

1) Every Boolean algebra has the same structure as (𝑷(𝑨), ⊆) structure. Because then only we
can have unique complement.
2) Above sentence also implies that every Boolean algebra have 2n elements. Remember this
is if Boolean then 2n elements. Reverse is not true because chain containing 2n element is
not Boolean.

Boolean lattice satisfies all properties such as ICAA, identity, distributive, complement, absorption,
etc. and also propositional logic, digital logic with 2 elements also satisfies all these properties that is
why all are called Boolean algebra.

Q : What are the important elements of Boolean algebra (𝑃(𝑆), ⊆) and (𝑃(𝑆), ⊇)? –

3.4.3) Analysis on Divisibility relation :

Now, we are going to see one special lattice also known as divisibility lattice which is denoted by Dn =
set of all divisors of n. if n = 4, D4 = {1, 2, 4} similarly if n = 6, D6 = {1, 2, 3, 6}.

Made by Quantum City


goclasses.in

In all hasse diagram of divisibility lattice, one thing you can notice i.e. LUB = LCM and GLB = GCD

Q : Is (𝐷𝑛 , |) distributive and complemented ? - All divisibility lattice is distributive lattice because LCM
and GCD distribute over each other. And talking about complemented lattice so we know that some
divisibility lattice contains chain lattice and we know that chain containing number of elements greater
than 2 will not be complemented lattice.

Q : Which divisibility lattice is complemented ? – if n (in Dn) is prime square free number then
divisibility lattice is complemented. Prime square free number is a number n such that p 2 | n should
not happen, where p is prime. Let’s say n = 8 then 8 = 22 x 2. 2 is prime and prime square is present so
(𝐷8 , |) is not complemented. n = 6 then 6 = 2 x 3, No prime square is present thus (𝐷6 , |) is
complemented lattice.

And some interesting fact that if n is prime square free number then complement of any element “a”
is n/a.

So, in short, we can say that (𝐷𝑛 , |) is complemented iff prime factorization of n do not contains
repetitive prime number. And if you observe this same condition applies to Boolean lattice or Boolean
algebra.

Still two topics are remaining 1. Refinement of a partition and closure of relations which will do it after
completion of theory of computation subject.

Silly Mistakes :

Let A = {1, 2, 3, 4, 5, 6, 7} then how many equivalence relations R on A are possible in which (1, 2) ∈ R
but (3, 4) ∉ R ? -

{a, b}{c}{d} is also partition.

Made by Quantum City


goclasses.in

4. FUNCTION
// Lecture 1

Function is type of relation. First consider a relation from set A to set B, 𝑅: 𝐴 → 𝐵

We know that relation 𝑅 ⊆ 𝐴 × 𝐵

A binary relation R from A to B is said to be a function if for every element a in A, there is a unique
element b in B so that (a, b) is in R. For a function R from A to B, instead of writing (a, b) ∈ R, we also
use the notation R(a) = b, where b is called image of a or a is preimage of b. The set A is called the
domain of the function R, and the set B is called range or codomain of the function R.

4.1) Introduction :

Function requirement :

• No element of the domain must be left unmapped.


• No element of the domain may map to more than one element of the co-domain.
// Lecture 2

4.1.1) Number of functions :

Q : how many functions are possible for set A = {1, 2} to B = {a, b} ? – No. of function is 4.

Consider same question but from 2 elements set to 3 elements set.

Therefore, number of functions = |codomain||domain|


// Lecture 3

4.1.2) Representation of functions :

As we know that function is relation so we can also have set representation of function.

Made by Quantum City


goclasses.in

Image of a subset of domain :

Some terminology used in function :

Real valued function : function whose co-domain = R

Integer valued function : Function whose co-domain = Z

Natural valued function : Function whose co-domain = N

Boolean valued function : Function whose co-domain = {0, 1}

Two real-valued function or two integer valued function with the same domain can be added, as well
as multiplied.

// Lecture 4

4.1.3) Types of functions :

There are mainly three types of function : One-one function (Injective), Onto function(surjective),
Bijection (Bijective)

1) One-one function : This is also called injective or injection why ? let’s see

If I have function from people to injection then no two people can have dose from same injection,
they must have used different injection.

In one-one function, every element of domain is mapped to different distinct element of co-domain.
In other word no element of co-domain is related by more than one element from domain.

If f(a) = f(b) then a = b this condition should satisfy for every one-one function.

2) Onto function :

In onto function, every element of co-domain has at least one preimage.

Made by Quantum City


goclasses.in

3) Bijective :

A function that associates each element of the codomain with a unique element of the domain is
called bijection. Or bijection is a function that is both injective and surjective.

In bijection, if 𝑅 ∶ 𝐴 → 𝐵 𝑡ℎ𝑒𝑛 |𝐴| = |𝐵| this result is the consequences of below statement.

And if |A| > |B| then one-one function is not possible

If |A|<|B| then onto function is not possible. (prove this in book)

NOTE :

1) If X2 = 25 then X = ? – same as asking which value of X satisfies X2 = 25, X = +5, -5 and if X =


sqrt(25) then X = 5 only not X = -5 (because codomain of sqrt function is nonnegative). Both
are different operation.
2) Relation is subset of A X B which is nothing but set so, every relation is special type of set.
Thus, we can apply set operation like union, intersection, set difference, etc on relation to
get new relation.
//Lecture 7

4.2) Composition and inverse of function :

Composition is relation operation. It is operation that creates new relation transitively.

Example,

R2.R1 means first you apply R1 then you apply R2.

Composition of relations is associative. i.e. A.(B.C) = (A.B).C

Now, let’s take our attention back to function. We do same composition on function as function is
nothing but special type of relation only.

Consider function f, g such that 𝑓: 𝐴 → 𝐵 and 𝑔: 𝐵 → 𝐶

And composition function ℎ: 𝐴 → 𝐶 or ℎ = 𝑔𝑜𝑓

Made by Quantum City


goclasses.in

Q : What is the necessary condition for 𝑓: 𝐴 → 𝐵 and 𝑔: 𝑀 → 𝑁 to defined 𝑔𝑜𝑓 ? – Codomain of f


should be domain of g. In other words, B = M.

4.2.1) Inverse of function :

First consider a function 𝑓: 𝐷 → 𝐶

Similarly, if F is not onto function then reverse of f function is not even a function. So, question is

Q : When will function be a function even in reverse direction ? – It should be bijection (from above
two observation). And we call this reverse direction function as inverse of function.

SILLY MISTAKES :

Made by Quantum City


goclasses.in

5. GROUP THEORY
//GP : Lecture 1

Group theory is part of abstract algebra.

So, instead of going through all the structure we can consider one common structure i.e. without going
through definition or meaning of specific concept we can study only operations on them (that is what
abstract means).
// GP : Lecture 2

Who discovered abstract algebra ? – Evariste Glois, while studying polynomial of different degree. He
got stuck at 5th degree polynomial and found that there is no formula for finding roots of degree 5
polynomial and he proved that using group theory.
// GP : Lecture 3

5.1) Introduction to group theory :

But in GATE syllabus we have only simple binary operation.

Example of algebraic structures with a single binary operation are : magma, quasigroup, monoid,
semigroup, group, lattice, Boolean algebra.
// Lecture 4

Operation table/ Multiplication table/ Cayley table :

Consider ({a, b}, *)

5.1.1) The property of closure :

A set has the closure property under a particular operation if the result of the operation is always an
element in the set. We say that the set is “closed under the operation”.

Consider ({1, 2, 3}, +) and (R, /)

Made by Quantum City


goclasses.in

We know that 2+3 = 5 which does not belong to base set {1, 2, 3} which means set is not closed under
addition operation. Same for second structure we have 0/0 which is not defined means do not belong
to set R.

In terms of operation table, we can say that set is closed under operation when the entries in
operation table belongs to that set.

In normal math, we can say binary operation is nothing but some operation between two operands
but in abstract algebra we make everything precise.

In abstract algebra, binary operation is structure which satisfy closure property. Or # is binary
operation on set S iff (s, #) is closed. We can also say that # is function which maps two elements of
set to one value of same set, i.e. # ∶ 𝑆 × 𝑆 → 𝑆
// Lecture 5

5.1.2) The Associative property :

(S, #) is associative iff ∀𝑎,𝑏,𝑐 ∈ 𝑆 (a # b) # c = a # (b # c)

For example, (N, +) satisfies associative property.


// Lecture 6

5.1.3) The identity property :

Identity element “e” is element from same set if ∀𝑎 ∈ 𝑆, a # e = a and e # a = a.

(N, +) – no identity element but (W, +) has identity element 0 while (Z, -) do not have identity element
either but it has identity element 0 why ? a – 0 = a but 0 – a = -a so 0 is not identity element stupid.
//Lecture 7

Q : Can we have more than one identity element ? – let e and f are two identity elements. If e is identity
element then e # f = f and if f is identity element then f # e = e. Which means f = e. Thus, always unique
identity element if exists.
//Lecture 8

Q : How can you find identity element from operation table ? – Consider following operation table,

// Lecture 9

5.1.4) The Inverse Property :

Let we have (S, #) then inverse of element a is b such that 𝑎, 𝑏 ∈ 𝑆 iff a # b = e and b # a = e where e is
identity element. We say b = a-1.

We can say more formally that (S, #) has inverse property iff ∀𝒂∈𝑺 ∃𝒃∈𝑺 ((𝒂#𝒃 = 𝒆) ∧ (𝒃#𝒂 = 𝒆))

Q : Do (R, x) satisfies inverse property ? – yes, because here identity element is 1 so 5 x something =
1. And something is 1/5 and so on. But you are wrong, 0 x something = 1; something = 1/0 ? absolutely
not. 0 does not have any inverse which means (R, x) does not satisfy inverse property.

Made by Quantum City


goclasses.in

Without identity element inverse property cannot be defined

Q : if a-1 = b then b-1 = a ? – simply apply definition, a # b = e and b # a = e which means a-1 = b but it
also means b-1 = a. and we can also prove that e-1 = e.

Q : Is it possible for an element to have more than one inverse ? – Yes, possible consider following,

//Lecture 10

5.1.5) The commutative property :

Commutative property is satisfied by some structure (S, #) iff ∀𝑎,𝑏∈𝑆 (𝑎#𝑏 = 𝑏#𝑎)
//Lecture 11

5.2) Classification of structures (with binary operation) :

Algebraic Structure Properties


1 Magma (Groupoid) Closure property
2 Semigroup Closure + Associative
3 Monoid Closure + Associative + Identity
4 Group Closure + Associative + Identity + Inverse

From above we can say that every algebraic structure with simple binary operation is magma because
all algebraic structure with binary operation satisfies closure property.

Moreover, in group theory there was a famous mathematician named Abel from which Abelian is
derived which simply means commutative. So, Abelian semigroup means semigroup with one
additional property of commutative and same for other algebraic structure.

5.2.1) Groupoid / Magma :

G be a non-empty set and * be a binary operation, then the structure (G, *) is called a groupoid, if a *
b Є G, ∀𝑎, 𝑏 ∈ 𝐺. The set N is not a groupoid with respect to operation “-“.

5.2.2) Semigroup : A groupoid with associative property is semigroup.

5.2.3) Monoid : A semigroup with identity property. Sometimes monoid structure is represented as
(S, *, e) where * is binary operation and e is identity element.

Q : Consider one structure (Z, *) such that a * b = a + b – 3 : – This is abelian group.

Made by Quantum City


goclasses.in

//Lecture 12

Q : (S, *) for this structure no. of binary operation ? – We know that each binary operation is nothing
but some function so it is basic question of no. of function which is nothing but (codomain) (domain). In
this case domain = S x S and codomain is S.

Q : Consider previous question S with cardinality of n but now we have to find out no. of commutative
binary operation ? – First consider one beautiful example, ({a, b}, *) be the structure then

Similarly,

NOTE :

1) When operation “*” is NOT associative, we cannot write a * b * c because it is ambiguous.


We should put parentheses to disambiguate.
2) In any structure, there is at most one identity element.
3) When we say some structure does not satisfy commutative property then we are not saying
∀𝒙,𝒚∈𝑺 (𝒙 ∗ 𝒚) ≠ (𝒚 ∗ 𝒙) this is not true in any case. Because we have one case where this
commutative property satisfies i.e. e*a = a*e where e is identity element. But not all
element is satisfying that is why we can say that commutative property does not satisfy.
4) We denote nonzero real number by R0 and similarly we denote any other set of number
with nonzero values as N0, Z0, Q0…

Q : Example of function with associative or commutative property –

• Associative and commutative :

• Associative but not commutative : Matrix multiplication, (N, #) where a#b = a.


• Not associative but commutative : operation (x, y) -> xy + 1 on the integer, NAND ↑
• Not associative and not commutative : -, /

//Lecture 13

Made by Quantum City


goclasses.in

Properties of monoid :

Left cancellation property : If a # b = a # c then b = c (meaning we can cancel a)

Right cancellation property : if b # a = c # a then b = c (meaning we can cancel a from right side)

• In a monoid, we don’t have left, right property.

Proof.

//Lecture 16

5.2.4) Group :

Order of a group : The number of elements in a group is called order of the group.

By now we all know about definition of group. So, let’s explore more about groups.

Some important groups :

• Set of nth Roots of unity, under multiplication :

Consider, equation x = 1 how many roots it has ? only 1 i.e. roots = {1} now consider x 2 = 1 then roots
= {-1, 1} and these roots are called roots of unity and we do same operation till nth root of unity. One
thing to observe is that these roots set with multiplication operation forms a group of order equal to
no. of roots …

This are called cube roots of unity. And this set under multiplication is also group. Not only that this
structure is also abelian group. And again, all the nth roots of unity form a set which in under
multiplication is abelian group.
//Lecture 17

• Addition modulo n :

The group 𝑍𝑛 consists of the elements {0, 1, 2, …, n-1} with addition mod n as the operation. You can
also multiply elements of 𝑍𝑛 , but you do not obtain a group. The element 0 does not have
multiplicative inverse.

Base set : 𝑍𝑛 consists of all the remainders of n when a number is divided by n.

Operation : addition module n denoted as ⊕𝑛

In general, for structure (𝑍𝑛 ,⊕𝑛 ) 𝑜𝑟 ({0, 1,2, 3, … , 𝑛 − 1},⊕𝑛 ) 𝑛 ∈ 𝑁

Closed, associative, Identity, commutative, inverse ?

You know we have already discussed right and left cancellation. Group satisfies right as well as left
cancellation. BUT we cannot do a * c = b * a → c = b because of absence of commutative property in
group. But if we have Abelian group then this is also true.
//Lecture 21

Made by Quantum City


goclasses.in

Q : We know that in group (G, *), a*a-1 = a-1*a and ae = ea do these imply abelian property ? – First
statement is aa-1 = a-1a which is nothing but equal to e. This is inverse property so does not imply
abelian property. Now, talking about second ae = ea is the property specifying identity. So, both of
these statement does not imply abelian.

Checking associative property in the Cayley table :

In general, it is not possible to check for associativity simply by glancing at the Cayley table. This is in
part, because associativity is determined from a three termed equation a(bc) = (ab)c whilst the Cayley
table shows two-term products only. But you can check commutative property. Thus, they will never
ask you about checking associative property. But if you want to check Cayley table for associativity
then never check for identity element or formula including identity element because (a * e) * b = a *
(e * b) ➔ ab = ab (identity element with any element is element itself so no point)
//Lecture 23A

If * is a binary operation on a finite set S, then properties of * often correspond to properties of the
Cayley table. In group,

• Each element g ∈ G appears exactly once in each row and in each column.
• So, every row/column is simply a permutation of all elements i.e. every element appears
exactly once.
• Row and column of identity element is exactly same as the header.

Proof : Consider if one is repeating,

Which means
//Lecture 24

// Lecture 25A

Groups of small order :

Q : How many different binary operations we can have with order 1 structure ? – we know that order
is nothing but no. of element in base set. And we also know that binary operation is nothing but
function which means no. of binary operations is codomaindomain. So only 1 binary operation is possible.

But wait we have binary operations which has order 1 for example, ({T}, ꓥ), ({T}, ꓦ), ({1}, x), ({0}, +) so
there are infinite many binary operations then why we proved that 1 binary operation is possible. Here
one thing to note that if you look at operation of first structure it is nothing but T ꓥ T = T is the only
operation and as same for other we can say they have same structure and that is why only 1 binary
operation with order 1 structure is there. Which means if you study one structure it is equivalent to
study all structure with order 1.

Made by Quantum City


goclasses.in

We call them isomorphic structure. So, question we are really interested is how many non-isomorphic
groups of order 1 are there ? – so answer is 1.

Let’s generalize this to order n, here we are talking about groups so we have to take in count of group’s
properties.

We noticed that non-isomorphic group ≡ Different templets ≡ up to isomorphism (this simply means
consider non-isomorphic)

Let’s look at order 4 groups (non-isomorphic groups) :

2nd and 3rd are iso-morphic because in both Cayley table. One element is there which is inverse of itself
and two elements are inverse of each other.
//Lecture 26

Power of an element in a group :

We introduce the concept of integral exponents of elements in a group. The concept plays an
important role in the theory of cyclic groups.

Definition : For any 𝑎 ∈ 𝐺 we define

𝑎0 = 𝑒

𝑎𝑛 = 𝑎𝑛−1 𝑎, 𝑓𝑜𝑟 𝑛 ≥ 1

𝑎−𝑛 = (𝑎−1 )𝑛 𝑓𝑜𝑟 𝑛 ≥ 1


Some properties are consequences of these fundamental definition namely, 𝑎𝑛 𝑎−𝑛 = 𝑒, 𝑎𝑚 𝑎𝑛 =
𝑎𝑚+𝑛 , (𝑎𝑚 )𝑛 = 𝑎𝑚𝑛

We can create beautiful example by using property of inverse is that if an = e then a-1 = an-1. Because
an = an-1 a = e so here an-1 working as a-1.

Q : If G is a group of even order, then show that there exists an element 𝑎 ≠ 𝑒, the identity in G, such
that a2 = e ? – Question says if |G| = 2n then there is an element which is a2 = e ➔ a = a-1 (which is
inverse of itself). We know that identity element is there in every group so we throw out of the base
set. Then we know that every element has unique inverse, consider a has unique inverse as b then we
throw both out of base set. We do this thing untill nothing left. So, if nothing left means no element
is inverse of itself and if one element left then it is inverse of itself because it is property of group.
Here we have 2n-1 element (after removing e) and we will get one element at last.
//Lecture 27A

Made by Quantum City


goclasses.in

5.2.5) Subgroups :

Definition : Let (G, *) be a group. A subgroup of G is a subset H ⊂ G such that

• 𝑒∈𝐻
• 𝑥, 𝑦 ∈ 𝐻 → 𝑥 ∗ 𝑦 ∈ 𝐻
• 𝑥 ∈ 𝐻 → 𝑥 −1 ∈ 𝐻

“Subgroup of group G” is a subset which is also a group under same operation.

Example, ({1, -1, i, -i}, x) is a group with identity element is 1.

//Lecture 27B

1) Subgroup generated by an element :

Let (Z, +) is group and if we say subgroup generated by 2 is equivalent of saying smallest subgroup that
contains element 2.

We know that 0 must be there in this group because of definition of subgroup. And 2 must be there if
we do 2+2 = 4 so 4 must be there likewise 6, 8, 10, all odd positive number should be there. 2-2 = 0
then we say -2 is inverse of 2 so it must be there in group as well and -4, -6,… are inverse of 4, 6,…
respectively. Therefore, smallest subgroup that contains element 2 will be all even numbers or integer
which are multiple of 2.

Similarly consider ({1, -1, I, -i}, x) group here if we say subgroup generated by i is equivalent to saying
smallest subgroup that contains element i. We know that it should contain i and 1 and all power of i
which is nothing but group itself. Which means i can generate whole group. We say that i is generator
of group ({1, -1, I, -i}, x). similarly -i also a generator of group. 1 and -1 is not generator of G.
//Lecture 31

Notations : Let Group be (G, *) ; a ∈ G

<a> = subgroup of G generated by a OR Smallest subgroup of G containing a.

<a> = {an | n ∈ Z} … look at carefully n is not natural number.

If we say H is subgroup of G, we denote it by 𝐻 ≤ 𝐺 and |G| = order of G is equal to number of


elements in base set

Q : Let G be a group which can be generated by an element “a” which is inverse of itself. Then what is
order of G ? – question is asking |<a>| = ?. <a> = { a0, a1, a2, a3,…} = {e, a, e, a,…} = {e, a}. |G|=2. But
one more case is possible, what if a is identity element itself then |G|=1 so if G is generated by an
element a which is inverse of itself then order of G will be 1 or 2. These two possible groups are non-
isomorphic.
//Lecture 32A

2) Order of an element : (size of subgroup generated by an element)

The order of a finite group is the number of elements. If a group is not finite, one says that its order is
infinite. The order of an element of a group (also called period length or period) is the order of the
subgroup generated by the element.

Made by Quantum City


goclasses.in

consider ({1, -1, I, -i}, x) group, we know that order of G = |G| = 4

Order of 1 (by definition) = |<1>|=|{1}|… because 1 can only generate 1 and |{1}| = 1

Similarly, |<-1>|=|{-1, 1}|=2, |<i>| = 4, |<-i>| = 4.

One thing to note that order of identity element is always one as it can create only itself through any
operation in group.

Now, let’s make some wonderful observations :

Consider a group (G, *), where a,b ∈ G and a ≠ e and <a> = { a0, a1, a2, a3,…} = {e, a, b, e,…}

If you observe carefully a3 = e means there is no point of calculating a4, a5, a6,… because it will repeat
a b e pattern. So, order will be 3 (in this case only). Which means here order of element “a” is least
power of “a” till we get identity element after a0 (because it is e only). As a0 = e and it is true for all
element of any group. Thus, we can ignore a0.

Similarly, we can say that Order of an element a∈G is the least positive integers n such that an = e,
where e is the identity of G.

We can make 1 more observation that when order of an element is equal to order of group then that
element is generator.

NOTE :

1) While creating “subgroup generated by an element a”, inverses are only needed if the group
is infinite; In a finite group, the inverse of an element can be expressed as a positive power
of that element.
2) Order of x = O(x) = O(a-1 x a) how ? whenever something about order is given apply definition

Q : if i16 = i28, we know that i12 = e then 12 is order of element i ? – Answer is no, because order is
smallest integer such that in = e but multiple of n can also generate e that does not mean that n is
order. More specifically we can say that 1 ≤ 𝑜𝑟𝑑𝑒𝑟 𝑜𝑓 𝑖 ≤ 12.

Q : It is possible that an infinite group has No generator ? – Yes, it can possible, see (C, *) be any
operation which is infinite group. We select one element then try to find its subgroup we keep
multiplying its power till 1 appears but never occurs but we are getting distinct element of C. and one
proof is that we know simple thing that not every group has generator i.e. not every group is cyclic.

Q : If group is commutative then its subgroup is also abelian ? – because according to the definition of
subgroup look at second point it says when x and y is in H then x * y should also be in H and y * x
should be also be in H and we now that in G, x*y = y*x so in H also if same pairs should be there then
they also satisfy commutative.
//Lecture 28

5.3) Types of groups and it’s properties :

Coprime or relatively prime : In number theory, two integer a and b are coprime or relatively prime
or mutually prime if the only positive integer that is a divisor of both of them is 1.

In previous section we have encountered addition modulo n group which is abelian group. Similarly,
here we are introducing new structure namely multiplication modulo n group. We know that it has
closure property, associativity, identity, communicative but it does not have inverse property as 0
does not have inverse. We can say it is abelian monoid.

Made by Quantum City


goclasses.in

//Lecture 29

5.3.1) Unit group :

But can we convert it into group ? – Answer is yes, we can by removing elements who do not have
inverse. for example, (Z4, mul mod 4). Z4 = {0, 1, 2, 3}

We obtained new set we cannot call it Z or something because it is not consecutive integer, we can
denote it by new notation U4. (we call it Unit Group)

Thus,

But what makes other elements to remain in set ? – if you note carefully 1, 3 are called units and all
units are coprime to 4. For example, 1 and 3 is coprime to 4. Means in unit group we have only those
elements in base set who are coprime to n.

𝑈𝑛 (𝑈𝑛𝑖𝑡 𝑔𝑟𝑜𝑢𝑝) = {𝑚|𝑚 ∈ 𝑍𝑛 , 𝑚 𝑎𝑛𝑑 𝑛 𝑎𝑟𝑒 𝑐𝑜𝑝𝑟𝑖𝑚𝑒}


//Lecture 30

Now, let’s look at some unit group,

We observed two templets in group of order 4 :

• {e, x, y, z} →
• {e, x, y, z} →

Which means if we have more than 2-unit group of order 4 at least 2 of them are isomorphic.
// Lecture 33

5.3.2) Cyclic group :

Definition : Group that can be generated by a single element. OR Group with at least one generator.

Example, (𝑍𝑛 , ⨁𝑛) is addition modulo n group and it is cyclic with generator 1 (how?)

Q : Order of smallest group that is not cyclic ? – if you have order 1 then it is cyclic. If you have order
of 2 group then also cyclic (you can check by cayley table). If you try with 4 then you will get one
namely (𝑈8 , ⨂8) is group which is not cyclic so answer is 4.

Q : If two cyclic group have same order then it is isomorphic ? – yes possible, take nth root of unity
under multiplication and addition modulo n. they are isomorphic because same pattern…

Made by Quantum City


goclasses.in

Theorem : Any cyclic group is isomorphic to either Z or Zn.

For infinite cyclic group → Z, + and for finite cyclic group of order n → Zn, ⊕𝑛

From above example of nth root of unity and addition mod n we can also conclude that every cyclic
group is also abelian.

Now, let’s look at order 4 groups we know that 2 groups are possible and both of them are abelian
and if you look back you will realize that a is generator in first diagram and second diagram has no
generator which means one is cyclic and one is non-cyclic group of order 4.
//Lecture 36

5.3.3) Lagrange’s theorem :

It says If G is a finite group and 𝑯 ≤ 𝑮 then |H| divides |G|. or in other words order of every
subgroup of finite group G divide order of G.

Element is also a subgroup so order of an element of finite group divides order of group.

But converse is not true, here converse is “if n (a number) divides order of G then there exists a
subgroup of order n”. (not necessarily true for group)

But if G is abelian group then above statement is true. i.e. If n (a number) divides order of G then there
exists a subgroup of order n.

Q : What if order of G is prime (p) ? – then if subgroup exists then there will be only two subgroups of
G. i.e. one identity element and other is subgroup with order p. Which means subgroup can generate
G with power p which means it is cyclic group. We can say that if order of G is prime then G is cyclic.
Which means every subgroup of a cyclic group is cyclic.
//Lecture 39

5.3.4) properties of subgroups :

For any group G, union of two subgroups may not be a subgroup.

For example, consider group (Z, +) and subgroup (3Z, +) and (4Z, +) then (3Z ∪ 4Z, +) is not subgroup
because of closure property 3 + 4 ∉ (3Z ∪ 4Z)

Q : for any group G, intersection of two subgroups is always be a subgroup ? – to prove subgroup we
take two subgroups of G and then we find closure, identity, inverse of intersection of two subgroup.
So,

So, let’s start with closure property, if we know that 𝑎, 𝑏 ∈ 𝐻, 𝑎 ∗ 𝑏 ∈ 𝐻 and 𝑎, 𝑏 ∈ 𝐿, 𝑎 ∗ 𝑏 ∈ 𝐿 then
𝑎, 𝑏 ∈ 𝐻 ∩ 𝐿, 𝑎 ∗ 𝑏 ∈ 𝐻 ∩ 𝐿 this is also true. Now, second is identity property. So, all subgroup
contains it so intersection will definitely contain it. Talking about inverse of so same as identity, we
know that is 𝑎 ∈ 𝐻 then 𝑎−1 ∈ 𝐻, also 𝑎 ∈ 𝐿 then 𝑎−1 ∈ 𝐿 (third point of definition of subgroup).
Thus, if both contains a-1 so intersection will also contain a-1. We conclude our proof here.

If Group have order of 6 then we know order of its subgroup will be {1, 2, 3, 6} here subgroup with
order 2 or 3 is called non-trivial subgroup. And with 1 or 6 will be trivial subgroup.

Alternative definition of subgroup :

Made by Quantum City


goclasses.in

Our first definition was

Let (G, *) be a group. A subgroup of G is a subset H ⊂ G such that

• 𝑒∈𝐻
• 𝑥, 𝑦 ∈ 𝐻 → 𝑥 ∗ 𝑦 ∈ 𝐻
• 𝑥 ∈ 𝐻 → 𝑥 −1 ∈ 𝐻

Now, we can remove first point i.e. 𝑒 ∈ 𝐻 and instead we can write “non-empty subset H and combine
second the third point” combining second and third point will give us. 𝑥𝑦 −1 ∈ 𝐻 and when x = y then
𝑥. 𝑥 −1 ∈ 𝐻 which guarantees the presence of identity element in subgroup H. so, in short, we can say
that

A non-empty subset H of a group is a subgroup of G if, for any 𝑥, 𝑦 ∈ 𝐻, we have 𝑥𝑦 −1 ∈ 𝐻.

Existence of element in subgroup :

Suppose we have group G = <a> and consider two elements av and au from G. Now, we know that
power of this element should be present in group or subgroup generated by that element i.e. 𝑎𝑣𝑥 ∈
𝐺 𝑎𝑛𝑑 𝑎𝑢𝑦 . Thus, 𝑎𝑣𝑥 𝑎𝑢𝑦 = 𝑎𝑣𝑥+𝑢𝑦 ∈ 𝐺.

Now, we know u and v are some random natural number which may or may not contains
common term. Which means 𝑎gcd (𝑣,𝑢)(𝑠𝑥+𝑡𝑦) ∈ 𝐺, gcd is nothing but some common term between v
and u. Then, 𝑎gcd(𝑣,𝑢) ∈ 𝐺. Which is the smallest subgroup of G which contains both 𝑎𝑣 and 𝑎𝑢 .
𝑛
Lemma : If 𝑂(𝑔) = 𝑛 then 𝑂(𝑔𝑘 ) =
gcd (𝑛,𝑘)

Q : Let G is cyclic group of order 48, then how many elements of order 8 are in G ? – from above lemma
48
we know that O(g) = 48 and let 𝑂(𝑔𝑘 ) = 8 = which indirectly means gcd(48, 𝑘) = 6. We
gcd (48,𝑘)
found that k = 6, 18, 30, 42.

NOTE :

1) A group (finite or infinite) is never the union of two of its proper subgroups.
2) Every group of order p2 or p where p is prime is abelian. Which implies every group of order
less than 6 is abelian.
3) Number of different non-isomorphic abelian groups of order 𝑷𝒌 (𝑷 is prime) is the number
of partitions of 𝒌.

Silly mistake :

Here m could be k*O(g)>>O(G) so


option D will not be always true

 If ∀𝑥 ∈ 𝐺, 𝑥 2 = 𝑒 then it is abelian because (𝑥𝑦)2 = 𝑒 → 𝑥𝑦. 𝑥𝑦 = 𝑒 → 𝑥𝑦 = 𝑦 −1 𝑥 −1 = 𝑦𝑥.

Made by Quantum City


goclasses.in

6. COMBINATORICS
//Lecture 1

In this module we address only one problem : How to count without counting OR more specifically
how to figure out how many things are there with a certain property without actually enumerating all
of them.

In this module we will study following :

1) Basic counting principles : Addition, multiplication, subtraction, bijection, pigeonhole principle


and double counting
2) Ordered arrangements – strings, maps and products : permutations
3) The twelvefold way – balls in boxes : “n” unlabeled balls or labeled balls in “k” unlabeled or
labeled boxes.
4) Inclusion-exclusion principle
5) Generating functions and recurrence relation
//Lecture 2

6.1) Basic counting principles :

6.1.1) The sum rule : Consider we have one task to select one person from group of students and
teachers.

Mutually disjoint condition is required because if there exists some common person between them
then we are counting it twice.

Rule : If there are n(A) ways to do A and distinct from them, n(B) ways to do B, then the number of
ways to do A or B is n(A) + n(B).
//Lecture 3A,3B

6.1.2) The product rule : Consider a problem of finding different type of routes from Chennai to Delhi
via Bangalore.

From C, you have two choices and after reaching B we have 3 choices so in total 6 routes are possible.

One thing you have notice that whole task was depend upon C to B and B to D. In sum rule if we select
person from student then our task is over. But here in product rule task depend upon several tasks.

Q : 4 Letter English word; How many ? -

Only doing task T1 cannot do whole task.

That is why we have not applied sum or addition rule.

Q : How many different bit strings of length seven are there ? – bit string means sequences of 0’s or
1’s or both. 7 length is given and each place have 2 choices so 27.

Made by Quantum City


goclasses.in

//Lecture 4

6.1.3) The subtraction rule : If a task can be done in either n1 ways or n2 ways, then the number of
ways to do the task n1 + n2 minus the number of ways to do the task that are common to the two
different ways.

Q : How many bit strings of length eight either begin with 00 or end with 101 ? -

𝑘
⌈ ⌉
Number of K length English palindromes : 26 2 (why?)
//Lecture 6

6.1.4) Counting by case : Mutually exclusive, exhaustive cases

Take an example A student ID is made up of 3 letters followed by two digits. How many student ID’s
are possible with an even number of A’s ? – In such problem we can create two cases, one in which
number of A’s is 0 and another in which number of A’s is 2. Both cases are mutually exclusive meaning
we are not overcounting anything. As these are mutually exclusive, we can apply addition rule.
Number of A’s is 0 + number of A’s is 2 = even number of A’s.

In case 2 you can see we have covered all the possible cases in which no. of A’s is 2. Which means we
have exhausted all the cases. In short,

Mutually exclusive & Exhaustive cases

Q : Flamingos fanny and Freddy have three offspring : Happy, Glee, and Joy. These five flamingos are
to be distributed to seven different zoos so that no zoo gets both a parent and a child. It is not required
that every zoo gets a flamingo. In how many different ways can this be done ? – Underlined statement
has importance it is saying one of the parents (father or mother or both) and child cannot be in same
zoo.

Made by Quantum City


goclasses.in

//Lecture 7

6.1.5) The complement rule : It is sometimes easier to calculate the undesired cases.

Desired = Total – Undesired

Q : Each user on a computer system has a password, which is six to eight characters long, where each
character is an uppercase letter or a digit. Each password must contain at least one digit. How many
possible passwords are there ? – we can first create three cases, password having length six, length
seven and length eight. Now, each must contain at least one digit. This is same as saying total – no
digit. Thus, we solve for each case and add them to get required results.

About cards : (basic info)

Standard deck of card contains 52 cards. Each card belongs to one of the 4 suits namely.

Q : How many 4-digit numbers are there, not starting with 0, without repetition, also must be an odd
number ? – you got 6 x 8 x 9 x 5 as answer but it is wrong as you are undercounting.

Guideline 1 : while applying product rule start with the most restricted place.

Here most restricted place is last place i.e. it should be odd number so we have 5 choices for last digit.
Now we move one to first digit because there is one more restriction of not starting with 0. Like that
now, answer is 8 x 8 x 7 x 5.

Guideline 2 : Just because some information is given, doesn’t mean it is useful.


//Lecture 8A

6.1.6) Division Rule : To count the number of cows in your field, first count the number of legs and
then divide by four.
//Lecture 8B

We know that one to one correspondence means bijection meaning it is one to one and onto. Similarly,
we can extend this to k to one correspondence meaning it is k to one and onto function.

A k to 1 correspondence is an onto mapping in which every B object is the image of exactly k A objects.

So why we have covered this in division rule, let’s answer this by following question.

Q : In how many ways can we place two identical rooks (elephant) on an 8 by 8 chessboard so that
they occupy different rows and different columns ? –

If we place one rook (black or while) we cannot place other rooks at same row or column.

Made by Quantum City


goclasses.in

In question it is asked that identical rooks, first let’s find if rooks are not identity meaning they are
different. If we have one rook (say white) there are 64 possible places. And then we take another rook
(say black) so for that we have 49 possible places (64 – 15). And similar case for first rook being black
and second rook being white is also possible. So, in total we have 64 x 49 ways to place two different
rooks on chessboard. If we have identical rooks then these two combinations are same.

Similarly, you can solve problems like possible strings of length 6 in which a should occur before b
where possible alphabet of strings is a, b, c, d, e, f.

Subsequences : A subsequence of a string is a new string that is formed from the original string by
deleting some (can be more) of the characters without disturbing the relative positions of the
remaining characters. (i.e., “acd” is a subsequence of “abcde” while “aec” is not).

If W = A B C D then

1) A C –
2) B C –
3) C B –

Q : how many linear orders of 6 elements a, b, c, d, e, f is there such that “a” comes before “b”, and
“b” comes before “c” (not necessarily immediately) ? – here not necessarily immediately means abc
is subsequence. “a” comes before “b” and “b” comes before “c” can happen in only sequence. Let’s
take one instant.

Made by Quantum City


goclasses.in

NOTE : Mostly, division principle is not used directly but in the form of combination this is used.
//Lecture 10

Now, will see permutation and combination which are consequences of product rule and division
principle. Difference between permutation and combination is - in permutation picking first, second
and third place winners. And in combination picking three winners.

1) Permutation : (A fancy application of product rule)

Q : Number of permutations/orderings/arrangements of n distinct elements = n! = P(n, n)

Q : Number of permutations/orderings/arrangements of 2 distinct elements from a set of 5 elements


are there? –

𝒏!
Permutation of r object from n objects (distinct) = 𝑷(𝒏, 𝒓) = (𝒏−𝒓)!

//Lecture 11

2) Combination : (A fancy application of division rule)

Q : Number of ways to select 3 people from a class of 5 people. – forget about combination we will
use division rule. We have to select 3 people say a, b, c. so if I select abc in this sequence is same as
select bca or cba because here order does not matter. So, such 3! Permutation exists of abc. Thus, all
3! Strings map to 1 string abc.

Q : How many poker hands of five cards be dealt from a standard deck of 52 cards ? Also, how many
ways are there to select 47 cards from a standard deck of 52 cards ? – answer of first question is C(52,
5) very simple, and second is C(52, 47) both are same because selecting 5 cards from 52 cards is same
as selecting 47 cards for rejecting from 52 cards.

𝐶 (𝑛, 𝑟) = 𝐶 (𝑛, 𝑛 − 𝑟) 0 ≤ 𝑟 ≤ 𝑛

It is pretty obvious that we cannot select r(>n) objects from n objects.


//Lecture 13

Now we are going to discuss some templets(cases) of combination and permutation :

• Some elements always together :

If some elements are always together then consider them as a single element or box and then
permute. For example, total number of permutations of the letters ABCDEFG contains strings ABC and
DE –

Made by Quantum City


goclasses.in

• Some element never together :

In such case we first place element which may or may not be together. Then in gaps we will place
element which should never be together. For example,

Q : How many ways are there for eight men and five women to stand in a line so that no two women
stand next to each other ? – First position the men (mi) and then consider possible positions for the
women(wi).

//Lecture 14a

6.2) Combinatorial Arguments :

In this section we are going to see combinational arguments with making stories and proving identities
with pure logic.

6.2.1) Combinational identities :

1) Pascal’s identity : let n and K be positive integers with n>=k. Then (𝑛+1
𝑘
𝑛
) = (𝑘−1) + (𝑛𝑘)

Proof. This is same as you have n+1 student in class and you have to select k students. Consider a
random student Bunty. Now, if you are selecting k student from n+1, in selected k student bunty will
be there or bunty will not be there. So, we have two cases, if Bunty is already selected then we will
have C(n, k-1) ways for selecting remaining student and if bunty is not included in selected student
then there will be C(n, k) because now sample space will reduce from n+1 to n and we still have to
select k students. ■

Similarly, we can extent this idea to two already selecting two student or rejecting two students.

Above all formula are called recursive definition of binomial coefficient.


//Lecture 14b

2) Vandermonde’s Identity : (𝑛+𝑚


𝑟
) = ∑𝑟𝑘=0(𝑛𝑘)(𝑟−𝑘
𝑚
)

Similarly, by creating stories we can prove other identity for example,


𝑛+𝑚 𝑛 𝑚 𝑛 𝑚 𝑛 𝑚 𝑛 𝑚
( ) = ( )( ) + ( )( ) +( )( ) + ⋯+ ( )( )
𝑟 0 𝑟 1 𝑟−1 2 𝑟−2 𝑟 0
This same as selecting r person from n males and m females. First, we can select all r man + we can
select 1 man and r-1 women to form r and so on.

Let’s prove another identity by creating stories,

Made by Quantum City


goclasses.in

For any nonnegative integer n, ∑𝒏𝒌=𝟎 𝒌(𝒏𝒌) = 𝒏𝟐𝒏−𝟏

First look at LHS it says ∑𝑟𝑘=0 𝑘(𝑛𝑘) we can break it down ∑𝑟𝑘=0(𝑛𝑘) this is saying subsets of n people. Or
we can say number of different committees from n people. Then we are multiplying it with k. this is
same as first making committee of k people from n and then selecting 1 chairperson from selected k
people. Thus, meaning of LHS is form different committee from n people with a chairperson.

This is same as first selecting chairperson from n and then forming subset or different group with
remaining n-1 people. i.e. n * 2n-1.
//Lecture 14c

Q : Prove that 𝐶 (𝑛, 𝑟) + 𝐶 (𝑛 − 1, 𝑟) + 𝐶 (𝑛 − 2, 𝑟) + ⋯ + 𝐶 (𝑟, 𝑟) = 𝐶(𝑛 + 1, 𝑟 + 1) – RHS says select


r+1 people from n+1 people. And LHS is saying first take r+1 and then put aside one number from
already taken r+1. You can prove this by pascal’s identity also (try).

Hockey-Stick identity : (𝑛+1


𝑟+1
) = (𝑛𝑟) + (𝑛−1
𝑟
) + (𝑛−2
𝑟
) + ⋯ + (𝑟+1
𝑟
) + (𝑟𝑟) 𝑓𝑜𝑟 𝑛, 𝑟 ∈ 𝑁, 𝑛 > 𝑟
//Lecture 15

6.2.2) Binomial Theorem :

Binomial means summation of two terms. Binomial theorem is our childhood theorem. Take an
example,

Consider, (𝑎 + 𝑏)2 = (𝑎 + 𝑏)(𝑎 + 𝑏)

This is same set consisting of same elements and selecting one element from different sets such that
no two elements belongs to same set.

Similarly, (𝑎 + 𝑏)𝑛 = (𝑎 + 𝑏)(𝑎 + 𝑏)(𝑎 + 𝑏) … 𝑛 𝑡𝑖𝑚𝑒𝑠 (𝑎 + 𝑏) how many times ar bn-r can occur ? –
first select r sets from which you will select a and from remaining you will select b. we can either select
0 a at minimum and at maximum we can select n a’s. We can write this in summation form as,
𝑛 𝑛
(𝑎 + 𝑏 )𝑛 = ∑ ( ) 𝑎𝑟 𝑏 𝑛−𝑟
𝑟=0 𝑟

//Lecture 16

Bijective proofs : A bijective proof in combinatorics just means that you transfer one counting problem
that seems “difficult” to another “easier” one by putting the two sets into exact correspondence. Let’s
take one example,

Task of selecting 1 person from 4 people (a, b, c, d) .

Made by Quantum City


goclasses.in

Another example, ask yourself which of the following is easier for you ? – counting bitstrings of length
of n or counting number of subsets of a set of size n.

//lecture 17

6.2.3) Permutation with repetition :

Consider one problem of creating three-digit number using two digits (let’s say 1, 2). It is obvious that
without repetition it is not possible. We know that for each three position of digits 2 choices are there
so in short, we can create 23 numbers.

In general, the number of r-permutations of a set of n objects with repetition allowed is nr.

• Permutation with repeated elements : A permutation of a set of objects in an ordering of


those objects. When some of those objects are identical, the situation is transformed into a
problem about permutations with repeated elements.

Q : How many permutations of “cook” are there ? –

Method 1 : First select two position fixed for two o’s and then permute remaining two letter.

Method 2 : Division rule, Consider two o’s as different o’s like “c o1 o2 k”

Method 3 : we first select one position for C and two position from remaining position and 1 position
from remaining position for k.

So, from now on if permutation with repeated elements is given you have to solve using all 3 methods
(good practice for gate)

Made by Quantum City


goclasses.in

In short we can say that, If n elements are consists of n1 of type 1, n2 of type 2, n3 of type 3,…, nk of
𝑛!
type k then permutation with repeated element will be
𝑛1 !𝑛2 !𝑛3 !…𝑛𝑘 !

//lecture 18

Q : Number of permutations of word ABCDEF in which A comes before B and B comes before C (not
necessarily immediately) – This question is same as counting word which have ABC subsequences. We
will see two methods of solving this question.

Method 1 : Division rule :

Method 2 : First select three position for ABC. Once you have selected position you cannot change the
order as A must come before B and C. So, we can permute remaining element.

//Lecture 19A

6.3) Distributing objects into boxes :

We may encounter four cases :

• Distinguishable objects into Distinguishable boxes (DODB)


• Indistinguishable objects into distinguishable boxes (IODB)
• Distinguishable objects into indistinguishable boxes (DOIB)
• Indistinguishable objects into indistinguishable boxes (IOIB)

6.3.1) Distinguishable objects into distinguishable boxes : (DODB)

Q : How many ways are there to distribute hands of 5 cards to each of four players from the standard
deck of 52 cards ? -

But why we are getting such pattern ? – Because you can consider this problem like this. We know
that 5 cards will definitely be for A, B, C, D. so we write AAAAA on five cards and same for B, C, D. and
for remaining 32 cards will not be distributed to anyone else so we write TTTT…32 times. Now, this
problem reduces to permuting string AAAAABBBBBCCCCCDDDDDTTTT…32 times T.

Made by Quantum City


goclasses.in

//Lecture 19B

Objects to be placed into boxes where the order these objects are placed into the boxes does not
matter
//Lecture 20A

6.3.2) Indistinguishable objects into Distinguishable boxes : (IODB – star bar problem)

Consider giving 5 chocolates to 3 children. What mattes here ? – number or order ?

Above problem is same as selecting position of 2 bars among 5 chocolates.

Q : How many ways are there of distributing 30 identical objects into 3 distinct boxes if each box must
have at least 5 items ? – This problem is saying at least 5 items which means each box already have 5
items we just have to put remaining items into 3 boxes. So, 30-15 = 15 items remaining. Now, we
convert this problem to star bar problem, we will get, 15 star and 2 bars => C(17, 2)

Using IODB we can create five types of problems. Let’s explore…


//Lecture 20B

1) Problems related to star bar/ IODB :

Q : The number of ways to distribute 8 identical balls to 12 urns is the same as the number of ways to
distribute 11 identical biscuits to 9 dogs. – This statement is true how ? First, we write object and box
and then we convert this problem to star-bar problem.

2) Combination with repetition :

Imagine you are in market and you want to buy 4 fruits from apples, mangoes, oranges. Here in what
order I select fruits does not matter. And this is problem of combination in which I can have more than
one apple, mangoes, oranges. This is the problem of combination with repetition. How this is
connected to star bar or IODB problem ?

We can deduce this problem to following :

Here star is number of objects and bar is fruits(distint) - 1.

• Combination help us to answer the question “In how many ways can we choose r objects from
n objects ?”
• And combination with repetition ask us “In how many ways can we choose r objects from n
kinds of objects?” in apple, orange exmple, n kinds of objects means type of fruits.

Made by Quantum City


goclasses.in

//Lecture 20C

3) Non-negative integer solution :

Consider one equation x + y + z = 10 and We ask “How many non-negative integer solutions are there?”
To tackle this problem, we use IODB format.

This is same as star-bar problem where + sign is bar and 10 number is number of stars.

If we ask “How many positive integer solutions are there?” then 0 is not allowed, so we allocate 1 to
all the variable to make them positive and as a result our star will gets reduced by same amount.

Q : But in real we can have some restriction on numbers that x, y and z can take just like asking “How
many solutions to x + y + z = 10 such that a>=2, b>=-2, c>=0 ?” – In previous example we handled the
condition of positive solutions by giving each variable 1 number. Just like that we can handle a>=2
situation by already giving a, 2 numbers. To handle b>=-2 condition we have to take 2 numbers from
b and add them to total. And c is already in sync with our problem. So, in the end we will have equation
like x’ + y’ + z = 10 such that x’, y’, z>=0 where x’ = x+2 and y’ = y – 2. Final answer is C(12, 2)

Q : In reality we can also have inequalities associated with variable so we ask another question “How
many non-negative solutions can x + y + z <=8 have ?” – we can always convert inequalities by
converting them to equal to sign by introducing a new variable. x + y + z + w = 8. Problem solved !
//Lecture 20G

Integer compositions of n :

In mathematics, a composition of an integer n is a way of writing n as the sum of a sequence of positive


integers. Example, composition of 4 would be 1 + 3, 3 + 1, 2 + 2, 1 + 1 + 2, 1 + 2 + 1,…

We can say that composition of n is ordered summation of positive integer. You can also specify more
info as such, composition of 4 into 3 parts. This is equivalent to positive integer solution.

The set of compositions of n into k parts =

𝑛−𝑘+𝑘−1 𝑛−1
( )=( )
𝑘−1 𝑘−1
This formula represents composition of n into k parts. From this we can have formula for distributing
n distinct objects into k distinct boxes so that no boxes are empty. here in integer compositions of n
we have considered that objects are indistinguishable. We can make them distinguishable by
multiplying n!.

So, Ways of distributing n distinct objects into k distinct boxes so that no boxes are empty is,
𝑛−1
( ) 𝑛!
𝑘−1

Made by Quantum City


goclasses.in

What if we ask “What is the total no. of composition?” – This means taking value of k from 1 to n.
Thus, total no. of composition of n would be ∑𝑛𝑘=1(𝑛−1
𝑘−1
). But
𝑛 𝑛−1 𝑛−1 𝑛 − 1
∑ ( )=∑ ( ) = 𝟐𝒏−𝟏
𝑘=1 𝑘−1 𝑘=0 𝑘
//Lecture 20D

4) Multiset Problem :

Multiset is a set with repetition allowed. For example, in set {1, 2} = {2, 1, 2} but in multiset <1, 2> !=
<2, 1, 2> but {1, 2} = {2, 1} in set and <1, 2> = <2, 1> in multiset meaning order doesn’t matter.

Problem is “If elements are 1, 2 then how many multisets of size of 3 can be constructed ?”

We can convert this problem into star-bar problem…

Here, star = 3 (size of multiset) and bar = 1 (no. of distinct elements – 1)


//Lecture 20E

5) Non-decreasing integer sequences :

Q : The number of 4-digit numbers having their digits in non-decreasing order (from left to right)
constructed by using digits belonging to the set {1, 2, 3} is ? – We can convert this problem to star-bar
problem like below…

Here star = 4 = number of digits in (here 4-digit number) and bar = 2 = number of elements in set – 1
(here 1, 2, 3 so total 3 elements)

In general, problem “find the number of non-decreasing sequences of length-n sequences from {1,
2,…, m}” is equal to star = n and bar = m-1. Thus, C(n+m-1, n).
//Lecture 20F

Q : How many non-decreasing sequences of 6 integer from set {0, 1, 2, 3} ? – (6+4−1


3
) − 1 why -1
because of 000000 can occur but you’re wrong, Read the question carefully it says sequences of 6
integer not number or digit. So, 000000 will also count.

Notation : ((𝑛𝑘)) = (𝑛+𝑘−1


𝑘
) selecting k objects from n kinds of objects. i.e. k star and n - 1 bar

In short, we can say that,

Order matters Order does not matter


Repetition is not allowed 𝑃(𝑛, 𝑘) 𝑛
( )
𝑘

Made by Quantum City


goclasses.in

Repetition is allowed 𝑛𝑘 𝑛+𝑘−1


( )
𝑘
//Lecture 21

6.3.3) Distinguishable objects into indistinguishable boxes :

Analogy used “Friends trips to haunted hotel with same rooms” == Number of equivalence classes of
set. == number of partitions

Q : 5 friends, creating two groups, of size 3 and size 2. How many ways ? – let’s say 5 friends are a, b,
c, d, e. size 3 and size 2 groups can have abc, de or bcd, ae but one thing to note is that abc, de and
de, abc are same here order of group doesn’t matter we are only concern about element of group.
Answer is C(5 ,3) * C(2, 2).

Q : 8 friends. Creating three groups, of size 3, size 3, size 2. How many ways ? – similar to above
question answer should be C(8, 2) * C(6, 3) * C(3, 3). But this is wrong why we are overcounting cases
like,

Q : 9 friends. Creating four groups, of size 2, size 2, size 2 and size 3. How many ways ? – First, we
choose size 3 from 9 friends. Then we have three size 2 groups which we can overcount so we divide
it by 3!. Thus, C(9, 3) * C(6, 2) * C(4, 2) / 3!.

Q : 3 Friends. How many ways partition can be created ? – here partition is same as groups but size is
not given so we can have group of 1, 2, 3 friends. And we know that it is bell number with n = 3. But
let’s solve it following way.

But this only works for partition and we do not have any generalize formula for DOIB templet.

Q : How many partitions of 5 elements are there ? – from bell number it is 52. Partition means non-
empty so bell no. = no. of non empty partition

Q : If prime factorization of X is p1c1 p2c2 p3c3… pkck. Then what is the number of ways for which X can
be resolved as a product of two factors, such that those two factors are relatively prime ? – Relatively
prime means gcd of two number is 1. Question asks for number of ways such that X = mn where m, n

Made by Quantum City


goclasses.in

are relatively prime. Here we have k distinguishable objects and two boxes. Same as partition of k
objects into two part. This is same as binomial expansion of (1+1)k/2. Why 2 because we are
overcounting (x, k-x), (k-x, x) cases. Final answer 2k-1.
//Lecture 22

6.3.4) Indistinguishable objects into indistinguishable boxes (IOIB) :

Q : How many ways to put 7 balls in 4 identical bins ? – We can create 4 cases because of 4 bins,

Case 1 : only 1 bin is used = (7, 0, 0, 0)

Case 2 : only 2 bins is used = (6, 1, 0, 0), (5, 2, 0, 0), (0, 5, 2, 0), (4, 3, 0, 0)

Case 3 : only 3 bins is used = (5, 1, 1, 0), (4, 2, 1, 0), (3, 2, 2, 0), (3, 3, 1, 0)

Case 4 : only 4 bins is used = (4, 1, 1, 1), (3, 2, 1, 1), (2, 2, 2, 1) … So, in total 11 ways.

Remember this is not same as integer composition, in integer composition order matters as it belongs
to IODB template. but above question is same as partition of 5. Seven partition of 5 are :

5, 4 + 1, 3 + 2, 3 + 1 + 1, 2 + 2 + 1, 2 + 1 + 1 + 1, 1 + 1 + 1 + 1 + 1.

What is integer partition ? – If n is a positive integer, than a partition of n is a non-increasing sequence


of positive integers p1, p2, p3,…, pk whose sum is n. Each pi is called a part of the partition. We let the
function p(n) denote the number of partitions of the integer n. example, P(5) = 7 as we saw previously.

This is different from integer composition and partition of set. In integer composition you have
distinguishable boxes and in partition of set you have distinguishable element. But in integer partition
boxes and elements both are indistinguishable. In short,

Composition of natural number = IODB template

Partition of a set = DOIB template

Partition of Natural number = IOIB template


//Lecture 24A

6.4) Inclusion – Exclusion principle :

A tool to find union of a finite number of sets.

Q : How many integers from “a” to “b” (inclusive) are multiples of n(i.e. divisible by n) ? –

Q : Line up of 7 people – Mother, father, 3 sons, 2 daughters. How many line-ups are there in which
the mother is next to at least one of her 3 sons ? –

Method 1 : using complement rule

Made by Quantum City


goclasses.in

Method 2 : Using inclusion-exclusion principle, Question asks for (MS1/S1M) or (MS2/S2M) or


(MS3/S3M) here M represents mother and S1, S2, S3 represents son.

//Lecture 24b

Q : How many solutions does 𝑥1 + 𝑥2 + 𝑥3 = 11 have, where 𝑥1 , 𝑥2 𝑎𝑛𝑑 𝑥3 are nonnegative integers
with 𝑥1 ≤ 3, 𝑥2 ≤ 4 and 𝑥3 ≤ 6 ? – Here we use Total – unfavorable case = Favorable case. But what
is total here so all variable should be nonnegative integers which means total = C(11+2, 2) = C(13, 2)
all the non-negative solution. Now, talking about unfavorable case which would be (𝑥1 ≥ 4 𝑜𝑟 𝑥2 ≥
5 𝑜𝑟 𝑥 ≥ 7) this is negation of constraints given in question.

//Lecture 24c

6.4.1) Derangement : No one in their own place

A derangement is a permutation of the elements of 1, 2, 3, …, n such that none of the elements


appears in their original position. Consider word consists of abc,

Similarly, D2 = 1. Which means derangement = 𝑎̅ ∧ 𝑏̅ ∧ 𝑐̅

So, let’s find general formula, Dn = ?

#Derangement = n! – (at least one number should be its own place)

Let, [1] represents 1 (a number) is its own place. Thus,

At least one number should be its own place = [1] + [2] + … +[n] – [1][2] – [1][3] + … + [1][2][3] +
[1][2][4] + … + (-1)n-1 ([1][2]…[n]).

Made by Quantum City


goclasses.in

At least one number should be in its own place = 𝑛 × (𝑛 − 1)! − 𝐶 (𝑛, 2) × (𝑛 − 2)! + 𝐶 (𝑛, 3) …

# Derangement = 𝑛! − 𝑛 × (𝑛 − 1)! + 𝐶 (𝑛, 2) × (𝑛 − 2)! − 𝐶 (𝑛, 3) × (𝑛 − 3)! + ⋯

𝟏 𝟏 𝟏 𝟏 (−𝟏)𝒏
# Derangement = 𝒏! × (𝟏 − + − + − ⋯+ )
𝟏! 𝟐! 𝟑! 𝟒! 𝒏!

Derangement with repetition :

Consider derangement of word “BOTTLE” here simply !6 contains overcounting cases like

We need to subtract all these three cases from !6 ➔ !6 - !5 - !5 - !4 and as both T are same we need
!6−!5−!5−!4
to divide it by 2! . So, correct answer is .
2!

NOTE :

1) If you observe carefully, boxes which we have taken in calculation are distinct if they were
not distinct then there is no point of position. And elements are also distinct. Which means
the formula of Dn works iff n distinct elements in n distinct positions.
//Lecture 24D

6.4.2) The number of onto function :

A function 𝑓: 𝐴 → 𝐵 is onto iff every element of B has preimage.

We want to know the total number of possible onto function from A to B. We use complement rule
to simplify this problem to

#onto function = Total – Not onto function

Consider one example, let 𝑓: {1, 2, 3, 4} → {𝑎, 𝑏} then # of onto function = 24 – (a does not have
preimage(*a) ∪ b does not have preimage (*b))

(*a) ∪ (*b) = *a + *b - *a*b

# of onto function = 16 – 2 = 14.

Q : How many ways are there to assign five different jobs to four different employees if every
employee is assigned at least one job ? – This is DODB templet so we use our usual method,

Method 1 :

Made by Quantum City


goclasses.in

Method 2 : Here it is written as every employee is assigned at least one job. Meaning every employee
have at least one preimage this is same as saying 𝑓: 𝑗𝑜𝑏 → 𝑒𝑚𝑝𝑙𝑜𝑦𝑒𝑒 and we have to find # of onto
functions.

# of onto function = 45 – (4. 35 – C(4,2). 25 + C(4, 3). 15 – 0) = 1024 – 784 = 240.

NOTE :

1) If we reduce some problem into finding no. of onto function then if |B| = |A|- 2 then apply
DODB and if |B|< |A| - 2 then apply inclusion-exclusion principle.

INTO function : function which are not ONTO. i.e. Total function – Onto function

//Lecture 25A

6.5) Generating function :

Generating function is tool which converts sequence into function.

Let’s say sequence S = a0, a1, a2, a3, a4,…

G(S) = a0x0 + a1x1 + a2x2 + a3x3 + … = ∑𝑛≥0 𝑎𝑛 𝑥 𝑛 . This power series is the generating function of
sequence S. Our task is to find an i.e. coefficient of x here x is just a dummy variable meaning we do
not care about x. We have taken power series just to express sequence into some math function. In
generating function, we never put value of x like 1, 2 and conclude anything related to convergence.

There are many types of generating function but in gate we have only ordinary generating function.
So, if we say generating function it means ordinary generating function. (for simplicity)
//Lecture 25B

For upcoming content, we need some knowledge of AP, GP, and infinite AGP. One formula which we
use frequently is

If S = a + (a+d)r + (a+2d)r2 + (a+3d)r3 + …

𝒂 𝒅𝒓
𝑺= + … 𝒇𝒐𝒓 𝒊𝒏𝒇𝒊𝒏𝒊𝒕𝒆 𝑨𝑮𝑷
𝟏−𝒓 ( 𝟏 − 𝒓)𝟐
For example,

For finite AGP, we follow our standard procedure of multiplying by r and subtract and then sum.

Here don’t worry about x = 1. We don’t care we only care about sequence.

As generating function is function, we can also do differentiation.


//Lecture 25D

Made by Quantum City


goclasses.in

Q : How can I determine the sequence generated by a generating function f(x) = (2x – 3)3 ? – We know
that this series will be in the form of

It is very obvious that if we put x = 0 then we will get a0 but in that matter if we put x = 1 do we get
a1 ? Absolutely not. But if we take derivative of f(x) and then put x = 0 then we will get a1 also. Here
in this example, we put x = 0 to get a0 term, a0 = -27. If we take derivative, we will get f’(x) = 6(2x –
3)2. Then put x = 0, a1 = 54. Similarly,

But in gate we don’t do this, we simply expand this formula.


//Lecture 25E

Q : Let m be a positive integer. Let ak = C(m, k), for k = 0, 1, 2, …, m what is the generating function for
the sequence a0, a1, …, am. ? -

What if we do not limit the value of k in previous question, then k = 0, 1, 2, 3, … then sequence will
become,

//Lecture 25F

6.5.1) Extended binomial coefficient :

We know that C(n, r) is defined only for 0<=r<=n where n is whole number but we extend n to take
real number also. For example, C(1/2, 2) = (1/2)*(1/2-1)/2! = -1/8. This is called extended binomial
coefficient.

But some properties are not common between normal binomial and extended binomial coefficient.
i.e. nCr = nCn-r iff n ∈ N which means below equation is not true.

But why we need extended binomial coefficient. We need this to solve problem such as

Q : What is the coefficient of x4 in the expansion of (1+x)-2 ? – This is same as asking C(n, 4) = C(-2, 4).

And in extended binomial coefficient we cannot handle expansion of (a+b)n where n ∈ Z. in such case
we have to take an outside to get an(1+(b/a))n. and then we solve.

We know that

Made by Quantum City


goclasses.in

𝑪(−𝒏, 𝒓) = (−𝟏)𝒓 ×𝒏+𝒓−𝟏 𝑪𝒓


//Lecture 25G

Similar to ordinary generating function, we also have exponential generating function. If we have
sequence S = a0, a1, a2, a3, a4,… then exponential generating function will be,

𝑎0 𝑥 0 𝑎1 𝑥 1 𝑎2 𝑥 2
𝐸𝐺 (𝑥 ) = + + +⋯
0! 1! 2!

//Lecture 26 (playlist)

6.6) Recurrence relations :

Recurrence relations occur when some term in a sequence depends on the previous terms of the
sequence. For example,

Made by Quantum City


goclasses.in

Sequence : arithmetic sequence <3, 8, 13, 18, 23, 28, …> here an+1 = an + 5 and a0 = 3

Initial conditions are required to specify terms that proceed the first term where the relation takes
effect. One thing to note that every recurrence relation (equation) + initial conditions = unique
sequence if we alter any of these things, we will get another unique sequence.

Q : Find a recurrence relation and give initial conditions for the number of bit strings of length n that
do not have two consecutive 0s. How many such bit strings are there of length five ? – Let this RF
(recurrence function) be f(n). Now, we know that if last bit of n string is 1 problem reduce to not
finding out consecutive 0s in n-1 length of string. And if last bit is 0 then two cases are possible either
second last string is 0 or 1. If it is 1 then problem reduce to n-2 string. And if 0 occurs then we do not
accept string. Which means f(n) = f(n-1) + f(n-2). Now, for f(5) we want initial condition. 0

Q : find recurrence relation and give initial conditions for the number of bit string of length n that
have consecutive 0s ? – First, we find initial conditions, f(0) = 0, f(1) -> {0, 1} = 0, f(2) -> {00} = 2. Now,
we know that if last bit is 1 our problem reduce to n-1 and if last bit is 0 then we again have two cases,
(i) second last bit is 1 then we find in n-2, (ii) second last bit is 0 then we have found meaning whatever
n-2 remaining string takes value we don’t care meaning 2n-2. f(n) = f(n-1) + f(n-2) + 2n-2.

Q : How many ways are there to pay a bill of 17 pesos using a currency with coins of values of 1 peso,
2 pesos, 5 pesos, and 10 pesos, and with bills with value of 5 pesos and 10 pesos ? If the order in which
the coins and bills are paid matters. – Let’s represents ways to pay a bill of 17 pesos by P(17).

Q : Find a recurrence relation for the number of bit strings of length n that contain the string 01. – You
first draw diagram and found that f(n) = f(n-1) + f(n-2) + 2n-2.

We saw how our first answer is false. Answer should be f(n) = f(n-1) + 2n-2 + 2n-3 + 2n-4 + … + 21 + 1 ➔
f(n) = f(n-1) + 2n-1 – 1.

Derangement using recurrence relation :

Made by Quantum City


goclasses.in

We fix one element say k and thus for each n-1 remaining position and we check if element in that n-
1 position takes position at index-k or not.

Case 1 : takes the kth position Case 2 : doesn’t take kth position

Here we have taken 1 then we take 2, 3 so on upto n (excluding k) total of n-1 iteration.

𝑫𝒏 = (𝒏 − 𝟏)(𝑫𝒏−𝟏 + 𝑫𝒏−𝟐 )

We can simplify this formula to the following,

𝑫𝒏 − 𝒏𝑫𝒏−𝟏 = (−𝟏)𝒏

Proving bell number using recurrence relation :

Let Bn+1 represents number of ways to partition n+1 elements. Consider a set S = {1, 2, 3, 4,…, n, n+1)
and now consider one set A1 such that it includes (n+1)th element. |A1| = k+1 where 0<=k<=n. i.e. A1
can contains some or all elements which compulsorily including (n+1)th element. If we have chosen
k+1 element from S to form A1 remaining elements are n-k. Number of ways to choose those k
elements (not k+1 because 1 element is surely (n+1)th element) C(n, k) why n because we have already
chosen (n+1) th element. And remaining n-k element can form their own partition in Bn-k ways.

𝒏
𝒏
𝑩𝒏+𝟏 = ∑ ( ) 𝑩𝒌
𝒌
𝒌=𝟎

1.6.1) Limit of recursive sequence :

A fixed point of a function is a point x so that f(x) = x. For recursive sequences this translate as if the
sequence {an} is can be given as an+1 = f(an) and if a is a fixed point for f(x), then if an = a is equal to the
fixed point for some k, the all successive values of an are also equal to a for k > n.
1 3 1 3
For example, let 𝑎𝑛+1 = 𝑎𝑛 + . Fixed points for the recursion thus would satisfy 𝑎 = 𝑎 + , 𝑎 = 1.
4 4 4 4
This we have limiting point. But this will not always be the case : A fixed point is only a candidate for
a limit; a sequence does not have to converge to a given fixed point (unless a 0 is already equal to the
fixed point). The next two recurrence relation illustrate convergence and non-convergence,
respectively.

1) lim 𝑎𝑛 for 𝑎𝑛+1 = √3𝑎𝑛 with 𝑎0 = 2. Converges to value 3.


𝑛→∞

Made by Quantum City


goclasses.in

3
2) lim 𝑎𝑛 for 𝑎𝑛+1 = with 𝑎0 is not equal to a fixed point. This diverges.
𝑛→∞ 𝑎𝑛

This leaves us with the question of how do we know when a recursive sequence is going to converge.
We refer to theorem known as Monotonic sequence Theorem.

Theorem : Every bounded, monotonic sequence converges.

Step 1 : find the fixed point.

Step 2 : check if function is bounded

Step 3 : check for monotonicity by procedure given below :

If by putting value of fixed point into f’(x) results in negative value meaning function is decreasing at
that point and thus converges to that fixed point, next we again take double derivative check if graph
is concave up. If graph is concave up meaning it must lie below line y = x if it does then lower value of
fixed point is convergent value and if f”(x) is negative then function must lie above line means higher
value of fixed point is convergent value. For example,

Source : RecursiveSequences.pdf (uky.edu)


//Lecture 27a

6.7) Pigeonhole Principle :

The pigeonhole principle : If m pigeons occupy n pigeonhole and m > n, then at least one pigeonhole
has two or more pigeons roosting in it.

The best way to solve question which ask for “Guarantee” of even X is to try to prevent event x to
happening.
//Lecture 27B – 020753

Made by Quantum City


goclasses.in

6.7.1) Generalized pigeonhole principle :

The idea is the best way to prevent “too much” in a room… is to uniformly distribute items in all rooms.
Example, if you have 100 people in room then at least how many will have birthday in same month ?
– Here we know that 12 months are there so we first uniformly distribute people in 12 months.

So, if we distribute 12 to those remaining 4 people, we will have 9 or more than 9 people in at least
one month. So, at least 9 people have birthday in same month. Here answer is not 8 because if 8 is
true then at least 7 is also true, at least 6 is also true so there is no point of using at least here. That is
why we take maximum value.
𝑚
Principle : If you distribute m objects into n bins, then some bin will have at least ⌈ ⌉ objects in it, and
𝑛
𝑚
some bin will have at most ⌊ ⌋.
𝑛

//Lecture 27c

Q : Let d be a positive integer. Show that among any group of d + 1 (not necessarily consecutive)
integers there are two with exactly the same remainder when they are divided by d – when randomly
chosen number is divided by d then possible remainder are {0, 1, 2, …, d-1} which are d in total. So if
we add one more number to this d then the remainder of that number always matches with one of
the d total. So, d + 1 number guarantees that at least two integers have same remainder.

Theorem : For any natural number n, there is a nonzero multiple of n whose digits are all 0s and 1s.

For example, 2|10, 3|111, 4|100, 5|100 and so on. Here 10 and all are not binary numbers they are
natural number.

This theorem is consequences of previous question. Let’s prove this theorem for every natural number
separately,

• For any natural number n>= 2 generates the numbers 1, 11, 111, … until n+1 number are
generated.
• There are n possible remainders module n, so two of these number must have the same
remainder.
• So, there difference is a multiple of n.
• And we know their difference consists of just 1s and 0s.

Made by Quantum City


goclasses.in

Silly mistakes :

Made by Quantum City


goclasses.in

7. Graph Theory
//Graph theory lecture 1

7.1) Basic Terminology :

Here graph is different from math function graph. Here graph is → `

Graph is structure consists of nodes and edges connecting those nodes. Leonhard Euler in 1736 laid
the foundations of graph theory.
//Lecture 2a

A graph G = (V, E) consists of two sets V and E. The element of V is called the vertices and the elements
of E the edges of G. Each edge is a pair of vertices. For instance, the sets V = {1, 2, 3, 4, 5, 6} and E =
{{1, 2}, {2, 3}, …{4, 6}} but why {1, 2} and not (1, 2) because (1, 2) implies order pair but edge is
unordered pairs of vertices in undirected graph.

Number of edges are sometimes called size of graph and number of vertices are also known as order
of graph.

7.1.1) Types of edges :

Undirected edge : It simply means it has no direction.

Directed edge : it means it has direction.

Self-loop : edges whose both end points are same.

Multi-edges/ Parallel edges : Exactly same edges.

7.1.2) Types of graph : based on types of edges

Undirected graph : every edge should be undirected.

Made by Quantum City


goclasses.in

Directed graph : Every edge should be directed.

Multigraph : it should be undirected graph with no self-loops.

Pseudograph : Any undirected graph. Meaning multi-edges and self-loops are also allowed.

Directed Multigraph : It should be directed with multi-edges and self-loops are also allowed.

Simple graph : It should be undirected with no self-loops and no multi-edges.


//Lecture 2b

7.1.3) Adjacency, degree of a vertex :

All adjacency and degree of a vertex concepts are only defined for undirected graph.

If {a, b} ∈ E then we say a, b is adjacent nodes/neighbors’ nodes. If self-loop is present on some vertex
then that vertex is neighbor of itself. Similarly, we have adjacent edges, two edges are adjacent iff
they both shares some common end points.

1) Degree of a vertex : The degree of a vertex in an undirected graph is the number of edges
incident with it, except that a loop at a vertex contributes twice to the degree of that vertex
(but self-loop only happens in pseudograph). The degree of the vertex v is denoted by deg(v).

A vertex of degree zero is called isolated. Vertex g in graph is isolated. A vertex is pendant if and only
if it has degree one. Vertex d in graph is pendant.
//Lecture 2c

We can also have some terms such as min-deg(G), max-deg(G), Total-deg(G) representing min degree
in graph G, max degree in graph G and total summation of all degrees respectively. Avg-deg(G) = Total-
deg(G) / no. of vertices.

Degree sequence of graph : the degree sequence of a graph of order n is the n-term sequence (usually
written in descending order) of the vertex degrees.
//Lecture 3A

2) Handshaking theorem : Total degree = 2 * |E|. This is fact from below observation

You may have noticed that in undirected graph inserting one edge will increase total degree by two.

Q : How many edges are there in a graph with 10 vertices each of degree six ? - every vertex has 6
degree meaning total degree is 10*6 = 60 and by handshaking theorem, 60 = 2 * |E| → |E| = 30.

Q : Can you create odd number of odd-deg vertices ? – We know that Total degree of even-degree
vertices + total degree of odd-degree vertices = total degree = 2 * |E| which means it should be even.
Now, Total degree of even-degree vertices => is always even as it is summation of even term(degree)
so, even + x = even. Here x is total degree of odd -degree vertices. Which means x should be even. It

Made by Quantum City


goclasses.in

means total degree of odd-degree vertices are even. So, we cannot have odd number of odd-degree
vertices in graph.

An undirected graph has an even number of vertices of odd degree

We know that for undirected graph, ∑∀𝑣∈𝑉 deg (𝑣) = 2 × |𝐸| and there are n vertices then n*avg.
degree = 2*|E|. This is true because suppose, a + b + c = t. now if you replace a, b, c by (a+b+c)/3 then
result would remain same.
//Lecture 3B

3) Handshaking theorem for directed graphs :

In directed graph we have concept of in-degree and out-degree as edges are directed.

Indegree : denoted by deg–(v), is the number of edges with v as their terminated vertex.

Outdegree : denoted by deg+(v), is the number of edges with v as their initial vertex.

Note that a loop at a vertex contributes 1 to both the indegree and the out-degree of this vertex.

It means for every edge we have one indegree and one outdegree. It also means that if we add one
edge to any graph its indegree and out degree will increase by 1.

∑ deg − (𝑣) = ∑ deg + (𝑣) = |𝐸|


𝑣∈𝑉 𝑣∈𝑉

//Lecture 4A

7.1.4) Walk, Trail, path, cycle and circuits :

Walk : A walk in a graph is a sequence of alternating vertices and edges v1e1v2e2…vnenvn+1 with n>=0.
If v1 = vn+1 then the walk is closed. The length of the walk is the number of edges in the walk. A walk if
length zero is a trivial walk. Repetition of edges and vertices is allowed in walk.

Trail : It is a walk where repetition of edges is not allowed. We also have closed trail which also known
as circuits. Trivial circuit has a single vertex and no edges.

Path : It is a walk, in which repetition of edges and vertices are not allowed. Here we can omit saying
repetition of edge because

No vertex repetitions → no edge repetition, because there always exists one edge between two
vertices in simple graph so if in sequence if vertices is not repeating then it means edges are also not
repeating.

Cycle : It is a sequence of alternating distinct vertices (except first and last vertices) and distinct edges
v1e1v2e2…vnenvn+1 with n => 3 and v1 = vn+1. We can say it is non-trivial circuits in which the only repeated
vertex is the first/last one. Note that cycle only exists in graph when no. of distinct vertices are at least
3. Note that cycle is not path and path is not cycle.

Made by Quantum City


goclasses.in

Let’s summarize all things in table,

Repeated vertex Repeated edge open closed Name


Walk(open)
Walk (closed)
Trail
Circuit
Path
(only first/last)) Cycle
//Lecture 4B

Q : In a graph, if there is a walk from v to w then there is a path from v to w. – This can be obtained
by deleting loops.

//Lecture 4C

1) Connected graph : A graph G is connected iff there is path between every two vertices.
2) Distance and diameter :

Length of path : number of edges in the path. Distance between two vertices is the length of shortest
path between a, b. Diameter is the longest shortest distance between two vertices. For example,
diameter of Indian is 3214km, it means no distance between two points can exceeds diameter.

Diameter in disconnected graph : ∞


//Lecture 5A

7.1.5) Special type of graphs :

1) Regular graph : Every vertex has same degree. A more generalized k-regular graph in which
every vertex has k degree. For example,

Made by Quantum City


goclasses.in

2) Complete graph : A complete graph on n vertices, denoted by Kn, is a simple graph that
𝑛(𝑛−1)
contains exactly one edge between each pair of distinct vertices. Has edges.
2
3) Empty/ Null/ Edgeless graph : Graph without edges. Denoted by En.

Similarly, we cannot classify graph with no vertices. Every graph should contain at least one vertex.

4) Path graph : Denoted by Pn, it is a straight-line graph with n vertices.

//Lecture 5B

5) Cycle graph : Denoted by Cn, for n>=3. Every vertex has degree 2 meaning its 2-regular.

6) Wheel graph : If create edges from all vertices and join them then we will have wheel graph.

7) Star Graph : A special type of graph in which n-1 vertices have degree 1 and a single vertex
have degree n – 1. Start graph of order n denoted by Sn

8) Hypercube graph : Denoted by Qn, where (u, v) ∈ E iff hamming distance of (u, v) = 1.

It is also called n-cube graph or n-dimensional graph. As you may have noticed…

9) Nullity of graph (N) : Nullity of graph is the number of closed region so r = e – v + 2 here
closed region is rc = e – v + 1 and ro = 1. So, by adding we get r = rc + ro. So, nullity can be
calculated by rc = e – v + 1.
10) Line graph :

The line graph L(G) of a simple graph G is defined as follows :

Made by Quantum City


goclasses.in

There is exactly one vertex v(e) in L(G) for each edge e in G.

For any two edges e and e’ in G, L(G) has an edge between v(e) and v(e’), if and only if e and e’ are
incident with the same vertex in G.

Conversion of graph to line graph.

In line graph, number of vertices = numver of edges in G and number of edges = sum of square of
degree of vertices in G divided by 2 minus number of edges in G.

//Lecture 7

7.2) More graph terminology :

If you delete on edge from a graph only that edge will be deleted. But if you delete a vertex from a
graph then all edges incident on that vertex is also gets deleted.

7.2.1) Subgraph :

Graph G

Definition :

Given two graphs 𝐺1 = (𝑉1 , 𝐸1 ) and 𝐺2 = (𝑉2 , 𝐸3 ), the graph 𝐺1 is said to be

• A subgraph of 𝐺2 = (𝑉2 , 𝐸2 ) if 𝑉1 ⊆ 𝑉2 and 𝐸1 ⊆ 𝐸2 , i.e. 𝐺1 can be obtained from 𝐺2 by


deleting some vertices and some edges;
• A spanning subgraph of 𝐺2 if 𝑉1 = 𝑉2 and 𝐸1 ⊆ 𝐸2 . i.e. 𝐺1 can be obtained from 𝐺2 by deleting
some edges but not vertices;
• An induced subgraph of 𝐺2 if 𝐺1 is a subgraph of 𝐺2 and every edge of 𝐺2 with both endpoints
in 𝑉1 is also an edge of 𝐺1 , i.e. 𝐺1 can be obtained from 𝐺2 by adding some vertices but not
edges. Meaning it is opposite of spanning subgraph in which vertex deletion is not allowed
and here in induced subgraph edge deletion is not allowed. We say 𝐺1 is induced by 𝐺2 .
//Lecture 7

The union of two simple graphs 𝐺1 = (𝑉1 , 𝐸1 ) and 𝐺2 = (𝑉2 , 𝐸2 ) is the simple graph with vertex set
𝑉1 ∪ 𝑉2 and edges set 𝐸1 ∪ 𝐸2 . The union of 𝐺1 and 𝐺2 is denoted by 𝐺1 ∪ 𝐺2 .

//Lecture 8a

7.2.2) Graph Isomorphism :

Graph having abstractly same structure.

Made by Quantum City


goclasses.in

Two graphs 𝐺1 = (𝑉1 , 𝐸1 ) and 𝐺2 = (𝑉2 , 𝐸2 ) are isomorphic iff there exists a bijection between 𝑉1 , 𝑉2
which preserves edges.

Showing “two graphs are isomorphic” is NP hard problem. But showing “Not isomorphic” can be done
using “Graph Invariant”. Graph invariants are properties which should be same in isomorphic graph.

Graph invariants includes :

There can be many such properties of graph which two graphs must follow in order to have
isomorphism. But what if all these 6 properties are satisfy by two graphs then can we say they are
isomorphic ? – No. because there can be other property (unknown) for which graph should not be
equal that is why it is hard to prove that two graphs are isomorphic but it is easy prove whether two
graphs are non-isomorphic.

Here all number of vertices are same, edges are same, degree sequence is same, diameter is same.
But 4-length cycles are not same (in first 2 cycles, in second 3 cycles).

//Lecture 8d

7.2.3) Complement and self-complementary graph :

We know that every graph on n-vertices is a subgraph of Kn (complete graph). Because Kn work as
universal set graph. If G(V,E) then it’s complement will be G’(V, E’). Where E’ = Edges in Kn – E. we can
also say that |E’| = n(n-1)/2 - |E|.

Self-complementary graph : A graph is self-complementary iff graph and its complement is


isomorphic. Example,

One interesting fact that every path graph is self-complementary.


//Lecture 9A

Made by Quantum City


goclasses.in

1) Connected components :

Component means it is a maximal connected graph. Why not maximum ?

Here you can see maximum connected graph is G({a, b, c, d}, E)

And maximal connected graph is a set of connected components of graph.

Here graph made by a, b, c, d is one component. Similarly, here e is not component rather it is a part
of component.

When we say vertices are connected it means there is a path from one vertex to another.

An undirected graph is connected if there is path between every pair of distinct vertices. A
connected component of a graph G is a connected subgraph of G that is not contained in any other
connected subgraph of G. (that is maximal connected subgraph)

We can say if there is relation R on V such that a R b iff there exists a path between a and b. Then
relation is equivalence and number of equivalence class = number of connected components.
//Lecture 9B

2) Complement of disconnected graph : we know that the complement of connected graph may
be connected or disconnected. But complement of disconnected graph implies what ?

Let’s take two vertices from G (a disconnected graph) say a, b two things can happen :

Case 1 : a, b are not adjacent means they either belong to different components or connected through
some sequence of graph means they are indirectly connected. So, its complement will be G’ such that
a and b are connected.

Case 2 : a, b are adjacent means they belongs to same component. In complement G’ they must be
connected.

Complement of disconnected graph will always be connected


//Lecture 10A

7.2.4) Bipartite graphs :

Bipartite graph is a graph in which you can always make partition of vertices of size 2 such that no two
vertices of same partition have direct edge. For example,

More formally, graph G(V, E) is bipartite iff ∃a bipartition X, Y of V such that

• 𝑋∩𝑌 =∅
• ∀𝑎,𝑏∈𝑋 (𝑎, 𝑏) ∉ 𝐸(𝐺)
∀𝑎,𝑏∈𝑌 (𝑎, 𝑏) ∉ 𝐸(𝐺)
• 𝑋∪𝑌 =𝑉
• 𝑿, 𝒀 can be empty

Theorem : A graph is bipartite if and only if it doesn’t have an odd cycle.

Made by Quantum City


goclasses.in

We will not see proof but little idea is enough,

This theorem also means

If we have odd cycle then graph is not bipartite.

Lemma. If G is a bipartite graph and the bipartition of G is X and Y, then ∑𝑣∈𝑋 𝑑𝑒𝑔 (𝑣) = ∑𝑣∈𝑦 𝑑𝑒𝑔 (𝑣).

Because every edge leaving one partition goes to other partition. So, edge distribution is same.
//Lecture 10B

Complete bipartite graph : denoted by km,n

As the name indicate it should be bipartite with all possible edges maintaining bipartite property.

For every complete bipartite graph,

|V| = m + n, |E| = mn, degree sequence : n, n, n,…, m times , m, m, m, …, n times

Every hypercube graph is bipartite graph

Because we can always divide hypercube graph into even parity and odd parity (parity means no. of
1’s) vertices. Meaning no two vertices of same parity is connected.
//Lecture 10c

You may have observed one pattern that when the size of both partitions is nearly same, we get
𝑛2
maximum edges. We can say that if a graph on n vertices has edges greater than ⌊ ⌋ then it cannot
4
be bipartite.
//Lecture 11A

7.2.5) Cyclic and Acyclic graph :

There is a difference between cycle graph and cyclic graph. Cycle graph means all vertices should form
one cycle while cyclic graph is a graph containing at least one cycle.

Conversely, a graph with no cycle in it is known as acyclic graph.

Definition 2 : there are at least two vertices which have more than one path between them.

Definition 3 : There is some vertex where we can start off, follow a non-empty trail, and come back to
the original vertex without repeating edges.

Opposite to this is acyclic graph which is also called forest when it is not necessarily connected. If
acyclic graph is connected then it is called tree. Components of forest is tree.

1) Tree : it is an undirected, acyclic, connected graph.


//Lecture 11C

Number of edges in tree having n vertices is n – 1. Because at start we were having only one vertex
and if we add one vertex to this tree, we have to join this vertex through edge. Again, we repeat the

Made by Quantum City


goclasses.in

same procedure. After one vertex we will have equal number of vertex and edges. No. edges will be e
+ 1 = n ➔ n – 1 edges.

Different definitions of tree :

• T is tree.
• Any two vertices on T are connected by a unique path.
• T is minimally connected, i.e. T is connected but T – e is disconnected for any edge e of T.
• T is maximally acyclic, i.e. T is acyclic but T + uv contains a cycle for any two non-adjacent
vertices u, v of T.
• T is connected and |E(T)|=|V(T)|- 1.
• T is acyclic and |E(T)|=|V(T)|- 1.
//Lecture 11E

Q : If G has no cycle but by adding one edge between any two vertices will create a cycle then G is tree
? – Counterexample,

//Lecture 12A

2) Rooted tree : it is a special type of DAGs (directed acyclic graph)

It is a directed acyclic graph with one property that from root to every other node we will have unique
path. For example,

So, n-ary tree learned in DS is nothing but this rooted tree only but we omit arrow by giving each node
level. Therefore, all the terminology remains the same as taught in DS related to rooted tree.

Height of a node in rooted tree : is the number of edges encountered from x to the farthest leaf.

Depth of a node in rooted tree : is the number of edges encountered from root to x.

Made by Quantum City


goclasses.in

//Lecture 12B

In directed graph we have concept of +ve and -ve degree and rooted tree is also directed graph but it
is a special kind of graph which heavily used in many fields so degree in rooted has different analogy.

The degree of a node is the number of its children and the degree of a tree is the maximum degree
of any of its nodes.

3) Binary tree : is a rooted binary tree in which every vertex has at most two children.

In binary tree, no. of leaf = (nodes with degree 2 node) + 1.

Proof. We know that Binary tree → rooted tree → directed graph → total indeg = total outdeg = |E|

And |E| = n – 1. Now,

Suppose, L represents no. of leaves, D’ represents no. of nodes with degree 1, D’’ represents no. of
nodes with degree 2.

Total out degree = 𝐿 × 0 + 𝐷′ × 1 + 𝐷′′ × 2 = 𝐷′ + 2𝐷′′ = 𝑛 − 1 but 𝑛 = 𝐿 + 𝐷′ + 𝐷′′ on solving


we get 𝐿 = 𝐷′′ + 1. QED

Full binary tree : is a binary tree with every node either have 0 or 2 children.

In full binary tree we do not have degree 1 node. Therefore, n = L + D’’ ➔ n = 2L – 1 using D’’ = L – 1
//Lecture 13A

Q : What will be number of maximum and min edges in disconnected graph ? – If we want max |E|
then no. of component will be as min as possible. We have two option

For min |E|, all component will contain only one vertex in that case edges will be 0.

Q : The maximum number of possible edges in an undirected graph with n vertices and k components
is – This can be achieved by distributing k-1 vertices from n and remaining n-k+1 vertices in one
component. As maximum edges are asked so total C(n-k+1,2) are possible.

𝒏 − 𝒌 < 𝒏𝒐. 𝒆𝒅𝒈𝒆𝒔 < 𝑪(𝒏 − 𝒌 + 𝟏, 𝟐)

Q : Let G be an arbitrary graph with n nodes and k components. If a vertex is removed from G, the
number of components in the resultant graph must necessarily lie down between ? – Here we want
limit, so minimum number of components will be when (k-1) components will have 1 node and 1
component have n-k+1 nodes and forming complete graph with those nodes. If we remove one of the
(k-1) components then we will end up with k – 1 component.

For, maximum number of components we distribute (k-1) nodes per components and from n-k+1
nodes we will form

Made by Quantum City


goclasses.in

Counting no. of n-length cycle :

Total no. n-length cycle = traceof(An) but we are overcounting some cycle. For example, we are
counting same cycle in clockwise and anticlockwise direction. And we divide by 2n (why?)

𝒕𝒓𝒂𝒄𝒆𝒐𝒇(𝑨𝒏 )
Total no. n-length cycle =
𝟐𝒏

//Lecture 14A

7.3) Connectivity and Coloring :

To properly understand connectivity, we first have to explore few mis-conceptual terms…

Maximal Vs Maximum : A set is maximal with respect to some property P if nothing new can be added
to S keeping the property P preserve. For example, Let’s say we have set S = {1, 2, 3, 4, 5} and we have
property P : “No two elements consecutive”.

{1, 2} {1, 3}

{2, 4} {1, 3, 5}

{2, 4} and {1, 3, 5} are possible maximal set which satisfy P but {1, 3, 5} is the maximum set.

Maximal means no new addition is possible and maximum is the maximum amongst maximal.

7.3.1) Clique, Independent set :

Clique : In a graph, a set of pairwise adjacent vertices is called a clique.

Independent set : A set of pairwise non-adjacent vertices is called an independent set.

For example,

Made by Quantum City


goclasses.in

The size of a maximum clique in G is called the clique number of G and is denoted by 𝜔(𝐺). We can
say it is also equal to size of maximum complete subgraph formed in G.

The size of a maximum independent set in G is called the independent number (also known as stability
number) of g and is denoted by 𝛼(𝐺).

For example, for cycle graph Cn : Clique number 𝜔(𝐶𝑛 ) = 2 as at max only two vertices are adjacent.
𝑛
And Stability or independent number 𝛼(𝐶𝑛 ) = ⌊ ⌋ as for 5 we have 2 and 6 we have 3.
2

For hypercube graph, clique number 𝜔(𝑄𝑛 ) = 2 (from observation) and stability number 𝛼(𝑄𝑛 ) =
2𝑛−1 . Because there are total 2n vertices in 𝑄𝑛 graph and as hypercube graph is bipartite, we can
always have partition each partition contains 2𝑛−1 vertices (even and odd parity).

But why we are learning this clique number and independent number together. Because

S is maximum ind. Set in G ↔ S is maximum clique in G’

//Lecture 15A

7.3.2) Vertex cover, edge cover :

Vertex cover : set of Vertices which covers all edges.

Edge cover : Edges covering all vertices.

Now, interesting problem to ask is minimum vertex cover and edge cover.

Consider a graph with one isolated vertex then edge cover will be “does not exists” because there are
no edges which covers isolated vertex. So, edge cover exists iff no isolated vertex. We can say that
Edge cover exists iff 𝜹 > 𝟎 (𝜹 means minimum degree of a node in graph)

Size of minimum vertex cover is called vertex covering number (𝛽) and size of minimum edge cover is
called edge covering number (𝛽′).

Q : The maximum degree vertex must be in minimum VC ? – Answer is no, here’s the counter,

//Lecture 15B

Made by Quantum City


goclasses.in

𝒏
Minimum edge cover in any graph is at least ⌈ ⌉ because one edge covers 2 vertices at max so to
𝟐
cover n vertices, we should have at least n/2 edges in edge cover.

For example, for Pn graph,

Relation between vertex cover and independent set :

Let graph 𝑮(𝑽, 𝑬) have vertex cover S then (V – S) is independent set

Above statement is true because in independent set, we have those vertices which are in between
two vertices so edges connected with them is counted in vertices in S And by that logic we can also
say that

Let graph 𝑮(𝑽, 𝑬) have independent set I then (V – I) is vertex cover

𝜶+𝜷=𝒏

//Lecture 16A

7.3.3) Matching :

Matching == edge independent set

Edge independent set means no two edge should have common vertex we call non-adjacent edges.

Definition : A set of pairwise non-adjacent edges in a graph is called a matching. The maximum number
of edges in a matching in a graph G is called the matching number of G and denoted by 𝜇(𝐺) or 𝛼′(𝐺).

Perfect matching : Matching which covers all vertices.

Made by Quantum City


goclasses.in

You can see that any matching covers even number of vertices because every edge consists of two
vertices.

NOTE : With complete graph with 2n vertices have (2n-1)!! Perfect matching.
𝑛
Q : for every graph, 𝜇(𝐺 ) ≤ ⌊ ⌋ ? – True because every edge in matching consists of two vertices. At
2
max we can connect all pairs of vertices by edge (considering only non-adjacent edges as definition
says).
//Lecture 16B

Relationship between matching and vertex cover :

|𝑚𝑎𝑡𝑐ℎ𝑖𝑛𝑔| ≤ |𝑉𝑒𝑟𝑡𝑒𝑥 𝐶𝑜𝑣𝑒𝑟|

Meaning the cardinality of any matching is less than or equal to the cardinality of any vertex cover.

Proof. Take any matching with size k.

As you can see to cover e1 edge any vertices from a1 and b1 should be there in vertex cover. And
similarly, for other we can say that at least we want k vertices in vertex cover to cover all edges. QED

NOTE :

1) If S is maximum matching then every edge of the graph is incident on some vertex covered
by S. This means vertices covered by S will cover all edges (why ?) which is the definition of
vertex cover so vertices in S (maximum matching) is actually a vertex cover (it can be
minimum or maximum vertex cover we don’t know). Therefore, |Vertex Cover| = 2|𝝁|.
Now, if vertex cover is minimum then 𝜷(𝑮) ≤ 𝟐𝝁(𝑮). QED

So, we can say that for every graph 𝜇 ≤ 𝛽 ≤ 2𝜇 (here second 𝜇 is maximum matching)

We have seen that 𝛼 + 𝛽 = 𝑛 similarly, 𝜶′ + 𝜷′ = 𝒏

Summery,

𝛼+𝛽 =𝑛 𝛼′ + 𝛽′ = 𝑛 𝛽 ′ ≥ ⌈𝑛/2⌉

𝜇 ≤ 𝛽 ≤ 2𝜇 𝛼 = 𝜇 ≤ ⌊𝑛/2⌋ 𝛼 ≤ 𝛽′
Bipartite → (𝜇 = 𝛽)
//Lecture 17A

7.3.4) Graph coloring :

1) Vertex coloring :

Graph coloring == vertex coloring.

Made by Quantum City


goclasses.in

A graph coloring is an assignment of labels, called colors, to the vertices of a graph such that no two
adjacent vertices share the same color.

Proper coloring : every pair of adjacent vertices must get different color/label.

K – colorable : Using at most k colors, we can color.

For example,

Minimum number of colors needed is 2  this is called chromatic number denoted by 𝝌(𝐺 ) = 2.

//Lecture 17B

Greedy algorithm for vertex coloring : It does not always succeed in finding the minimum.

Let N = {1, 2, 3, ..} denote the set of all possible colors. Then greedy strategy will be

𝒄𝒐𝒍𝒐𝒓(𝑽𝒊 ) = 𝐦𝐢𝐧 {𝒋 ∈ 𝑵: 𝑵𝒐 𝒏𝒆𝒊𝒈𝒉𝒃𝒐𝒖𝒓 𝒐𝒇 𝑽𝒊 𝒊𝒔 𝒄𝒐𝒍𝒐𝒓𝒆𝒅 𝒋}


Note that if maximum degree of graph i.e. ∆(𝐺 ) = 𝑑 then 𝜒(𝐺 ) ≤ 𝑑 + 1.

Example, Cn with n = odd. Here d = 2 and 𝜒(𝐶𝑜𝑑𝑑 ) = 3 clearly following above equation. And second
example would be kn where d = n – 1 and 𝜒(𝑘𝑛 ) = 𝑛. And third example is ? Nothing ! because these
are only two graphs that satisfy 𝜒(𝐺 ) = 𝑑 + 1.

This is called brooks’ theorem, it says “all connected graph have 𝜒(𝐺 ) ≤ ∆(𝐺), except for 𝑘𝑛 and odd
cycles.”

Made by Quantum City


goclasses.in

Intuition behind above formula : If we can color a graph using k colors then it means every set of k
vertices are dependent (or adjacent) to each other so total size of independent set will be at least n/k.

∆(𝑮) + 𝟏 ≥ 𝝌(𝑮) ≥ 𝝎(𝑮)


//Lecture 17E

2) Edge coloring :

No two adjacent vertices share same color. It is denoted by 𝜒′(𝐺). It is the smallest edge coloring
possible also known as edge chromatic number or chromatic index.

We can definitely say that 𝜒 ′ (𝐺 ) ≥ ∆(𝐺).

Vizing’s theorem for edge coloring : it says 𝜒 ′ (𝐺 ) = ∆ 𝑜𝑟 ∆ + 1

Konig’s edge coloring theorem : for any bipartite graph, 𝜒 ′ (𝐺 ) = ∆(𝐺 )


//Lecture 18

7.3.5) Graph realization problem :

Graph realization problem means we look at the list of degrees to get some information on the graph.
We also look at what list of nonnegative integers can be the degree sequence of some graph.

For example, given degree sequence for some graph : 4, 3, 2, 2 can this be complete ? – answer is no
because every complete graph has vertex degree = n – 1. Where n is no. of vertices.

For pseudo-graph, the nonnegative integers are the degree sequence of some graph if and only if their
sum is even. This is true because one edge contributes 2 to degree.

Graphic sequence : is a list of nonnegative integers that is the degree sequence of some simple graph.
A simple graph with degree sequence d realizes d.

Havel Hakimi theorem : The nonincreasing sequence of nonnegative integers d1, d2, …, dn can be
realized by simple graph, if and only if d1 ≤ n – 1 and the sequence

𝑑2 − 1, 𝑑3 − 1, … , 𝑑𝑑1 +1 − 1, 𝑑𝑑1 +2 , 𝑑𝑑1 +3 , … , 𝑑𝑛

Can be realized by simple graph (after reordering the sequence in nonincreasing order).

example,

Made by Quantum City


goclasses.in

For tree we can have condition for graph realization, for n ≥ 2, the nonincreasing sequence 𝒅𝟏 , … , 𝒅𝒏
of nonnegative integers can be realized by tree if and only if ∑𝒏𝒊=𝟏 𝒅𝒊 = 𝟐(𝒏 − 𝟏) holds and 𝒅𝒊 > 𝟎
for all i.

//Lecture 19A

7.4) More on connectivity :

7.4.1) Cut vertex, cut edge :

Cut vertex = articulation point = removal of vertex creates more components of graph.

Cut edge = bridge = Removal of edge creates more components of graph.

In any graph there are two types of edge : 1) cycle edges : part of some cycle, 2) Non-cycle edges : not
part of any cycle.

All non-cycle edges are cut edges or bridges

Let G be a graph containing a bridge e incident with vertex v then vertex v is cut vertex if and only
if deg v >= 2.
//Lecture 19B

7.4.2) Connectivity number, vertex cut, edge cut :

Previously we saw that cut vertex is the vertex whose removal increases the number of components.
But vertex cut is a set of vertices whose removal increases the number of components.

Similarly, edge cut is a set whose removal increases the number of components.

But there is slight difference that vertex cut and edge cut only define for connected graph unlike cut
vertex and bridge which is defined for all graph (connected and disconnected).

So, here we can say that Vertex cut is a set of vertices whose removal disconnects the graph. And
similarly, for edge cut.

But we are not interested in vertex cut, we are interested in smallest vertex cut. Denoted by 𝜅(𝐺 )

This number expresses how difficult it is to disconnect the graph by removing vertex.

Therefore, we modify our definition : In a connected graph, a vertex cut is a subset of vertices whose
removal either disconnects graph OR single vertex remains.

For disconnected graph 𝜅 (𝐺 ) = 0.

Made by Quantum City


goclasses.in

k-connected graph : 𝜅(𝐺 ) ≥ 𝑘 here k is variable. OR removal of any ≤ k – 1 vertices doesn’t disconnect
the graph or leaves a single vertex.
//lecture 20A

7.4.3) Strongly and weakly connected components :

A directed graph G = (V, E) is singly connected if 𝑢 → 𝑣 implies that G contains at most one simple
path from u to v from all vertices 𝑢, 𝑣 ∈ 𝑉.

We saw concept of components for undirected graph but for directed graph we have strongly and
weakly connected components concept.

Q : is this graph connected ? -

But for directed we do not use connected terminology we say it is not strongly connected.

Strongly connected : In a directed graph G = (V, E), two nodes u and v are strongly connected if and
only if there is a path from u to v and a path from v to u. (below is wrongly marked just to test)

In directed graph G(V, E) relation R on V, aRb iff a, b are (strongly) connected is equivalence relation

Every equivalence class of “Strongly connected relation R” is called strongly connected component
//Lecture 20B

A directed graph is weakly connected if there is a path between every two vertices in the underlying
undirected graph, which is the undirected graph S obtained by ignoring the directions of the edges of
the directed graph.

That means every strongly connected graph is weakly connected graph.


//Lecture 20C

Associated DAG : In directed graph G(V, E), if we shrink each of these strongly connected components
down to a single node, and draw an edge between two of them if there is an edge from some node in
the first to some node in the second, we call this new graph as associated directed acyclic graph i.e.
Associated DAG.

//Lecture 21A

Made by Quantum City


goclasses.in

7.5) Euler and Hamiltonian graph :

A few centuries ago, people were trying to solve a problem that today is called the seven bridges of
Konigsberg. Inspired by a real place and situation :

Problem statement : Is it possible to start at some location in the town, travel across all the bridges
once without crossing any bridge twice, and return to the starting point.

Later Euler solved this problem.

7.5.1) Euler path and circuit :

Definition : A Euler circuit in a graph G is a simple circuit containing every edge of G. A Euler path in
G is a simple path containing every edge of G.

Euler graph : A connected graph with Euler circuit. Which means A connected graph is Euler graph if
and only if Euler circuit exists.

We know that cycle and circuits is not same but Euler circuit = Euler cycle.

Q : Which graph is Eulerian ? – Connected graph with even degree vertices.

Proof. first note that an Euler circuit begins with a vertex a and continues with an edge incident with
a, say {a, b}. The edge {a, b} contributes one to deg(a). Each time the circuit passes through a vertex it
contributes two to the vertex’s degree, because the circuit enters via an edge incident with this vertex
and leaves via another such edge. Finally, the circuit terminates where it started, contributing one to
deg(a). Therefore, deg(a) must be even, because the circuit contributes one when it begins, one when
it ends, and two every time it passes through a (if it ever does).

A vertex other than a has even degree because the circuit contributes two to its degree each
time it passes through the vertex. We conclude that if a connected graph has an Euler circuit, then
every vertex must have even degree.

Made by Quantum City


goclasses.in

Euler path : An open trail which goes through every edge exactly once.

Euler Circuit Euler Path


Closed trail Open trail

But both should cover Every edge exactly once

Theorem : A connected multigraph has an Euler path but not an Euler circuit if and only if it has exactly
two vertices of odd degree.

Proof. First, suppose that a connected multigraph does have an Euler path from a to b, but not an
Euler circuit. The first edge of the path contributes one to the degree of a. A contribution of two to
the degree of a is made every time the path passes through a. The last edge in the path contributes
one to the degree of b. Every time the path goes through b there is a contribution of two to its degree.

Consequently, both a and b have odd degree. Every other vertex has even degree, because
the path contributes two to the degree of a vertex whenever it passes through it.

Back to Euler graph,

In the undirected case, we wanted an even degree at each node so that we could leave any node we
enter. So, with the same logic in directed case, we accomplish this by requiring each node’s indegree
to equal its outdegree.

Theorem : A directed graph G is Eulerian if and only if it is strongly connected and every node’s
indegree equals its outdegree.

Talking about Euler path in directed. So, we don’t need strongly connected condition here because

But one thing you may have noticed that one vertex has indegree = outdegree + 1 and other have
indegree = outdegree – 1 and rest all other vertices have indegree = outdegree.

Thus, we say A directed graph has Eulerian path if and only if it is weakly connected and one vertex
should have indegree = outdegree – 1; one vertex should have indegree = outdegree + 1 and rest all
the vertices must have indegree = outdegree.

Made by Quantum City


goclasses.in

//Lecture 21B

7.5.2) Hamiltonian Graph :

Euler cycle === visit every edge exactly once

Hamiltonian cycle === visit every vertex exactly once

Hamiltonian graph : G is HG if and only if there exists Hamiltonian cycle (cycle which covers every
vertex exactly once).

Similarly, Hamiltonian path is path made by visiting every vertex exactly once and starting ≠ ending.

For connected graph, Euler Circuit/ Euler Cycle Hamiltonian Cycle/circuit


Can vertex repeat
Can edge repeat
If vertex does not repeat then edge cannot repeat.

For connected graph, Euler circuit/ Euler cycle Hamiltonian cycle/Circuit


Can a vertex remain untouched
Can an edge remain untouched
Similar to Euler circuit is same as Euler cycle, Hamiltonian cycle is same as Hamiltonian circuit.

But only circuit is not same as cycle.

Sadly, there is no efficient method to determine Hamiltonian cycle unlike Euler cycle.

Stupid facts which are true :

• If Hamiltonian cycle exists then Hamiltonian path exists but inverse is not true.
• If Euler circuit exists then Euler path cannot exist because for Euler path to exists G (|V|>2)
must have 2 odd deg. Vertices.

Dirac theorem : If min degree of any vertices in any simple connected undirected graph is greater than
or equal to n/2 then Hamiltonian cycle exists provided |V|>=3.
//from Kenath Rozen

7.6) Planar graphs :

In this section we will study the question of whether a graph can be drawn in the plane without edges
crossing. In particular, we will answer the houses-and-utilities problem.

Is it possible to join these houses and utilities so that none of the connections cross?

Made by Quantum City


goclasses.in

Definition : A graph is called planar if it can be drawn in the plane without any edges crossing (where
a crossing of edges is the intersection of the lines or arcs representing them at a point other than their
common endpoint). Such a drawing is called a planar representation of the graph.

Q : is K3, 3 is planar graph ? – No, you can flip the V1, V4 to reduce the cross edges and then you can
flip v3 and v6 but that will cause previous cross edges.

7.6.1) Euler formula :

A planar representation of a graph splits the plane into regions, including an unbounded region. For
instance, the planar representation of the graph shown in Figure splits the plane into six regions.

Statement : Let G be a connected planar simple graph with e edges and v vertices. Let r be the number
of regions in a planar representation of G. Then r = e − v + 2.

You can easily prove this result using induction.

Degree of a region, which is defined to be the number of edges on the boundary of this region. When
an edge occurs twice on the boundary (so that it is traced out twice when the boundary is traced out),
it contributes two to the degree. We denote the degree of a region R by deg(R).

Corollary 1 : If G is a connected planar simple graph with e edges and v vertices, where v ≥ 3, then e ≤
3v − 6.

Made by Quantum City


goclasses.in

Proof. One thing to note that the degree of each region is at least three (for a graph with vertices at
least 3).

∴ 𝟐𝒆 = ∑𝒂𝒍𝒍 𝒓𝒆𝒈𝒊𝒐𝒏𝒔 𝑹 𝐝𝐞𝐠 (𝑹) ≥ 𝟑𝒓… why 3r because 3x1 + 3x1 + … r times
2
Hence, ( ) 𝑒 ≥ 𝑟 and now using Euler’s formula, we obtain
3

2
𝑒 − 𝑣 + 2 ≤ ( ) 𝑒 ⇒ 𝑒 ≤ 3𝑣 − 6.
3

Corollary 2 : If G is a connected planar simple graph, then G has a vertex of degree not exceeding five.

Proof. If G has one or two vertices, the result is true. If G has at least three vertices from above
corollary we know that 𝑒 ≤ 3𝑣 − 6. Now, what if the degree of every vertex were at least six, then
because 2𝑒 will be sum of all deg(v), we would have 2𝑒 ≥ 6𝑣. But this contradicts 𝑒 ≤ 3𝑣 − 6. It
follows that there must be a vertex with degree no greater than five.

Example, K5 is nonplanar using corollary 1 because the graph of K5 has five vertices and 10 edges.
However, the inequality 𝑒 ≤ 3𝑣 − 6 is not satisfied for this graph. Therefore, K5 is not planar.

Corollary 3 : If a connected planar simple graph has 3 edges and v vertices with v ≤ 3 and no circuits
of length three, then 𝑒 ≤ 2𝑣 − 4.

The proof of this corollary is same as corollary 1 except that in this case the fact that there are no
circuits of length three implies that the degrees of a region must be at least four.

NOTE : here u can also find average degree. Consider 𝟐𝒆 ≤ 𝟔𝒗 − 𝟏𝟐. 2e means sum of degree and
if u divide it by v i.e. total number of vertices then u will get 6 – 12/v, this is at most degree of
vertices.

7.6.2) Kuratowski’s Theorem :

We saw that K3,3 and K5 are not planar. Clearly, a graph is not planar is it contains either of these two
graphs as subgraph.

If a graph is planar, so will be any graph obtained by removing an edge {u, v} and adding a new vertex
w together with edges {u, w} and {w, v}. Such an operation is called an elementary subdivision. The
graph 𝐺1 = (𝑉1 , 𝐸1 ) and 𝐺2 (𝑉2 , 𝐸2 ) are called Homeomorphic if they can be obtained from the same
graph by a sequence of elementary subdivisions.

Theorem : A graph is nonplanar if and only if contains a subgraph homeomorphic to K3, 3 or K5.

Made by Quantum City


goclasses.in

//Lecture 23A

7.7) POWERS OF ADJACENCY MATRIX OF A GRAPH :

Q : Find the number of walks of length 3 from vertex a to vertex a in the following undirected graph ?
-

If we convert undirected graph G to a new graph G’ by putting self-loops on all vertices then If there
is a walk of length 1 to n – 1 in G between any two vertices then there is walk of length exactly n – 1
in G’.

7.7.1) Power of adjacency matrix of a graph :

Adjacency matrix of a graph will give u walk of length 1.

Let M represents adjacency matrix of a graph G. Thus, M2 gives you no. of walks of length 2 between
every pair of vertices.

Every i, j in Mn gives the number of walks from i to j of length n

 Find degree of every vertex :

Idea 1 :

Idea 2 : In M2, the main diagonal is degree of all vertices.

𝑡𝑟𝑎𝑐𝑒(𝑀2 ) = ∑ deg (𝑣) = 2|𝐸|


𝑣∈𝑉

Made by Quantum City


goclasses.in

NOTE : If n is the smallest nonnegative integer, such that for some i, j the element (i, j) of An is
positive, then n is the distance between vertex i and vertex j.

//Lecture 24B

7.7.2) More application of powers of adjacency matrix of a graph :

1) Undirected graph is connected or not :

Method 1 : 𝑀1 + 𝑀2 + ⋯ + 𝑀𝑛−1 where n is no. of vertices >= 3.

This method is nothing but finding walks of length 1 to n-1 between every pair of vertices.

Method 2 : put all self loops and then find walks of length n – 1 between every pair of vertices.

G is connected if and only if the matrix (𝑰𝒏 + 𝑨)𝒏−𝟏 has no 0’s

2) Directed graph is connected (strongly off course) or not :

Method 1 : 𝑀1 + 𝑀2 + ⋯ + 𝑀𝑛−1 + 𝑀𝑛 where n is no. of vertices >= 3

G (Directed) is connected if and only if the matrix (𝑰𝒏 + 𝑨)𝒏 has no 0’s

3) Finding number of 3 – length cycles :


𝑻𝒓𝒂𝒄𝒆(𝑴𝟑 )
Directed simple graph with no self-loops # 𝟑 − 𝒍𝒆𝒏𝒈𝒕𝒉 𝒄𝒚𝒄𝒍𝒆𝒔 = .
𝟑

4) Finding transitive closure of a relation :

Made by Quantum City


goclasses.in

Silly mistakes :

In this problem you have to find number of Hamiltonian cycles. You


answered 8! But you have overcounted some cases like clockwise
and anticlockwise cycle then cycle forming same sequences for
example, 12345678 and 23456781… such 7 sequences should be
mapped to 1. So, final answer should be 8!/(2x7).

1)

2)The maximum number of edges in a bipartite graph with 19 vertices is _________. – this is one of
the simplest answers is 90 but you have selected 90/2 because you thought 10x9 would count some
edges twice but logic is there are one set containing 10 and other containing 9 so for each 10 vertices
you have 9 possible edges.

Made by Quantum City

You might also like