Discrete Mathematics Notes Quantum City
Discrete Mathematics Notes Quantum City
COURSE OF
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
1. 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.
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 :
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.
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.
Note : New propositions (Compound) can be created from Atomic propositions with the help of
Logical connectives.
A Compound propositions are the propositions which are constructed by combining one or more
atomic propositions.
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.
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.
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.
In logic, we have, AND = But = Although = Though = Even Though = However = Yet = Still = Moreover
= Nevertheless = Nonetheless = Comma.
“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
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).
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.
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)
We say that above argument (example) is valid. Argument is valid if, whenever the premises are true,
then the conclusion is true.
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.
Fallacy of denying the hypothesis : ((p → q) ∧ ¬p) → ¬q (For q true and p false)
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.
• 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.
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 :
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.
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.
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.
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.
Ɐ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 ?
Ɐ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.
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
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.
NOTE :
A part of logical expression to which a quantifier is applied is called the scope of this 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.
Ɐ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.
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) : 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.
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 :
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))).
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.
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.
We directly go to example,
In short,
• 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)
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.
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.
Procedure :
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.
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.
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.
This is distribution of quantifier over logical connectives : let’s represent quantifier by some common
notation ( ) and connectives by ( ). We have to check,
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.
NULL Quantification :
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.
Then Interpretation means some truth combination of G (it might be true or false)
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.
KB = {E1, E2, E3,… En} then model is an interpretation for which E1 and E2 and … and En is true.
So, in propositional logic in terms of interpretation and models we can say that,
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)
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.
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 ( ).
3. Set theory
3.1) Introduction :
Set notation : Curly braces with commas separating out the element.
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.
• 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)
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.
{ n | n ∈ N and n is even }
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.
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.
There are multiple notations for this; they all mean the same thing: 𝑇 ⊂ 𝑆, 𝑇 ⊊ 𝑆.
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 𝑆 ⊈ 𝑃(𝑆)
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).
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.
1) 𝑥 ∈ (𝐴 ∩ 𝐵) – means 𝑥 ∈ 𝐴 𝑎𝑛𝑑 𝑥 ∈ 𝐵
2) 𝑥 ∈ (𝐴 ∪ 𝐵) – 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.
(𝐴̅ − 𝐵) − 𝐶 = (𝐴̅ − 𝐶 ) − (𝐵 − 𝐶)
Question :
1) How may subsets and proper subsets does set A have if it contains 3 elements ?
Answer :
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 : 𝐴 ∪ (𝐴 ∩ 𝐵) = 𝐴, 𝐴 ∩ (𝐴 ∪ 𝐵) = 𝐴
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 𝐴 ⊆ 𝐵.
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, 𝐴 ⊆ 𝐵.
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.
Cartesian Product :
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 𝐴 = ∅ 𝑜𝑟 𝐵 = ∅.
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 :
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.
Can C1 R a ? – Definitely not how come course can take student this is nonsense sentence.
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 𝑇 ⊆ (𝑁 × 𝑁) × 𝑁.
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}.
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|
a is related to c – True
c is related to a – False
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 :
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)}
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.
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.
From above example, Reflexive relation R on A : R = {(1, 1), (2, 2), (3, 3), (1, 2), …}
Question :
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.
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.
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 :
If Base set : A
Relation R on A ≡ 𝑅: 𝐴 → 𝐴
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 :
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.
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.
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
In short, we can say that asymmetric relation is anti-symmetric relation with no self-loop in graph
representation.
3) Transitive relation :
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.
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.
The time complexity of computing the transitive closure of a binary relation on a set of elements is
O(n3)
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.
• 𝐴𝑖 ⊆ 𝐴
• 𝐴𝑖 ∩ 𝐴𝑗 = ∅ 𝑓𝑜𝑟 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.
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.
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.
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}
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
• Every equivalence relation R on set A gives unique partition of A. and each part of partition is
called equivalence class of R.
• 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 ******.
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.
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.
Answer :
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.
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,
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,
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.
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)
In equivalence relation if we want to express relation between two elements, we use ~ symbol, in
partial order relation we use ≼ symbol.
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.
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.
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.
Let’s take another example, Consider POR (partial order relation) (𝑃({1, 2}), ⊆)
• 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.
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,
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).
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.
• 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)
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)
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.
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.
• 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 :
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 ∀𝑩 ⊆ 𝑨
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.
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.
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
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.
• 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 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.
For example, (𝑁, ≤), Dominator for LUB = DNE; dominator of GLB = 1.
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.
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 :
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.
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)
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.
1 element = 4 elements =
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 (𝑃(𝑆), ⊇)? –
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}.
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 ? -
4. FUNCTION
// Lecture 1
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 :
Q : how many functions are possible for set A = {1, 2} to B = {a, b} ? – No. of function is 4.
As we know that function is relation so we can also have set representation of function.
Two real-valued function or two integer valued function with the same domain can be added, as well
as multiplied.
// Lecture 4
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 :
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.
NOTE :
Example,
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.
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 :
5. GROUP THEORY
//GP : Lecture 1
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
Example of algebraic structures with a single binary operation are : magma, quasigroup, monoid,
semigroup, group, lattice, Boolean algebra.
// Lecture 4
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”.
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
(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
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.
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
Commutative property is satisfied by some structure (S, #) iff ∀𝑎,𝑏∈𝑆 (𝑎#𝑏 = 𝑏#𝑎)
//Lecture 11
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.
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.3) Monoid : A semigroup with identity property. Sometimes monoid structure is represented as
(S, *, e) where * is binary operation and e is identity element.
//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 :
//Lecture 13
Properties of monoid :
Right cancellation property : if b # a = c # a then b = c (meaning we can cancel a from right side)
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.
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.
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
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.
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.
Which means
//Lecture 24
// Lecture 25A
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.
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)
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
We introduce the concept of integral exponents of elements in a group. The concept plays an
important role in the theory of cyclic groups.
𝑎0 = 𝑒
𝑎𝑛 = 𝑎𝑛−1 𝑎, 𝑓𝑜𝑟 𝑛 ≥ 1
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
5.2.5) Subgroups :
• 𝑒∈𝐻
• 𝑥, 𝑦 ∈ 𝐻 → 𝑥 ∗ 𝑦 ∈ 𝐻
• 𝑥 ∈ 𝐻 → 𝑥 −1 ∈ 𝐻
//Lecture 27B
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
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
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.
Order of 1 (by definition) = |<1>|=|{1}|… because 1 can only generate 1 and |{1}| = 1
One thing to note that order of identity element is always one as it can create only itself through any
operation in group.
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
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.
//Lecture 29
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.
• {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
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…
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
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
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.
• 𝑒∈𝐻
• 𝑥, 𝑦 ∈ 𝐻 → 𝑥 ∗ 𝑦 ∈ 𝐻
• 𝑥 ∈ 𝐻 → 𝑥 −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
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 :
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.
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 : 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.
//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
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,
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.
//Lecture 7
6.1.5) The complement rule : It is sometimes easier to calculate the undesired cases.
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.
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.
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.
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.
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.
𝒏!
Permutation of r object from n objects (distinct) = 𝑷(𝒏, 𝒓) = (𝒏−𝒓)!
//Lecture 11
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 ≤ 𝑟 ≤ 𝑛
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 –
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
In this section we are going to see combinational arguments with making stories and proving identities
with pure logic.
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.
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
Binomial means summation of two terms. Binomial theorem is our childhood theorem. Take an
example,
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,
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
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.
Method 1 : First select two position fixed for two o’s and then permute remaining two letter.
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)
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 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
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.
//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)
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)
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.
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 ?
• 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.
//Lecture 20C
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 :
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.
𝑛−𝑘+𝑘−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
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 ?”
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
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
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
Q : How many ways to put 7 balls in 4 identical bins ? – We can create 4 cases because of 4 bins,
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.
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,
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 ? –
//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
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]).
At least one number should be in its own place = 𝑛 × (𝑛 − 1)! − 𝐶 (𝑛, 2) × (𝑛 − 2)! + 𝐶 (𝑛, 3) …
𝟏 𝟏 𝟏 𝟏 (−𝟏)𝒏
# Derangement = 𝒏! × (𝟏 − + − + − ⋯+ )
𝟏! 𝟐! 𝟑! 𝟒! 𝒏!
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
We want to know the total number of possible onto function from A to B. We use complement rule
to simplify this problem to
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))
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 :
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.
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
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
𝒂 𝒅𝒓
𝑺= + … 𝒇𝒐𝒓 𝒊𝒏𝒇𝒊𝒏𝒊𝒕𝒆 𝑨𝑮𝑷
𝟏−𝒓 ( 𝟏 − 𝒓)𝟐
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.
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,
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
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
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)
Recurrence relations occur when some term in a sequence depends on the previous terms of the
sequence. For example,
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.
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.
𝑫𝒏 = (𝒏 − 𝟏)(𝑫𝒏−𝟏 + 𝑫𝒏−𝟐 )
𝑫𝒏 − 𝒏𝑫𝒏−𝟏 = (−𝟏)𝒏
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.
𝒏
𝒏
𝑩𝒏+𝟏 = ∑ ( ) 𝑩𝒌
𝒌
𝒌=𝟎
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.
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.
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,
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
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.
Silly mistakes :
7. Graph Theory
//Graph theory lecture 1
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.
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.
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
means total degree of odd-degree vertices are even. So, we cannot have odd number of odd-degree
vertices in graph.
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
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.
//Lecture 4A
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.
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.
1) Regular graph : Every vertex has same degree. A more generalized k-regular graph in which
every vertex has k degree. For example,
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.
//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 :
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.
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
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 :
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
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.
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
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|.
1) Connected components :
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.
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,
• 𝑋∩𝑌 =∅
• ∀𝑎,𝑏∈𝑋 (𝑎, 𝑏) ∉ 𝐸(𝐺)
∀𝑎,𝑏∈𝑌 (𝑎, 𝑏) ∉ 𝐸(𝐺)
• 𝑋∪𝑌 =𝑉
• 𝑿, 𝒀 can be empty
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
As the name indicate it should be bipartite with all possible edges maintaining bipartite property.
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
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.
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.
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
same procedure. After one vertex we will have equal number of vertex and edges. No. edges will be e
+ 1 = n ➔ n – 1 edges.
• 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
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.
//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.
Proof. We know that Binary tree → rooted tree → directed graph → total indeg = total outdeg = |E|
Suppose, L represents no. of leaves, D’ represents no. of nodes with degree 1, D’’ represents no. of
nodes with degree 2.
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
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
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.
For example,
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
//Lecture 15A
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
𝒏
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.
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
𝜶+𝜷=𝒏
//Lecture 16A
7.3.3) Matching :
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 𝛼′(𝐺).
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
Meaning the cardinality of any matching is less than or equal to the cardinality of any vertex cover.
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)
Summery,
𝛼+𝛽 =𝑛 𝛼′ + 𝛽′ = 𝑛 𝛽 ′ ≥ ⌈𝑛/2⌉
′
𝜇 ≤ 𝛽 ≤ 2𝜇 𝛼 = 𝜇 ≤ ⌊𝑛/2⌋ 𝛼 ≤ 𝛽′
Bipartite → (𝜇 = 𝛽)
//Lecture 17A
1) Vertex coloring :
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.
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
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.”
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.
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.
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
Can be realized by simple graph (after reordering the sequence in nonincreasing order).
example,
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
Cut vertex = articulation point = removal of vertex 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.
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
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.
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
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.
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.
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
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.
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.
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.
Euler path : An open trail which goes through 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.
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.
//Lecture 21B
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.
Sadly, there is no efficient method to determine Hamiltonian cycle unlike Euler cycle.
• 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
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?
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.
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.
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.
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.
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.
//Lecture 23A
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’.
Let M represents adjacency matrix of a graph G. Thus, M2 gives you no. of walks of length 2 between
every pair of vertices.
Idea 1 :
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
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 (Directed) is connected if and only if the matrix (𝑰𝒏 + 𝑨)𝒏 has no 0’s
Silly mistakes :
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.