Unit 3: Logic Gates and Recurrence Relations - Subjective Questions
MTH136 — Discrete Structures • Practice Questions with Detailed Answers
20 questions
Define a logic gate. Explain the three basic logic gates (AND, OR, NOT) along with their symbols, Boolean expressions, and truth tables.
A logic gate is a fundamental building block of a digital circuit that performs a basic logical operation on one or more binary inputs to produce a single binary output (0 or 1).
1. AND Gate:
- Output is 1 only when all inputs are 1.
- Boolean expression:
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
2. OR Gate:
- Output is 1 when at least one input is 1.
- Boolean expression:
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
3. NOT Gate (Inverter):
- Output is the complement of the input.
- Boolean expression:
| A | Y |
|---|---|
| 0 | 1 |
| 1 | 0 |
These basic gates form the foundation for building complex digital circuits.
Explain the universal gates (NAND and NOR). Why are they called universal gates? Show how a NOT gate can be implemented using a NAND gate.
Universal Gates are gates from which any other logic gate (AND, OR, NOT) can be constructed. NAND and NOR gates are called universal gates because using only these gates, any Boolean function can be implemented.
NAND Gate:
- It is a combination of AND followed by NOT.
- Boolean expression:
| A | B | Y |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
NOR Gate:
- It is a combination of OR followed by NOT.
- Boolean expression:
| A | B | Y |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
Why Universal?
All three basic gates can be derived from them, reducing manufacturing cost and simplifying circuit design.
NOT gate using NAND:
Connect both inputs of the NAND gate together:
Thus a NAND gate with tied inputs acts as an inverter.
Describe the XOR and XNOR gates. Provide their Boolean expressions, truth tables, and a real-world application of each.
XOR (Exclusive-OR) Gate:
- Output is 1 when the inputs are different.
- Boolean expression:
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Application: Used in half adders and parity generators/checkers.
XNOR (Exclusive-NOR) Gate:
- Output is 1 when the inputs are the same.
- Boolean expression:
| A | B | Y |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Application: Used as an equality detector (comparator) to check if two bits are equal.
What is meant by a combination of logic gates? Draw and explain the logic circuit for the Boolean expression and construct its truth table.
A combination of logic gates refers to interconnecting two or more basic gates to implement a complex Boolean function. The output of one gate serves as the input to another.
Expression:
Circuit Construction:
- Apply inputs and to an OR gate to get .
- Pass through a NOT gate to get .
- Feed both and into an AND gate to get the final output .
A ---\
OR --- (A+B) ---\
B ---/ AND --- Y
C --- NOT --- C' ------/
Truth Table:
| A | B | C | A+B | C' | Y |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 0 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 | 1 |
| 0 | 1 | 1 | 1 | 0 | 0 |
| 1 | 0 | 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 1 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 0 |
Explain how logic gates are implemented using switching circuits. Illustrate the switching circuit representation of AND and OR operations.
A switching circuit is a network of switches (or relays/transistors) that models Boolean logic. Each switch is either closed (ON = 1) allowing current flow, or open (OFF = 0) blocking current. The lamp/output glows only when a complete path exists.
AND Operation (Series Connection):
- Two switches and are connected in series.
- Current flows (output = 1) only when both switches are closed.
- Boolean form:
----[A]----[B]----(Lamp)----
OR Operation (Parallel Connection):
- Two switches and are connected in parallel.
- Current flows (output = 1) when either or both switches are closed.
-
Boolean form:
--[A]--
--| |--(Lamp)--
--[B]--
Key Idea:
- Series = AND (logical multiplication)
- Parallel = OR (logical addition)
This correspondence allows complex Boolean expressions to be realized physically using switches, forming the basis of digital circuit design.
Design a switching circuit for the Boolean expression and simplify it if possible.
Given Expression:
Step 1 — Expand:
Step 2 — Combine the last two terms using :
Simplified Expression:
Switching Circuit for :
- Switches and in series (represents ).
-
This series combination in parallel with switch (represents ).
--[A]--[B]--
--| |--(Lamp)--
----[C]----
Interpretation: The lamp glows when both and are closed, OR when is closed. The simplification reduces the number of switches from the original expression, saving cost and complexity.
Verify De Morgan's theorems using truth tables and explain their significance in the implementation of logic gates.
De Morgan's Theorems state:
Verification of Theorem 1:
| A | B | A+B | ||||
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 1 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 0 | 0 |
Columns for and match. ✓
Verification of Theorem 2:
| A | B | A·B | ||||
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 0 | 0 | 0 | 0 |
Columns match. ✓
Significance:
- Allows conversion between AND/OR forms and NAND/NOR forms.
- Enables implementation of any circuit using only universal gates, reducing cost.
- Essential for Boolean expression simplification and circuit optimization.
Define recursion. Explain the essential components of a recursive definition with the example of the factorial function.
Recursion is a technique in which a function, sequence, or problem is defined in terms of itself — that is, the solution to a larger problem depends on the solutions to smaller instances of the same problem.
Essential Components of a Recursive Definition:
- Base Case (Terminating Condition): One or more starting values that are defined directly without recursion. This prevents infinite recursion.
- Recursive Case (Inductive Step): A rule that defines the function in terms of smaller/previous values of itself.
Example — Factorial Function :
Computation of :
- (base case)
Unwinding: .
Thus recursion breaks a problem into smaller subproblems until reaching a base case, then combines the results.
What is a recurrence relation? Explain its order and degree with suitable examples. Distinguish between linear and non-linear recurrence relations.
A recurrence relation is an equation that recursively defines a sequence, where each term is expressed as a function of one or more of its preceding terms.
General form:
Order: The order of a recurrence relation is the difference between the highest and lowest subscripts of the terms involved. It equals the number of previous terms the current term depends on.
- Example: is of order 2 (depends on and ).
Degree: The degree is the highest power of the terms in the relation.
- Example: has degree 2.
Linear vs Non-Linear Recurrence Relations:
| Basis | Linear | Non-Linear |
|---|---|---|
| Definition | Each term appears only to the first power, no products of terms | Terms appear with powers > 1 or as products |
| Example | or | |
| Solvability | Systematic methods exist | Often difficult, no general method |
Linear recurrence relations with constant coefficients are the most commonly solved type in discrete mathematics.
Distinguish between homogeneous and non-homogeneous recurrence relations. Give two examples of each.
A linear recurrence relation with constant coefficients has the general form:
where are constants and is a function of .
Homogeneous Recurrence Relation:
- The term .
- All terms involve the sequence .
- General form:
Examples:
Non-Homogeneous Recurrence Relation:
- The term .
- Contains an extra function of (constant, polynomial, exponential, etc.).
- General form:
Examples:
Key Difference: The presence of the non-zero function on the right-hand side determines whether the relation is non-homogeneous. Solving non-homogeneous relations requires finding both a homogeneous (complementary) solution and a particular solution.
Explain the general method to solve a linear homogeneous recurrence relation with constant coefficients using the characteristic equation. List all cases of roots.
General Method (Characteristic Equation Method):
Consider a linear homogeneous recurrence relation of order :
Step 1: Assume a solution of the form where .
Step 2: Substitute to obtain the characteristic equation:
Step 3: Solve for the roots .
Step 4: Form the general solution based on the nature of the roots:
Case 1 — Distinct Real Roots:
If are all distinct:
Case 2 — Repeated (Equal) Roots:
If a root has multiplicity , its contribution is:
Case 3 — Complex Roots:
If roots are complex conjugates , write in polar form :
Step 5: Use the initial conditions to determine the constants
This yields the closed-form solution of the sequence.
Solve the recurrence relation with initial conditions and .
Given: , with , .
Step 1 — Characteristic Equation:
Assume :
Step 2 — Solve for roots:
The roots are distinct, so the general solution is:
Step 3 — Apply Initial Conditions:
For :
For :
Step 4 — Solve the system:
From the first equation: .
Substitute: .
Then .
Final Solution:
Verification: ✓, ✓
Solve the recurrence relation with and (repeated roots case).
Given: , with , .
Step 1 — Characteristic Equation:
Step 2 — Solve for roots:
Step 3 — General Solution (repeated root):
For a repeated root of multiplicity 2:
Step 4 — Apply Initial Conditions:
For :
For :
Since : .
Final Solution:
Verification: ✓, ✓, ; check: ✓
Derive the closed-form solution of the Fibonacci sequence defined by with , (Binet's Formula).
Given: , with , .
Step 1 — Characteristic Equation:
Assume :
Step 2 — Solve for roots:
Let:
The roots are distinct, so:
Step 3 — Apply Initial Conditions:
For :
For :
Substitute :
Since :
Step 4 — Final Solution (Binet's Formula):
Verification: , which matches ✓
Solve the recurrence relation with , (complex roots case).
Given: , with , .
Step 1 — Characteristic Equation:
Step 2 — Solve for roots:
Step 3 — Convert to Polar Form:
For : modulus , argument .
General solution for complex conjugate roots:
Step 4 — Apply Initial Conditions:
For :
For :
Since : .
Final Solution:
Explain the iteration (substitution) method for solving recurrence relations. Use it to solve with .
The iteration (substitution) method solves a recurrence relation by repeatedly substituting the recurrence into itself, expanding terms until a pattern emerges, and then expressing the result in closed form (often using known summation formulas).
Steps:
- Write the recurrence and substitute repeatedly.
- Observe the pattern after substitutions.
- Use the base case to terminate.
- Simplify using summation formulas.
Given: , with .
Iteration:
Substituting back:
Continuing until we reach :
Since :
Final Solution:
Verification: , , — matches direct computation. ✓
Formulate and solve the recurrence relation for the Tower of Hanoi problem with disks. Find the closed-form expression for the minimum number of moves.
Problem: Move disks from a source peg to a destination peg using an auxiliary peg, moving one disk at a time, never placing a larger disk on a smaller one.
Formulating the Recurrence:
Let = minimum number of moves for disks.
- Move top disks to auxiliary peg: moves.
- Move the largest disk to destination: move.
- Move the disks from auxiliary to destination: moves.
Solving by Iteration:
Since :
Using the geometric sum :
Final Solution:
Verification: , , ✓
Solve the non-homogeneous recurrence relation with using the method of homogeneous and particular solutions.
Given: , with . Here (a constant), so it is non-homogeneous.
The general solution is .
Step 1 — Homogeneous Solution:
Solve . Characteristic equation: .
Step 2 — Particular Solution:
Since is a constant, assume (a constant).
Substitute into the relation:
So .
Step 3 — General Solution:
Step 4 — Apply Initial Condition:
For : .
Final Solution:
Verification: ✓, ; check: ✓
Compare recursion and iteration as problem-solving techniques. Discuss their advantages and disadvantages.
Recursion solves a problem by having a function call itself with smaller inputs until a base case is reached. Iteration solves a problem by repeating a set of instructions using loops (for, while) until a condition is met.
Comparison Table:
| Basis | Recursion | Iteration |
|---|---|---|
| Definition | Function calls itself | Repetition using loops |
| Termination | Base case | Loop condition |
| Memory | Uses stack; high memory (call stack) | Uses less memory |
| Speed | Slower (function call overhead) | Faster |
| Code Size | Compact, elegant | Usually longer |
| Risk | Stack overflow if base case missing | Infinite loop if condition never false |
Advantages of Recursion:
- Code is clean and elegant for problems naturally defined recursively (factorial, Fibonacci, tree traversal, Tower of Hanoi).
- Reduces the need for complex loop management.
Disadvantages of Recursion:
- Higher memory consumption due to the call stack.
- Slower due to repeated function call overhead.
- Risk of stack overflow for deep recursion.
Advantages of Iteration:
- Efficient in time and space.
- No stack overflow risk.
Disadvantages of Iteration:
- Code can become complex for inherently recursive problems.
Conclusion: Recursion offers clarity and matches recursive problem structures, while iteration offers efficiency. The choice depends on the problem and resource constraints.
Solve the recurrence relation with initial conditions and .
Given: , with , .
Step 1 — Characteristic Equation:
Assume :
Step 2 — Solve for roots:
The roots are distinct, so:
Step 3 — Apply Initial Conditions:
For :
For :
Step 4 — Solve the system:
From the first equation: .
Substitute: .
Then .
Final Solution:
Verification: ✓, ✓, ; check: ✓
Define a logic gate. Explain the three basic logic gates (AND, OR, NOT) along with their symbols, Boolean expressions, and truth tables.
A logic gate is a fundamental building block of a digital circuit that performs a basic logical operation on one or more binary inputs to produce a single binary output (0 or 1).
1. AND Gate:
- Output is 1 only when all inputs are 1.
- Boolean expression:
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
2. OR Gate:
- Output is 1 when at least one input is 1.
- Boolean expression:
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
3. NOT Gate (Inverter):
- Output is the complement of the input.
- Boolean expression:
| A | Y |
|---|---|
| 0 | 1 |
| 1 | 0 |
These basic gates form the foundation for building complex digital circuits.
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →