Sub topic 17
GATE problem patterns and shortcuts
This chapter assumes you can build a truth table, fill a K-map of up to four variables, list prime implicants, and know the NAND/NOR identities from the earlier chapters. Here you learn to recognize the standard question types and to answer them with short calculations before reaching for a full minimization.
The usual question types
GATE questions on this topic fall into a few families. Identify the family first, because each has a fast route.
Counting shortcuts
Many questions need only a formula.
| Quantity | Formula | Example |
|---|---|---|
| Distinct functions of n variables | 2^(2^n) | n = 3 gives 256 |
| Self-dual functions of n variables | 2^(2^(n-1)) | n = 3 gives 16 |
| Minterms covered by a product term with m literals | 2^(n-m) | In 4 variables, `AB'` covers 4 minterms |
| Variables eliminated by a K-map group of size 2^k | k | A quad removes 2 variables |
| Literals in a term from a group of size 2^k | n - k | A quad in 4 variables gives 2 literals |
| Minterms of n-variable XOR (odd parity) | 2^(n-1) | 3 variables gives 4 |
| Completions of a function with d don't-cares | 2^d | 3 don't-cares give 8 functions |
A function is self-dual when complementing every input complements the output. Each of the 2^n rows pairs with its opposite row, so only half the rows are free choices. That is where the exponent n-1 comes from.
You can confirm the self-dual counts by brute force:
from itertools import product
def self_dual_count(n):
rows = list(product([0, 1], repeat=n))
count = 0
for bits in product([0, 1], repeat=2 ** n):
table = dict(zip(rows, bits))
if all(table[tuple(1 - x for x in r)] == 1 - table[r] for r in rows):
count += 1
return count
print([self_dual_count(n) for n in (1, 2, 3)])This prints [2, 4, 16], matching 2^(2^(n-1)).
Minimization patterns
Recognize XOR structure
A parity function has no two adjacent 1-cells on a K-map, so no grouping is possible. Its minimal SOP has one term per minterm, each with all n literals. If a question gives a checkerboard map, the answer is an XOR or XNOR, not a long SOP.
Look for large aligned blocks
Before drawing groups, scan for blocks that depend on only a few variables. For F(A,B,C,D) = Σm(0,2,5,7,8,10,13,15), the cells 0, 2, 8, 10 are the four corners, which form one quad B'D'. The cells 5, 7, 13, 15 form the quad BD. So F = B'D' + BD, which is XNOR of B and D, with 2 terms and 4 literals.
Cyclic maps have no essential prime implicants
Take F(A,B,C) = Σm(0,1,2,5,6,7). The prime implicants are A'B', B'C, A'C', BC', AC, AB. Every minterm is covered by exactly two of them, so none is essential. Two minimal covers exist, each with 3 terms and 6 literals:
A'B' + BC' + ACA'C' + B'C + AB
Questions about this function usually ask for the number of minimal expressions (2), the number of prime implicants (6), or the number of essential ones (0). Do not answer "3 prime implicants" just because the minimal cover has 3 terms. This is the same function the tabular-method code in the earlier chapter produced.
Verify both covers by brute force:
from itertools import product
minterms = {0, 1, 2, 5, 6, 7}
def f(a, b, c):
return int((a << 2 | b << 1 | c) in minterms)
def cover1(a, b, c):
return int((not a and not b) or (b and not c) or (a and c))
def cover2(a, b, c):
return int((not a and not c) or (not b and c) or (a and b))
rows = list(product([0, 1], repeat=3))
print(all(f(*r) == cover1(*r) == cover2(*r) for r in rows))This prints True.
Don't-cares and POS
- For a minimal SOP, treat a don't-care as 1 only if it enlarges a group. Never write a group that contains only don't-cares.
- An essential prime implicant must cover at least one required minterm that no other prime implicant covers. A don't-care alone does not make a prime implicant essential.
- For a minimal POS, group the 0-cells (and useful don't-cares). In each sum term, a variable that is 0 across the group appears uncomplemented, and a variable that is 1 appears complemented.
- Minimal POS of F equals the complement of the minimal SOP of F'. The POS and SOP forms may have different literal counts, so compute whichever the question names.
Redundancy by consensus
In AB + A'C + BC, the term BC is the consensus of the other two and can be dropped. When an expression looks long, test for consensus terms and absorption (A + AB = A) before drawing a map.
Gate-counting patterns
Most gate questions ask for the number of gates of one type, usually NAND or NOR, needed to build a function. Convert the minimal two-level form and count.
| Function | NAND-only | NOR-only |
|---|---|---|
| NOT | 1 | 1 |
| AND | 2 | 3 |
| OR | 3 | 2 |
| XOR | 4 | 5 |
A two-level SOP becomes a NAND-NAND network: one NAND per product term, plus one output NAND. A product term with a single literal needs no first-level gate, since the literal feeds the output NAND directly (complemented if needed). For a POS, the mirror rule gives a NOR-NOR network.
Always read the stated assumption about inputs. If complemented inputs are not available, each complemented variable costs one extra inverter, which is a NAND with its inputs tied together.
The 4-NAND XOR is built as follows: n1 = NAND(a,b), n2 = NAND(a,n1), n3 = NAND(b,n1), out = NAND(n2,n3).
Common errors
- Counting the groups of a non-minimal cover. Always check whether a larger group exists, including wraparound groups across the map edges.
- Forgetting that groups must have size 1, 2, 4, 8, or 16. A group of 3 is not allowed.
- Using Gray-code order wrongly. Rows and columns go 00, 01, 11, 10, so the first and last are adjacent.
- Mixing minterm numbering. With ABCD, A is the most significant bit.
- Answering with the SOP when the question asks for the POS, or the reverse.
Exercise
F(A,B,C,D) = Σm(0,2,5,7,8,10,13,15). How many literals are in its minimal SOP?
Show answer
4. The corner quad B'D' covers minterms 0, 2, 8, 10. The quad BD covers 5, 7, 13, 15. So F = B'D' + BD, which has 2 terms and 2 literals each.
Exercise
How many self-dual Boolean functions of 4 variables exist, and how many Boolean functions of 4 variables exist in total?
Show answer
Self-dual: 2^(2^(4-1)) = 2^8 = 256. Total: 2^(2^4) = 2^16 = 65536.
Exercise
A function of 3 variables has the minimal SOP AB + A'C. How many NAND gates are needed if complemented inputs are not available?
Show answer
5. You need one inverter for A', two first-level NANDs for AB and A'C, and one output NAND, which makes 4. A' is the only complemented literal, so only one inverter is needed, and the total is 1 + 2 + 1 = 4. The answer is 4, not 5.