Btech 3rd Sem — Discrete Structure Solved Paper
- Attempt any five questions. All questions carry equal marks (14 each).
- Each part (a)/(b) carries 7 marks — answers below are written to that length: definition → working/proof → example/diagram → conclusion.
- In case of any doubt, the English version of the question is final.
Question-wise topics
| Q.No. | Topics asked |
|---|---|
| Q1 | Countable & uncountable sets, Q is countable; distributive law by Venn diagram |
| Q2 | Equivalence relation & partial order; checking R on {1,2,3}, equivalence classes |
| Q3 | One-one, onto, bijective; inverse exists ⇔ bijective; pigeonhole principle |
| Q4 | Tautology (p→q)↔(¬p∨q); predicate logic and negation |
| Q5 | Induction Σn = n(n+1)/2; √2 irrational by contradiction |
| Q6 | Group, abelian group, uniqueness of identity; subgroups of Z8 |
| Q7 | FSM as language recognizer; FSM for strings ending with 01 |
| Q8 | Euler path/circuit conditions; Dijkstra's shortest-path algorithm |
A set that is not countable is uncountable.
- Countable: N, Z (list 0, 1, −1, 2, −2, …), the set of even numbers, Q, set of all finite strings over an alphabet.
- Uncountable: R, the interval (0, 1), P(N), set of irrational numbers.
Theorem: The set of rational numbers Q is countable
Step 1 — Q+ is countable. Write every positive rational p/q in an infinite array: row p, column q.
| p \ q | 1 | 2 | 3 | 4 | 5 | … |
|---|---|---|---|---|---|---|
| 1 | 1/1 | 1/2 | 1/3 | 1/4 | 1/5 | … |
| 2 | 2/1 | 2/2 | 2/3 | 2/4 | 2/5 | … |
| 3 | 3/1 | 3/2 | 3/3 | 3/4 | 3/5 | … |
| 4 | 4/1 | 4/2 | 4/3 | 4/4 | 4/5 | … |
| … | … | … | … | … | … | … |
List the entries along the diagonals p + q = 2, 3, 4, … (Cantor's diagonal listing), skipping fractions not in lowest terms (e.g. 2/2, 2/4):
Every positive rational appears exactly once in this list at a finite position, so we get a bijection f : N → Q+. Hence Q+ is countable: q1, q2, q3, …
Step 2 — Q is countable. Q = Q− ∪ {0} ∪ Q+. Now list Q as
This defines f(1) = 0, f(2k) = qk, f(2k + 1) = −qk — a bijection from N onto Q.
This is the distributive law of intersection over union. We shade both sides step by step and compare.
Left-hand side: A ∩ (B ∪ C)
B ∪ C = everything inside B or C. Intersecting with A keeps only the part of A that lies in B or in C: regions A∩B only, A∩C only and A∩B∩C.
Right-hand side: (A ∩ B) ∪ (A ∩ C)
A ∩ B and A ∩ C are the two lens-shaped overlaps of A; their union covers exactly the same three regions: A∩B only, A∩C only and A∩B∩C.
Element-wise check: x ∈ A ∩ (B ∪ C) ⇔ x ∈ A and (x ∈ B or x ∈ C) ⇔ (x ∈ A and x ∈ B) or (x ∈ A and x ∈ C) ⇔ x ∈ (A ∩ B) ∪ (A ∩ C).
Example: A = {1, 2, 3}, R = {(a, b) : a < b} = {(1, 2), (1, 3), (2, 3)}. Relations are represented by sets of pairs, matrices or digraphs.
Equivalence relation
- Congruence modulo n on Z: a ≡ b (mod n) — classes [0], [1], …, [n − 1].
- “Is parallel to or equal to” on the set of lines in a plane.
- “Has the same age as” on a set of students.
An equivalence relation partitions A into disjoint equivalence classes [a] = {x : xRa}.
Partial ordering relation
- (Z, ≤) — usual less-than-or-equal relation.
- (Z+, |) — divisibility: 2 | 6, but 2 and 3 are not comparable.
- (P(S), ⊆) — set inclusion on the power set.
Elements a, b are comparable if a ≤ b or b ≤ a. If every pair is comparable the order is a total (linear) order, e.g. (Z, ≤); otherwise it is only partial, e.g. (Z+, |). A poset is represented by a Hasse diagram.
Difference
| Equivalence relation | Partial order | |
|---|---|---|
| Properties | Reflexive, symmetric, transitive | Reflexive, antisymmetric, transitive |
| Idea | “sameness” — groups alike elements | “order / ranking” — compares elements |
| Structure | Partition into classes | Poset, drawn as Hasse diagram |
| Example | a ≡ b (mod 3) | a | b, A ⊆ B, a ≤ b |
| 1 | 2 | 3 | |
|---|---|---|---|
| 1 | 1 | 1 | 0 |
| 2 | 1 | 1 | 0 |
| 3 | 0 | 0 | 1 |
Reflexive
(1,1), (2,2), (3,3) ∈ R — all diagonal entries are 1. ✔
Symmetric
Off-diagonal pairs: (1,2) ∈ R and (2,1) ∈ R; there is no other. The matrix equals its transpose. ✔
Transitive
| (a,b) ∈ R | (b,c) ∈ R | Need (a,c) | In R? |
|---|---|---|---|
| (1,2) | (2,1) | (1,1) | ✔ |
| (2,1) | (1,2) | (2,2) | ✔ |
| (1,2) | (2,2) | (1,2) | ✔ |
| (2,1) | (1,1) | (2,1) | ✔ |
| (1,1) | (1,2) | (1,2) | ✔ |
| (2,2) | (2,1) | (2,1) | ✔ |
Every required pair is present (pairs involving 3 only give (3,3)). ✔
Equivalence classes
[1] = {x : x R 1} = {1, 2}, [2] = {1, 2}, [3] = {3}.
• One-one (injective): f(a1) = f(a2) ⇒ a1 = a2 (distinct elements have distinct images). Example f(x) = 2x + 3 on R.
• Onto (surjective): for every b ∈ B there is a ∈ A with f(a) = b (range = co-domain). Example f(x) = x³ on R.
• Bijective: both one-one and onto. Example f(x) = x + 1 on Z. (f(x) = x² on R is neither one-one nor onto.)
Inverse: g : B → A is the inverse of f if g ∘ f = IA and f ∘ g = IB, i.e. g(f(a)) = a ∀a ∈ A and f(g(b)) = b ∀b ∈ B.
(⇒) If f⁻¹ exists then f is bijective
One-one: f(a1) = f(a2) ⇒ g(f(a1)) = g(f(a2)) ⇒ a1 = a2.
Onto: for any b ∈ B put a = g(b) ∈ A; then f(a) = f(g(b)) = b.
(⇐) If f is bijective then f⁻¹ exists
Define g : B → A by g(b) = that unique a. g is a well-defined function.
Then g(f(a)) = a for all a ∈ A and f(g(b)) = b for all b ∈ B, i.e. g ∘ f = IA, f ∘ g = IB. So g = f⁻¹.
Example: f : R → R, f(x) = 2x + 3 is bijective, f⁻¹(x) = (x − 3)/2. But f(x) = x² on R has no inverse (f(2) = f(−2)).
Generalized: If N objects are placed into k boxes, then at least one box contains at least ⌈N/k⌉ objects.
Proof (by contradiction)
Suppose no box contains more than one object. Then the total number of objects ≤ 1 + 1 + … + 1 (n times) = n. But we have n + 1 objects, and n + 1 > n — a contradiction. Hence at least one box must contain at least two objects.
Generalized form proof: If every box had at most ⌈N/k⌉ − 1 objects, total ≤ k(⌈N/k⌉ − 1) < k(N/k + 1 − 1) = N — contradiction.
Applications / examples
- In a group of 15 people there are 15 objects (people) and 12 boxes (months). Since 15 > 12, at least two people share the same birth month. (Generalized: at least ⌈15/12⌉ = 2.)
- Among any 5 integers, two leave the same remainder when divided by 4 (only 4 remainders).
- If 10 letters are put into 3 mail-boxes, some box gets at least ⌈10/3⌉ = 4 letters.
| p | q | p → q | ¬p | ¬p ∨ q | (p → q) ↔ (¬p ∨ q) |
|---|---|---|---|---|---|
| T | T | T | F | T | T |
| T | F | F | F | F | T |
| F | T | T | T | T | T |
| F | F | T | T | T | T |
Columns p → q and ¬p ∨ q are identical in all four rows (both false only when p = T, q = F). A biconditional of two identical columns is always true.
Let the domain be all people. S(x): “x is a student”; D(x): “x studies Discrete Mathematics”.
Predicate form
(If the domain is taken as the set of students only: ∀x D(x).)
Negation
≡ ∃x ¬(S(x) → D(x)) (¬∀ ≡ ∃¬)
≡ ∃x ¬(¬S(x) ∨ D(x)) (implication law)
≡ ∃x (S(x) ∧ ¬D(x)) (De Morgan)
Let P(n): 1 + 2 + 3 + … + n = n(n + 1)2, n ≥ 1.
Step 1 — Basis (n = 1)
LHS = 1, RHS = 1 × 22 = 1. LHS = RHS, so P(1) is true.
Step 2 — Inductive hypothesis
Assume P(k) is true: 1 + 2 + … + k = k(k + 1)2 …(1)
Step 3 — Inductive step (prove P(k + 1))
= (k + 1)(k2 + 1) = (k + 1)(k + 2)2
which is the formula with n = k + 1. So P(k + 1) is true.
Method: assume the opposite of what is to be proved and derive a contradiction.
Assumption: suppose √2 is rational. Then √2 = pq where p, q are integers, q ≠ 0, and p, q have no common factor (fraction in lowest terms, gcd(p, q) = 1).
So p² is even ⇒ p is even (if p were odd, p² would be odd). Let p = 2k.
Put in (1): 4k² = 2q² ⇒ q² = 2k² ⇒ q² is even ⇒ q is even.
Thus both p and q are even, so 2 is a common factor of p and q. This contradicts our assumption that p and q have no common factor.
Examples: (Z, +), (R − {0}, ×), (Zn, +n) are abelian groups; the symmetric group S3 and the group of invertible 2 × 2 matrices under multiplication are non-abelian.
Theorem: The identity element of a group is unique
Proof: Suppose e and e′ are both identity elements of G.
Since e′ is an identity: e * e′ = e …(2)
From (1) and (2): e = e * e′ = e′
Z8 = {0, 1, 2, 3, 4, 5, 6, 7} under addition modulo 8 — a cyclic group of order 8 generated by 1.
By Lagrange's theorem the order of a subgroup divides 8, so possible orders are 1, 2, 4, 8. In a cyclic group there is exactly one subgroup for each divisor, namely the subgroup generated by a single element.
Cyclic subgroup generated by each element
| Element(s) a | ⟨a⟩ = {0, a, 2a, …} (mod 8) | Order |
|---|---|---|
| 0 | {0} | 1 |
| 1, 3, 5, 7 | {0, 1, 2, 3, 4, 5, 6, 7} = Z8 | 8 |
| 2, 6 | {0, 2, 4, 6} | 4 |
| 4 | {0, 4} | 2 |
e.g. ⟨2⟩: 2, 4, 6, 8 ≡ 0 ⇒ {0, 2, 4, 6}; ⟨6⟩: 6, 12 ≡ 4, 18 ≡ 2, 24 ≡ 0 ⇒ same set; ⟨4⟩: 4, 8 ≡ 0 ⇒ {0, 4}. Each set is closed under +8 and contains inverses.
Examples of FSMs: vending machines, traffic lights, lift controllers, serial adders, lexical analysers.
FSM as a language recognizer
The machine reads an input string one symbol at a time starting from s0. A string x is accepted (recognized) if after reading x the machine is in a final state; otherwise it is rejected. The set of all accepted strings is the language recognized by M, L(M) = {x ∈ I* : f(s0, x) ∈ F}. Languages recognized by FSAs are exactly the regular languages.
Example: FSA that accepts binary strings containing an even number of 1s. States: E (even, initial & final) and O (odd).
| State | Input 0 | Input 1 |
|---|---|---|
| → * E | E | O |
| O | O | E |
Input 1011: E →1 O →0 O →1 E →1 O — ends in O, so rejected (three 1s). Input 1001: E → O → O → O → E — accepted.
Uses: lexical analysers in compilers (recognizing identifiers, keywords, numbers), pattern matching, protocol checking, vending machines.
Input alphabet I = {0, 1}. Accepted language L = {x ∈ {0,1}* : x ends with 01}, e.g. 01, 101, 0001, 11001. The machine only needs to remember how much of the suffix “01” has just been seen.
States
- q0 (start): no useful suffix yet — last symbol was 1 (not preceded by 0) or nothing read.
- q1: the last symbol read was 0 (half of “01” seen).
- q2 (final/accepting): the last two symbols were 0 then 1.
Transition table
| State | Input 0 | Input 1 |
|---|---|---|
| → q0 | q1 | q0 |
| q1 | q1 | q2 |
| * q2 | q1 | q0 |
M = ({q0, q1, q2}, {0, 1}, f, q0, {q2}) with f as in the table.
Traces
- 1101: q0 →1 q0 →1 q0 →0 q1 →1 q2 ⇒ accepted (ends with 01).
- 0110: q0 →0 q1 →1 q2 →1 q0 →0 q1 ⇒ rejected.
- 1001: q0 →1 q0 →0 q1 →0 q1 →1 q2 ⇒ accepted.
Euler circuit: an Euler path that starts and ends at the same vertex. A graph having an Euler circuit is an Euler graph.
Necessary and sufficient conditions (connected graph G, ignoring isolated vertices)
| Undirected graph | Directed graph | |
|---|---|---|
| Euler circuit | Every vertex has even degree | in-degree = out-degree at every vertex |
| Euler path (not circuit) | Exactly two vertices of odd degree — the path starts at one and ends at the other | one vertex out − in = 1 (start), one vertex in − out = 1 (end), all others balanced |
Why necessary: every time the walk passes through a vertex it uses one edge to enter and one to leave, contributing 2 to its degree. In a circuit this holds for every vertex (even the start, whose first exit pairs with the final entry) ⇒ all degrees even. In an open path only the start and end vertices get one unpaired edge ⇒ exactly two odd vertices. Sufficiency is shown constructively by Fleury's / Hierholzer's algorithm.
Examples
The Königsberg bridge graph has 4 vertices of odd degree, so it has neither an Euler path nor an Euler circuit.
Dijkstra's algorithm finds the shortest distance from a source vertex s to every other vertex of a weighted graph with non-negative edge weights. It is a greedy algorithm.
Algorithm
- Set d(s) = 0 and d(v) = ∞ for every other vertex; mark all vertices as temporary (unvisited).
- Choose the temporary vertex u with the smallest d(u) and make it permanent.
- Relax every edge (u, v) with v temporary: if d(u) + w(u, v) < d(v), set d(v) = d(u) + w(u, v) and predecessor(v) = u.
- Repeat steps 2–3 until all vertices are permanent. Trace predecessors back to get each shortest path.
Time complexity: O(V²) with an array, O((V + E) log V) with a binary heap.
Example (no graph was printed, so a standard example is solved)
Source A. Edges: AB = 4, AC = 2, BC = 1, BD = 5, CD = 8, CE = 10, DE = 2, DF = 6, EF = 2.
Each cell shows distance (predecessor); ✔ = already permanent.
| Step | Vertex made permanent | B | C | D | E | F |
|---|---|---|---|---|---|---|
| Initial | — | ∞ | ∞ | ∞ | ∞ | ∞ |
| 1 | A (0) | 4 (A) | 2 (A) | ∞ | ∞ | ∞ |
| 2 | C (2) | 3 (C) | ✔ | 10 (C) | 12 (C) | ∞ |
| 3 | B (3) | ✔ | ✔ | 8 (B) | 12 (C) | ∞ |
| 4 | D (8) | ✔ | ✔ | ✔ | 10 (D) | 14 (D) |
| 5 | E (10) | ✔ | ✔ | ✔ | ✔ | 12 (E) |
| 6 | F (12) | ✔ | ✔ | ✔ | ✔ | ✔ |
Result
| Vertex | Shortest distance from A | Shortest path |
|---|---|---|
| A | 0 | A |
| B | 3 | A → C → B |
| C | 2 | A → C |
| D | 8 | A → C → B → D |
| E | 10 | A → C → B → D → E |
| F | 12 | A → C → B → D → E → F |