1 Final
1 Final
Dhananjoy Dey
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 1 / 84
Disclaimers
1
All the pictures used in this presentation are taken from freely available
websites.
2
If there is a reference on a slide all the information on that slide is
attributable to that source whether quotation marks are used or not.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 2 / 84
Outline
1 Propositional Logic
2 Proofs
Direct Proof
Proof by Contradiction
Proof by Contrapositive
Constructive Proofs, Counterexamples, and Vacuous Proofs
Mathematical Induction
3 Counting
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 3 / 84
Propositional Logic
Outline
1 Propositional Logic
2 Proofs
Direct Proof
Proof by Contradiction
Proof by Contrapositive
Constructive Proofs, Counterexamples, and Vacuous Proofs
Mathematical Induction
3 Counting
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 4 / 84
Propositional Logic
Propositions/Statements
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 5 / 84
Propositional Logic
Propositions/Statements
Definition
A proposition/statements is a declarative sentence that is either true or
false never both or in between.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 5 / 84
Propositional Logic
Propositions/Statements
Definition
A proposition/statements is a declarative sentence that is either true or
false never both or in between.
Example (Propositions)
1 AI is being harnessed in the treatment of cancer.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 5 / 84
Propositional Logic
Propositions/Statements
Definition
A proposition/statements is a declarative sentence that is either true or
false never both or in between.
Example (Propositions)
1 AI is being harnessed in the treatment of cancer.
2 Guwahati is the capital of Assam
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 5 / 84
Propositional Logic
Propositions/Statements
Definition
A proposition/statements is a declarative sentence that is either true or
false never both or in between.
Example (Propositions)
1 AI is being harnessed in the treatment of cancer.
2 Guwahati is the capital of Assam
3 210 × 315 = 615
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 5 / 84
Propositional Logic
Propositions/Statements
Definition
A proposition/statements is a declarative sentence that is either true or
false never both or in between.
Example (Propositions)
1 AI is being harnessed in the treatment of cancer.
2 Guwahati is the capital of Assam
3 210 × 315 = 615
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 5 / 84
Propositional Logic
Propositions/Statements
Definition
A proposition/statements is a declarative sentence that is either true or
false never both or in between.
Example (Propositions)
1 AI is being harnessed in the treatment of cancer.
2 Guwahati is the capital of Assam
3 210 × 315 = 615
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 5 / 84
Propositional Logic
Propositions/Statements
Definition
A proposition/statements is a declarative sentence that is either true or
false never both or in between.
Example (Propositions)
1 AI is being harnessed in the treatment of cancer.
2 Guwahati is the capital of Assam
3 210 × 315 = 615
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 5 / 84
Propositional Logic
Propositions/Statements
Definition
A proposition/statements is a declarative sentence that is either true or
false never both or in between.
Example (Propositions)
1 AI is being harnessed in the treatment of cancer.
2 Guwahati is the capital of Assam
3 210 × 315 = 615
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 5 / 84
Propositional Logic
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 6 / 84
Propositional Logic
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 6 / 84
Propositional Logic
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 6 / 84
Propositional Logic
Propositional Logic . . .
Constructing Propositions
Propositional Variables: p, q, r, s, . . .
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 7 / 84
Propositional Logic
Propositional Logic . . .
Constructing Propositions
Propositional Variables: p, q, r, s, . . .
The proposition that is always true is denoted by T and the
proposition that is always false is denoted by F.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 7 / 84
Propositional Logic
Propositional Logic . . .
Constructing Propositions
Propositional Variables: p, q, r, s, . . .
The proposition that is always true is denoted by T and the
proposition that is always false is denoted by F.
Compound Propositions – constructed from logical connectives
and other propositions
Negation ¬
Conjunction ∧
Disjunction ∨
Implication → or =⇒
Biconditional ↔ or ⇐⇒
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 7 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 8 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 8 / 84
Propositional Logic
Example
p – you are students of 2nd year B.Tech
¬p –
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 8 / 84
Propositional Logic
Example
p – you are students of 2nd year B.Tech
¬p – you are not students of 2nd year B.Tech
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 8 / 84
Propositional Logic
Example
p – you are students of 2nd year B.Tech
¬p – you are not students of 2nd year B.Tech
Example (Note:)
The negation of the statement ‘5 + 3 = 9’ is
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 9 / 84
Propositional Logic
Example (Note:)
The negation of the statement ‘5 + 3 = 9’ is ‘5 + 3 , 9’,
and not the statement ‘5 + 3 = 8’.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 9 / 84
Propositional Logic
Example (Note:)
The negation of the statement ‘5 + 3 = 9’ is ‘5 + 3 , 9’,
and not the statement ‘5 + 3 = 8’.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 9 / 84
Propositional Logic
Example (Note:)
The negation of the statement ‘5 + 3 = 9’ is ‘5 + 3 , 9’,
and not the statement ‘5 + 3 = 8’.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 9 / 84
Propositional Logic
Conjunction
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 10 / 84
Propositional Logic
Conjunction
Example
p – you are attending this lecture
q – it is sunny today
p∧q–
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 10 / 84
Propositional Logic
Conjunction
Example
p – you are attending this lecture
q – it is sunny today
p ∧ q – you are attending this lecture and it is sunny today
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 10 / 84
Propositional Logic
Disjunction
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 11 / 84
Propositional Logic
Disjunction
Example
p – you are attending this lecture
q – you are watching something on your mobile
p∨q–
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 11 / 84
Propositional Logic
Disjunction
Example
p – you are attending this lecture
q – you are watching something on your mobile
p ∨ q – you are attending this lecture or watching something on your
mobile
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 11 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 12 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 12 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 12 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 12 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 12 / 84
Propositional Logic
Exclusive or (Xor)
A B A⊕B
T T F
T F T
F T T
F F F
Table: Truth Table
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 13 / 84
Propositional Logic
Exclusive or (Xor)
A B A⊕B
T T F
T F T
F T T
F F F
Table: Truth Table
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 13 / 84
Propositional Logic
Exclusive or (Xor)
A B A⊕B
T T F
T F T
F T T
F F F
Table: Truth Table
Theorem
p ⊕ q ⇐⇒ (p ∧ ¬q) ∨ (¬p ∧ q).
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 13 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 14 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 14 / 84
Propositional Logic
p q p⇒q
T T T
T F F
F T T
F F T
Table: Truth Table
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 14 / 84
Propositional Logic
p q p⇒q
T T T
T F F
F T T
F F T
Table: Truth Table
Understanding Implication
If n is an even integer, then n = 2 · k, where k ∈ Z.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 15 / 84
Propositional Logic
Understanding Implication
If n is an even integer, then n = 2 · k, where k ∈ Z.
In p ⇒ q there does not need to be any connection between the
hypothesis or the conclusion.
The “meaning" of p ⇒ q depends only on the truth values of p and
q.
These implications are perfectly fine, but would not be used in
ordinary English.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 15 / 84
Propositional Logic
Understanding Implication
If n is an even integer, then n = 2 · k, where k ∈ Z.
In p ⇒ q there does not need to be any connection between the
hypothesis or the conclusion.
The “meaning" of p ⇒ q depends only on the truth values of p and
q.
These implications are perfectly fine, but would not be used in
ordinary English.
If color the moon is green, then you have more money than Mukesh
Ambani.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 15 / 84
Propositional Logic
Understanding Implication
If n is an even integer, then n = 2 · k, where k ∈ Z.
In p ⇒ q there does not need to be any connection between the
hypothesis or the conclusion.
The “meaning" of p ⇒ q depends only on the truth values of p and
q.
These implications are perfectly fine, but would not be used in
ordinary English.
If color the moon is green, then you have more money than Mukesh
Ambani.
If 1 + 1 = 3, then you are presently in Nepal, embarking on a
trekking adventure.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 15 / 84
Propositional Logic
Understanding Implication
If n is an even integer, then n = 2 · k, where k ∈ Z.
In p ⇒ q there does not need to be any connection between the
hypothesis or the conclusion.
The “meaning" of p ⇒ q depends only on the truth values of p and
q.
These implications are perfectly fine, but would not be used in
ordinary English.
If color the moon is green, then you have more money than Mukesh
Ambani.
If 1 + 1 = 3, then you are presently in Nepal, embarking on a
trekking adventure.
One way to view the logical conditional is to think of an obligation
or contract.
If you score 85% on the final exam, you will receive an A grade.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 15 / 84
Propositional Logic
Understanding Implication . . .
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 16 / 84
Propositional Logic
Understanding Implication . . .
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 16 / 84
Propositional Logic
Understanding Implication . . .
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 16 / 84
Propositional Logic
Understanding Implication . . .
Observation
For two statements S and T the following convey the same meaning:
(i) If S then T .
(ii) T if S .
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 17 / 84
Propositional Logic
Understanding Implication . . .
Observation
For two statements S and T the following convey the same meaning:
(i) If S then T .
(ii) T if S .
(iii) S implies T .
(iv) S only if T .
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 17 / 84
Propositional Logic
Understanding Implication . . .
Observation
For two statements S and T the following convey the same meaning:
(i) If S then T .
(ii) T if S .
(iii) S implies T .
(iv) S only if T .
(v) T is necessary for S .
(vi) S is sufficient for T .
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 17 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 18 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 18 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 18 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 18 / 84
Propositional Logic
Converse
Consider the two implications
(i) If the student is sincere, then (s)he is humble.
(ii) If the student is humble, then (s)he is sincere.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 19 / 84
Propositional Logic
Converse
Consider the two implications
(i) If the student is sincere, then (s)he is humble.
(ii) If the student is humble, then (s)he is sincere.
The conjunction of (i) and (ii) is written as
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 19 / 84
Propositional Logic
Converse
Consider the two implications
(i) If the student is sincere, then (s)he is humble.
(ii) If the student is humble, then (s)he is sincere.
The conjunction of (i) and (ii) is written as
The student is humble if and only if (s)he is sincere.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 19 / 84
Propositional Logic
Converse
Consider the two implications
(i) If the student is sincere, then (s)he is humble.
(ii) If the student is humble, then (s)he is sincere.
The conjunction of (i) and (ii) is written as
The student is humble if and only if (s)he is sincere.
Example
For real numbers x and a > 0, consider the statements:
“|x| < a" and “x ∈ (−a, a)".
Then the two statements
“if |x| < a, then x ∈ (−a, a)" and “if x ∈ (−a, a), then |x| < a"
are converses of each other.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 19 / 84
Propositional Logic
Converse
Consider the two implications
(i) If the student is sincere, then (s)he is humble.
(ii) If the student is humble, then (s)he is sincere.
The conjunction of (i) and (ii) is written as
The student is humble if and only if (s)he is sincere.
Example
For real numbers x and a > 0, consider the statements:
“|x| < a" and “x ∈ (−a, a)".
Then the two statements
“if |x| < a, then x ∈ (−a, a)" and “if x ∈ (−a, a), then |x| < a"
are converses of each other.
Note that the two statements can also be written as
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 20 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 20 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 20 / 84
Propositional Logic
Theorem
p ⇒ q ⇔ ¬p ∨ q.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 20 / 84
Propositional Logic
Biconditional/Equivalence
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 21 / 84
Propositional Logic
Biconditional/Equivalence
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 21 / 84
Propositional Logic
Propositional Logic
¬p Negation Not p
p∨q (Inclusive) Or Either p or q or both
p∧q And Both p and q
p⊕q XOR Either p or q, but not both
p⇒q Implies If p, then q
p⇔q/ Biconditional / p if and only if q
p ⇐⇒ q Equivalence
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 22 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 23 / 84
Propositional Logic
Operator Precedence
¬ 1
∧ 2
∨ 3
⇒ 4
⇔ 5
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 23 / 84
Propositional Logic
Operator Precedence
¬ 1
∧ 2
∨ 3
⇒ 4
⇔ 5
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 23 / 84
Propositional Logic
Operator Precedence
¬ 1
∧ 2
∨ 3
⇒ 4
⇔ 5
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 23 / 84
Propositional Logic
Operator Precedence
¬ 1
∧ 2
∨ 3
⇒ 4
⇔ 5
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 23 / 84
Propositional Logic
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 24 / 84
Propositional Logic
Example
p q r p∨q ¬r p ∨ q ⇒ ¬r
T T T T F F
T T F T T T
T F T T F F
T F F T T T
F T T T F F
F T F T T T
F F T F F T
F F F F T T
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 24 / 84
Propositional Logic
Definition
A tautology is a proposition which is always true.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 25 / 84
Propositional Logic
Definition
A tautology is a proposition which is always true.
p ∨ ¬p
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 25 / 84
Propositional Logic
Definition
A tautology is a proposition which is always true.
p ∨ ¬p
p ∧ ¬p
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 25 / 84
Propositional Logic
De Morgan’s Laws
¬(p ∧ q) ≡ ¬p ∨ ¬q
¬(p ∨ q) ≡ ¬p ∧ ¬q
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 26 / 84
Propositional Logic
De Morgan’s Laws
¬(p ∧ q) ≡ ¬p ∨ ¬q
¬(p ∨ q) ≡ ¬p ∧ ¬q
p q ¬p ¬q (p ∨ q) ¬(p ∨ q) ¬p ∧ ¬q
T T F F T F F
T F F T T F F
F T T F T F F
T F T T F T T
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 26 / 84
Propositional Logic
Identity Laws: p ∧ T ≡ p, p ∨ F ≡ p
Domination Laws: p ∨ T ≡ T , p ∧ F ≡ F
Idempotent laws: p ∧ p ≡ p, p ∨ p ≡ p
Negation Laws: p ∨ ¬p ≡ T , p ∧ ¬p ≡ F
Commutative Laws: p ∨ q ≡ q ∨ p, p ∧ q ≡ q ∧ p
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 27 / 84
Propositional Logic
Associative Laws: (p ∧ q) ∧ r ≡ p ∧ (q ∧ r)
(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)
Absorption Laws: p ∨ (p ∧ q) ≡ p
p ∧ (p ∨ q) ≡ p
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 28 / 84
Propositional Logic
Logic Puzzles
A says “B is a Type-1."
B says “The two of us are of opposite types."
Exercise
What are the types of A and B?
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 29 / 84
Propositional Logic
Logic Puzzles . . .
Solution
Let p and q be the statements that A is a Type-1 and B is a Type-1,
respectively.
Then ¬p represents the proposition that A is a Type-2 and ¬q that
B is a Type-2.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 30 / 84
Propositional Logic
Logic Puzzles . . .
Solution
Let p and q be the statements that A is a Type-1 and B is a Type-1,
respectively.
Then ¬p represents the proposition that A is a Type-2 and ¬q that
B is a Type-2.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 30 / 84
Propositional Logic
Logic Puzzles . . .
Solution
Let p and q be the statements that A is a Type-1 and B is a Type-1,
respectively.
Then ¬p represents the proposition that A is a Type-2 and ¬q that
B is a Type-2.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 30 / 84
Proofs
Outline
1 Propositional Logic
2 Proofs
Direct Proof
Proof by Contradiction
Proof by Contrapositive
Constructive Proofs, Counterexamples, and Vacuous Proofs
Mathematical Induction
3 Counting
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 31 / 84
Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 32 / 84
Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 32 / 84
Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 32 / 84
Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 32 / 84
Proofs
Some Terminology
A theorem
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 33 / 84
Proofs
Some Terminology
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 33 / 84
Proofs
Some Terminology
A lemma
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 33 / 84
Proofs
Some Terminology
A corollary
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 33 / 84
Proofs
Some Terminology
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 33 / 84
Proofs
Some Terminology
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 33 / 84
Proofs
Some Terminology
A conjecture
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 34 / 84
Proofs
Some Terminology
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 34 / 84
Proofs
Some Terminology
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 34 / 84
Proofs
Example
Everybody loves somebody
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 35 / 84
Proofs
Example
Everybody loves somebody
For every person A, there is a person B such that (or 3) A loves B.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 35 / 84
Proofs
Example
Everybody loves somebody
For every person A, there is a person B such that (or 3) A loves B.
or
There is a person B such that for every person A, A loves B.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 35 / 84
Proofs
Example
Everybody loves somebody
For every person A, there is a person B such that (or 3) A loves B.
or
There is a person B such that for every person A, A loves B.
The phrases ‘for all’, ‘for any’, ‘for every’, ‘for some’, & ‘there
exists’ are called quantifiers
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 35 / 84
Proofs
Example
Everybody loves somebody
For every person A, there is a person B such that (or 3) A loves B.
or
There is a person B such that for every person A, A loves B.
The phrases ‘for all’, ‘for any’, ‘for every’, ‘for some’, & ‘there
exists’ are called quantifiers
The symbol ∀ stands for ‘for all’, ‘for any’, or ‘for every’
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 35 / 84
Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 36 / 84
Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 36 / 84
Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 36 / 84
Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 36 / 84
Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 36 / 84
Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 36 / 84
Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 37 / 84
Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 37 / 84
Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 37 / 84
Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 37 / 84
Proofs
Forms of Theorems
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 38 / 84
Proofs
Forms of Theorems
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 38 / 84
Proofs
Proving Theorems
Many theorems have the form:
∀ x (P(x) ⇒ Q(x))
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 39 / 84
Proofs
Proving Theorems
Many theorems have the form:
∀ x (P(x) ⇒ Q(x))
P(c) ⇒ Q(c)
Methods of Proof
Direct Proof
Proof by Contradiction
Proof by Contrapositive
Mathematical Induction
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 40 / 84
Proofs Direct Proof
Direct Proof
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 41 / 84
Proofs Direct Proof
Direct Proof
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 41 / 84
Proofs Direct Proof
Direct Proof . . .
Theorem
The square of an integer is odd if and only if the integer itself is odd.
For any integer n, n2 is odd iff n is odd.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 42 / 84
Proofs Direct Proof
Direct Proof . . .
Theorem
The square of an integer is odd if and only if the integer itself is odd.
For any integer n, n2 is odd iff n is odd.
The statement “n2 is odd iff n is odd" is really two statements in one:
1 if n is odd then n2 is odd
2 if n2 is odd then n is odd
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 42 / 84
Proofs Direct Proof
Direct Proof . . .
Example
Prove that if n is odd then n2 is odd.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 43 / 84
Proofs Direct Proof
Direct Proof . . .
Example
Prove that if n is odd then n2 is odd.
Proof.
If n is odd, then we can write n = 2k + 1 where k ∈ Z. Then
n2 = (2k + 1)2
= 4k2 + 4k + 1
= 2(2k2 + 2k) + 1
= 2. j + 1 where j = (2k2 + 2k) ∈ Z
Thus, n2 is odd.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 43 / 84
Proofs Direct Proof
Direct Proof . . .
Example
Prove that if n2 is odd then n is odd.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 44 / 84
Proofs Direct Proof
Direct Proof . . .
Example
Prove that if n2 is odd then n is odd.
Proof.
If n2 is odd, then we can write n2 = 2k + 1 where k ∈ Z. Then
n2 = 2k + 1
⇒ − 1 = 2k n2
⇒ (n + 1)(n − 1) = 2k which is even, since k ∈ Z
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 44 / 84
Proofs Proof by Contradiction
Proof by Contradiction
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 45 / 84
Proofs Proof by Contradiction
Proof by Contradiction
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 45 / 84
Proofs Proof by Contradiction
Proof by Contradiction
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 45 / 84
Proofs Proof by Contradiction
Proof by Contradiction
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 45 / 84
Proofs Proof by Contradiction
Proof by Contradiction . . .
Example
Only if part of previous theorem:
Proof.
Now, we have to show that if n2 is odd, then n must be odd.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 46 / 84
Proofs Proof by Contradiction
Proof by Contradiction . . .
Example
Only if part of previous theorem:
Proof.
Now, we have to show that if n2 is odd, then n must be odd.
Suppose this is not true for all n, and that n is a particular integer s/t n2 is odd but
n is not odd.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 46 / 84
Proofs Proof by Contradiction
Proof by Contradiction . . .
Example
Only if part of previous theorem:
Proof.
Now, we have to show that if n2 is odd, then n must be odd.
Suppose this is not true for all n, and that n is a particular integer s/t n2 is odd but
n is not odd.
Now if n is even, we can write n = 2k where k ∈ Z
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 46 / 84
Proofs Proof by Contradiction
Proof by Contradiction . . .
Example
Only if part of previous theorem:
Proof.
Now, we have to show that if n2 is odd, then n must be odd.
Suppose this is not true for all n, and that n is a particular integer s/t n2 is odd but
n is not odd.
Now if n is even, we can write n = 2k where k ∈ Z
n2 = (2k)2
= 4k2
= 2(2k2 )
= 2. j, where j = 2k2
Thus, n2 is even which contradicts our assumption.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 46 / 84
Proofs Proof by Contradiction
Proof by Contradiction . . .
Example
Only if part of previous theorem:
Proof.
Now, we have to show that if n2 is odd, then n must be odd.
Suppose this is not true for all n, and that n is a particular integer s/t n2 is odd but
n is not odd.
Now if n is even, we can write n = 2k where k ∈ Z
n2 = (2k)2
= 4k2
= 2(2k2 )
= 2. j, where j = 2k2
Thus, n2 is even which contradicts our assumption.
That is, the assumption, n is an integer s/t n2 is odd but n is not odd, was false.
So its negation is true: if n2 is odd, then n is odd.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 46
/ 84
Proofs Proof by Contradiction
Corollary
Corollary
If n is odd, then n4 is odd.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 47 / 84
Proofs Proof by Contradiction
Corollary
Corollary
If n is odd, then n4 is odd.
Proof.
Note that n4 = (n2 )2 .
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 47 / 84
Proofs Proof by Contrapositive
Proof by Contrapositive
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 48 / 84
Proofs Proof by Contrapositive
Proof by Contrapositive
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 48 / 84
Proofs Proof by Contrapositive
Proof by Contrapositive
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 48 / 84
Proofs Proof by Contrapositive
Theorem
Prove that if n is an integer and 3n + 2 is odd, then n is odd.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 49 / 84
Proofs Proof by Contrapositive
Theorem
Prove that if n is an integer and 3n + 2 is odd, then n is odd.
Proof.
1 The first step in a proof by contraposition is to assume that the
conclusion of the conditional statement “If 3n + 2 is odd, then n is
odd" is false.
2 Then n = 2k for some k ∈ Z.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 49 / 84
Proofs Proof by Contrapositive
Theorem
Prove that if n is an integer and 3n + 2 is odd, then n is odd.
Proof.
1 The first step in a proof by contraposition is to assume that the
conclusion of the conditional statement “If 3n + 2 is odd, then n is
odd" is false.
2 Then n = 2k for some k ∈ Z.
3 We find that 3n + 2 = 3(2k) + 2 = 6k + 2 = 2(3k + 1).
4 This tells us that 3n + 2 is even.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 49 / 84
Proofs Proof by Contrapositive
Theorem
Prove that if n is an integer and 3n + 2 is odd, then n is odd.
Proof.
1 The first step in a proof by contraposition is to assume that the
conclusion of the conditional statement “If 3n + 2 is odd, then n is
odd" is false.
2 Then n = 2k for some k ∈ Z.
3 We find that 3n + 2 = 3(2k) + 2 = 6k + 2 = 2(3k + 1).
4 This tells us that 3n + 2 is even.
5 This is the negation of the premise of the theorem.
We have proved that if 3n + 2 is odd, then n is odd.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 49 / 84
Proofs Constructive Proofs, Counterexamples, and Vacuous Proofs
Constructive Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 50 / 84
Proofs Constructive Proofs, Counterexamples, and Vacuous Proofs
Constructive Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 50 / 84
Proofs Constructive Proofs, Counterexamples, and Vacuous Proofs
Exercise
Prove that there exists an integer n s/t
n2 + n
= 1.
3n + 8
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 51 / 84
Proofs Constructive Proofs, Counterexamples, and Vacuous Proofs
Exercise
Prove that there exists an integer n s/t
n2 + n
= 1.
3n + 8
Solution
First Thoughts – find such n
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 51 / 84
Proofs Constructive Proofs, Counterexamples, and Vacuous Proofs
Counterexamples
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 52 / 84
Proofs Constructive Proofs, Counterexamples, and Vacuous Proofs
Counterexamples
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 52 / 84
Proofs Constructive Proofs, Counterexamples, and Vacuous Proofs
Counterexamples
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 52 / 84
Proofs Constructive Proofs, Counterexamples, and Vacuous Proofs
Counterexamples
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 52 / 84
Proofs Constructive Proofs, Counterexamples, and Vacuous Proofs
Example
Exercise
Prove that the irrational numbers are not closed under multiplication.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 53 / 84
Proofs Constructive Proofs, Counterexamples, and Vacuous Proofs
Example
Exercise
Prove that the irrational numbers are not closed under multiplication.
Solution
First Thoughts. The statement p : irrational numbers are closed under multiplication
is a universal statement.
¬p : It is not the case that the irrational numbers are closed under multiplication.
This means the given statement is logically equivalent to an existential statement.
We can prove it false if we can produce two irrational numbers whose product is
rational.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 53 / 84
Proofs Constructive Proofs, Counterexamples, and Vacuous Proofs
Example
Exercise
Prove that the irrational numbers are not closed under multiplication.
Solution
First Thoughts. The statement p : irrational numbers are closed under multiplication
is a universal statement.
¬p : It is not the case that the irrational numbers are closed under multiplication.
This means the given statement is logically equivalent to an existential statement.
We can prove it false if we can produce two irrational numbers whose product is
rational.
√ √
Let x = 2 & y = 8. Then x & y are both irrational, but xy = 4 is rational.
Thus the irrational numbers are not closed under multiplication.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 53 / 84
Proofs Constructive Proofs, Counterexamples, and Vacuous Proofs
Counterexamples
In summary,
A single example cannot prove a universally quantified statement
(unless the domain of discourse contains only one element);
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 54 / 84
Proofs Constructive Proofs, Counterexamples, and Vacuous Proofs
Counterexamples
In summary,
A single example cannot prove a universally quantified statement
(unless the domain of discourse contains only one element);
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 54 / 84
Proofs Constructive Proofs, Counterexamples, and Vacuous Proofs
Vacuous Proofs
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 55 / 84
Proofs Constructive Proofs, Counterexamples, and Vacuous Proofs
Exercise
For all x ∈ R, if x2 < 0 then 3x2 + 5 = −7x
Solution
For any x ∈ R, x2 ≥ 0.
Thus, since the antecedent (x2 < 0) is always false, the implication is
vacuously true.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 56 / 84
Proofs Mathematical Induction
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 57 / 84
Proofs Mathematical Induction
Example
n(n+1)
=
Pn
Show that the sum of the first n natural numbers i=1 i 2
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 57 / 84
Proofs Mathematical Induction
Example
n(n+1)
=
Pn
Show that the sum of the first n natural numbers i=1 i 2
Solution
1.(1+1)
1 First, we consider the case when n = 1 and clearly 1 = 2 .
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 57 / 84
Proofs Mathematical Induction
Example
n(n+1)
=
Pn
Show that the sum of the first n natural numbers i=1 i 2
Solution
1.(1+1)
1 First, we consider the case when n = 1 and clearly 1 = 2 .
2 Next, we assume that it is true for n = k, i.e.,
k(k + 1)
1 + 2 + ... + k =
2
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 57 / 84
Proofs Mathematical Induction
Example
n(n+1)
=
Pn
Show that the sum of the first n natural numbers i=1 i 2
Solution
1.(1+1)
1 First, we consider the case when n = 1 and clearly 1 = 2 .
2 Next, we assume that it is true for n = k, i.e.,
k(k + 1)
1 + 2 + ... + k =
2
3 Prove it for n = k + 1
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 57 / 84
Proofs Mathematical Induction
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 58 / 84
Proofs Mathematical Induction
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 58 / 84
Proofs Mathematical Induction
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 58 / 84
Proofs Mathematical Induction
(1 + x)n ≥ (1 + nx) ∀ n ∈ N.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 59 / 84
Proofs Mathematical Induction
Proposition
Every integer greater than 1 can be written as the product of prime
numbers.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 60 / 84
Proofs Mathematical Induction
Proposition
Every integer greater than 1 can be written as the product of prime
numbers.
Proof.
Let P(n) be the statement that n can be written as the product of
prime numbers.
P(n) is true for each integer greater or equal to 2.
For n = 2, P(n) is true.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 60 / 84
Proofs Mathematical Induction
Proposition
Every integer greater than 1 can be written as the product of prime
numbers.
Proof.
Let P(n) be the statement that n can be written as the product of
prime numbers.
P(n) is true for each integer greater or equal to 2.
For n = 2, P(n) is true.
Now, assume that for some k ≥ 2, each integer n with 2 ≤ n ≤ k
may be written as a product of primes. We need to prove that k + 1
is a product of primes.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 60 / 84
Proofs Mathematical Induction
Proof.
Case (a): Suppose k + 1 is a prime. Then we are done.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 61 / 84
Proofs Mathematical Induction
Proof.
Case (a): Suppose k + 1 is a prime. Then we are done.
Case (b): Suppose k + 1 is a not prime. Then by our assumption,
∃ integers a & b with 2 ≤ a, b ≤ k s/t
k + 1 = a · b.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 61 / 84
Proofs Mathematical Induction
Proof.
Case (a): Suppose k + 1 is a prime. Then we are done.
Case (b): Suppose k + 1 is a not prime. Then by our assumption,
∃ integers a & b with 2 ≤ a, b ≤ k s/t
k + 1 = a · b.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 61 / 84
Proofs Mathematical Induction
Mathematical Induction
Induction
Math Induction
Weak Strong
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 62 / 84
Proofs Mathematical Induction
Mathematical Induction
Induction
Math Induction
Weak Strong
Definition
Weak Induction: [P(1) ∧ ∀ k (P(k) ⇒ P(k + 1))] ⇒ ∀ n P(n).
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 62 / 84
Proofs Mathematical Induction
Mathematical Induction
Induction
Math Induction
Weak Strong
Definition
Weak Induction: [P(1) ∧ ∀ k (P(k) ⇒ P(k + 1))] ⇒ ∀ n P(n).
Strong Induction:
[P(1) ∧ ∀ k (P(1) ∧ P(2) ∧ . . . ∧ P(k) ⇒ P(k + 1))] ⇒ ∀ n P(n).
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 62 / 84
Proofs Mathematical Induction
Mathematical Induction . . .
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 63 / 84
Proofs Mathematical Induction
Mathematical Induction . . .
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 63 / 84
Proofs Mathematical Induction
Exercise
n(n+1)
Show that the sum of the first n natural numbers is 2
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 64 / 84
Proofs Mathematical Induction
Exercise
n(n+1)
Show that the sum of the first n natural numbers is 2
Solution
1.(1+1)
1 First, we consider the case when n = 1 and clearly 1 = 2 .
2 Next, we assume that it is true for n = k, i.e.,
k(k + 1)
1 + 2 + ... + k =
2
3 Prove it for n = k + 1
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 64 / 84
Proofs Mathematical Induction
Example
Consider a statement P(n) as 2 + 4 + . . . + 2n = (n + 2)(n − 1).
Show that if P(k) is true, then P(k + 1) is also true.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 65 / 84
Proofs Mathematical Induction
Example
Consider a statement P(n) as 2 + 4 + . . . + 2n = (n + 2)(n − 1).
Show that if P(k) is true, then P(k + 1) is also true.
However, the base case P(1) is false.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 65 / 84
Proofs Mathematical Induction
Example
Consider a statement P(n) as 2 + 4 + . . . + 2n = (n + 2)(n − 1).
Show that if P(k) is true, then P(k + 1) is also true.
However, the base case P(1) is false.
Note:
Let k ≥ 1 and assume that P(k) is true. Show that P(k + 1) is true.
In fact, this is the base case from where you start making
inductive leap.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 65 / 84
Proofs Mathematical Induction
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 66 / 84
Proofs Mathematical Induction
k + 1 < k.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 66 / 84
Proofs Mathematical Induction
k + 1 < k.
(k + 1) + 1 < k + 1
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 66 / 84
Proofs Mathematical Induction
k + 1 < k.
(k + 1) + 1 < k + 1
Proposition
Every integer greater than 1 can be written as the product of prime
numbers.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 67 / 84
Proofs Mathematical Induction
Proposition
Every integer greater than 1 can be written as the product of prime
numbers.
Proof.
Let P(n) be the statement that n can be written as the product of
prime numbers.
P(n) is true for each integer greater or equal to 2.
For n = 2, P(n) is true.
Now, assume that for some k ≥ 2, each integer n with 2 ≤ n ≤ k
may be written as a product of primes. We need to prove that k + 1
is a product of primes.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 67 / 84
Proofs Mathematical Induction
Proof.
Case (a): Suppose k + 1 is a prime. Then we are done.
Case (b): Suppose k + 1 is a not prime. Then by our assumption,
∃ integers a & b with 2 ≤ a, b ≤ k s/t
k + 1 = ab.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 68 / 84
Proofs Mathematical Induction
Proof.
Case (a): Suppose k + 1 is a prime. Then we are done.
Case (b): Suppose k + 1 is a not prime. Then by our assumption,
∃ integers a & b with 2 ≤ a, b ≤ k s/t
k + 1 = ab.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 68 / 84
Proofs Mathematical Induction
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 69 / 84
Proofs Mathematical Induction
Definition
Let A ⊂ Z and m ∈ Z. Assume that
(i) m∈A
(ii) for k ≥ m, k ∈ A implies k + 1 ∈ A.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 69 / 84
Proofs Mathematical Induction
Definition
Let A ⊂ Z and m ∈ Z. Assume that
(i) m∈A
(ii) for k ≥ m, k ∈ A implies k + 1 ∈ A.
Exercise
Prove that n! > 2n
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 69 / 84
Proofs Mathematical Induction
Definition
Let A ⊂ Z and m ∈ Z. Assume that
(i) m∈A
(ii) for k ≥ m, k ∈ A implies k + 1 ∈ A.
Exercise
Prove that n! > 2n for all positive integers n ≥ 4.
(The base case here is 4.)
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 69 / 84
Counting
Outline
1 Propositional Logic
2 Proofs
Direct Proof
Proof by Contradiction
Proof by Contrapositive
Constructive Proofs, Counterexamples, and Vacuous Proofs
Mathematical Induction
3 Counting
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 70 / 84
Counting
What Is Counting?
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 71 / 84
Counting
What Is Counting?
The term counting decidedly does not refer to the naming of the
ordinal numbers in sequence.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 71 / 84
Counting
What Is Counting?
The term counting decidedly does not refer to the naming of the
ordinal numbers in sequence.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 71 / 84
Counting
What Is Counting?
The term counting decidedly does not refer to the naming of the
ordinal numbers in sequence.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 71 / 84
Counting
What Is Counting?
The term counting decidedly does not refer to the naming of the
ordinal numbers in sequence.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 71 / 84
Counting
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 72 / 84
Counting
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 72 / 84
Counting
Example
How many different number plates can be made if each plate is of the
form XY αβ WZ γδκν, where X, Y, W, Z ∈ upper-case English letters and
α, β, γ, δ, κ, ν ∈ {0, 1, · · · , 9}?
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 72 / 84
Counting
Example
How many different number plates can be made if each plate is of the
form XY αβ WZ γδκν, where X, Y, W, Z ∈ upper-case English letters and
α, β, γ, δ, κ, ν ∈ {0, 1, · · · , 9}?
Solution
There are 262 × 102 × 262 × 104 = 264 × 106 many different number plates
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 72 / 84
Counting
Counting Functions
Example
How many functions are there from a set with m elements to a set with
n elements?
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 73 / 84
Counting
Counting Functions
Example
How many functions are there from a set with m elements to a set with
n elements?
Solution
There are n × . . . × }n = nm such functions.
| × n {z
m-times
Example
How many one-to-one functions are there from a set with m elements
to a set with n elements?
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 73 / 84
Counting
Counting Functions
Example
How many functions are there from a set with m elements to a set with
n elements?
Solution
There are n × . . . × }n = nm such functions.
| × n {z
m-times
Example
How many one-to-one functions are there from a set with m elements
to a set with n elements?
Solution
There are n(n − 1)(n − 2) . . . (n − m + 1) such functions.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 73 / 84
Counting
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 74 / 84
Counting
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 74 / 84
Counting
Example
The IIITL must choose either a student from 2nd year IT, CS, CSAI, or
CSB as a representative for students’ committee.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 74 / 84
Counting
Counting Passwords
Exercise
A password consists of 12 to 14 characters, where each character is
an uppercase letter or a digit. Each password must contain at least
one digit. How many possible ways you can choose your passwords?
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 75 / 84
Counting
Counting Passwords
Exercise
A password consists of 12 to 14 characters, where each character is
an uppercase letter or a digit. Each password must contain at least
one digit. How many possible ways you can choose your passwords?
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 75 / 84
Counting
Counting Passwords
Solution
Let P be the total number of passwords, and let P12 , P13 , & P14 be the
passwords of length 12, 13, and 14.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 76 / 84
Counting
|A ∪ B| = |A| + |B| − |A ∩ B|
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 77 / 84
Counting
Exercise
How many bit strings of length 8 either start with a 1 bit or end with the
two bits 00?
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 78 / 84
Counting
Exercise
How many bit strings of length 8 either start with a 1 bit or end with the
two bits 00?
Solution
Number of bit strings of length 8 that start with a 1 bit: 27 = 128
Number of bit strings of length 8 that start with a 1 bit and end with
bits 00 : 25 = 32
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 78 / 84
Counting
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 79 / 84
Counting
Principle
If you want to place n pigeons into m pigeonholes, and n > m, then at
least one pigeonhole will contain more than one pigeon.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 79 / 84
Counting
Principle
If you want to place n pigeons into m pigeonholes, and n > m, then at
least one pigeonhole will contain more than one pigeon.
– familiar version
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 79 / 84
Counting
Principle
If you want to place n pigeons into m pigeonholes, and n > m, then at
least one pigeonhole will contain more than one pigeon.
– familiar version
Proof.
Suppose none of the m pigeonholes, has more than one pigeon.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 79 / 84
Counting
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 80 / 84
Counting
Example
Among any group of 366 people, there must be at least 2 having the same
birthday.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 80 / 84
Counting
Example
Among any group of 366 people, there must be at least 2 having the same
birthday.
Problem
Let there be m + 1 people {P1 , P2 , . . . , Pm+1 } in a room. What should be the
value of m so that the probability that atleast one of the persons
{P2 , P3 , . . . , Pm+1 } shares birthday with P1 is greater than 12 ?
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 80 / 84
Counting
Example
Among any group of 366 people, there must be at least 2 having the same
birthday.
Problem
Let there be m + 1 people {P1 , P2 , . . . , Pm+1 } in a room. What should be the
value of m so that the probability that atleast one of the persons
{P2 , P3 , . . . , Pm+1 } shares birthday with P1 is greater than 12 ?
Problem
How many people must be there in a room, so that the probability of atleast 2 of them sharing the
same birthday is greater than 12 ?
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 80 / 84
Counting
Theorem
Let A be a finite set, partitioned into finite subsets S 1 , S 2 , . . . , S m . If
|A| = n > m, then at least one of these m subsets contains more than
one element.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 81 / 84
Counting
Theorem
Let A be a finite set, partitioned into finite subsets S 1 , S 2 , . . . , S m . If
|A| = n > m, then at least one of these m subsets contains more than
one element.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 81 / 84
Counting
Theorem
Let A be a finite set, partitioned into finite subsets S 1 , S 2 , . . . , S m . If
|A| = n > m, then at least one of these m subsets contains more than
one element.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 81 / 84
Counting
Exercise
Given m integers a1 , . . . , am , ∃ k and ` with 0 ≤ k ≤ ` ≤ m. Prove that
ak+1 + ak+2 + · · · + a` is divisible by m.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 82 / 84
Counting
Exercise
Given m integers a1 , . . . , am , ∃ k and ` with 0 ≤ k ≤ ` ≤ m. Prove that
ak+1 + ak+2 + · · · + a` is divisible by m.
Solution
First, consider a1 , (a1 + a2 ), . . . , (a1 + a2 + · · · + am ).
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 82 / 84
Counting
Exercise
Given m integers a1 , . . . , am , ∃ k and ` with 0 ≤ k ≤ ` ≤ m. Prove that
ak+1 + ak+2 + · · · + a` is divisible by m.
Solution
First, consider a1 , (a1 + a2 ), . . . , (a1 + a2 + · · · + am ).
This list contains m numbers.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 82 / 84
Counting
Exercise
Given m integers a1 , . . . , am , ∃ k and ` with 0 ≤ k ≤ ` ≤ m. Prove that
ak+1 + ak+2 + · · · + a` is divisible by m.
Solution
First, consider a1 , (a1 + a2 ), . . . , (a1 + a2 + · · · + am ).
This list contains m numbers.
1 If m divides any of these, we are done.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 82 / 84
Counting
Exercise
Given m integers a1 , . . . , am , ∃ k and ` with 0 ≤ k ≤ ` ≤ m. Prove that
ak+1 + ak+2 + · · · + a` is divisible by m.
Solution
First, consider a1 , (a1 + a2 ), . . . , (a1 + a2 + · · · + am ).
This list contains m numbers.
1 If m divides any of these, we are done.
2 Otherwise, this means these all leave a remainder when divided by
m, in the set {1, . . . , m − 1}.
By the pigeonhole principle, there are 2 numbers, say
(a1 + · · · + ak ), (a1 + · · · + a` ) that leave the same remainder.
Thus (a1 + · · · + a` ) − (a1 + · · · + ak ) = ak+1 + · · · + a` is divisible by m.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 82 / 84
Counting
Exercise
1 Prove that in any set of 99 natural numbers, there is a subset of 15
of them with the property that the difference of any two numbers in
the subset is divisible by 7.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 83 / 84
Counting
Exercise
1 Prove that in any set of 99 natural numbers, there is a subset of 15
of them with the property that the difference of any two numbers in
the subset is divisible by 7.
2 There are 75 students in a class. Each got an A, B, C, or D on a
test. Show that there are at least 19 students who received the
same grade.
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 83 / 84
Counting
Exercise
1 Prove that in any set of 99 natural numbers, there is a subset of 15
of them with the property that the difference of any two numbers in
the subset is divisible by 7.
2 There are 75 students in a class. Each got an A, B, C, or D on a
test. Show that there are at least 19 students who received the
same grade.
3 How many students, each from one of the 36 states or union
territories, need to be enrolled in IIITL to ensure that there are at
least 12 from the same state or union territory?
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 83 / 84
Counting
The End
Dhananjoy Dey (IIITL) Logic, Proofs, and Counting January 28, 2025 84 / 84