Chapter 8 of 10 · 21 min read

Chapter 6: Logic Gates

What you will learn

  • What digital signals are and how 0 and 1 stand for voltage levels.

  • Symbols, Boolean expressions and truth tables of NOT, OR, AND, NAND and NOR gates.

  • Basic Boolean rules and De Morgan's theorems.

  • Why NAND and NOR are universal gates, and how to build NOT, AND and OR from them.

  • How to find the output of a combination of gates, including from input waveforms.

6.1 Digital signals

A sine wave from the mains can take any value between its peaks. That is an analog signal. A digital signal takes only two levels: HIGH and LOW. A light switch at home is either on or off, never "slightly on".

We write HIGH as 1 and LOW as 0. In many circuits, 1 means about 5 V and 0 means about 0 V.

A logic gate is a circuit with one or more inputs and one output. Its output follows a fixed logical rule. The rule is shown in three ways:

  • a symbol,

  • a Boolean expression,

  • a truth table that lists the output for every input combination. A gate with n inputs has 2ⁿ rows.

6.2 The five basic gates

NOT gate. One input, one output. The output is the opposite of the input. It is also called an inverter.

Y=A‾Y = \overline{A}

OR gate. Output is 1 if at least one input is 1. Think of a room with two doors: you can enter if either door is open.

Y=A+BY = A + B

AND gate. Output is 1 only if all inputs are 1. Think of a bank locker that opens only when both the customer's key and the manager's key are turned.

Y=A⋅BY = A \cdot B

NAND gate. AND followed by NOT. Output is 0 only when all inputs are 1.

Y=A⋅B‾Y = \overline{A \cdot B}

NOR gate. OR followed by NOT. Output is 1 only when all inputs are 0.

Y=A+B‾Y = \overline{A + B}

The "+" here is logical OR, not ordinary addition. So 1 + 1 = 1 in Boolean algebra.

Figure 6.1 · Symbols, Boolean expressions and truth tables of NOT, OR, AND, NAND and NOR
Figure 6.1 · Symbols, Boolean expressions and truth tables of NOT, OR, AND, NAND and NOR

A small circle (bubble) at a gate's output means NOT: NAND is AND with a bubble, and NOR is OR with a bubble.

ABOR (A + B)AND (A·B)NANDNOR
000011
011010
101010
111100

NOT gate: A = 0 gives Y = 1; A = 1 gives Y = 0.

A quick way to remember each gate by its "special row":

GateOutput is different from the other rows when
OROutput 0 only for all inputs 0
ANDOutput 1 only for all inputs 1
NANDOutput 0 only for all inputs 1
NOROutput 1 only for all inputs 0

Worked example 6.1: A gate has truth table outputs 1, 1, 1, 0 for inputs (A, B) = 00, 01, 10, 11. Name the gate.

Solution: The output is 0 only when both inputs are 1. That is the NAND gate.

6.3 Boolean rules you will use

RuleOR formAND form
With 0A + 0 = AA · 0 = 0
With 1A + 1 = 1A · 1 = A
Same variableA + A = AA · A = A
With its complementA + Ā = 1A · Ā = 0
AbsorptionA + A·B = AA·(A + B) = A

Double NOT returns the input: NOT of Ā is A.

De Morgan's theorems. "Break the bar, change the sign."

A+B‾=A‾⋅B‾,A⋅B‾=A‾+B‾\overline{A + B} = \overline{A}\cdot\overline{B}, \qquad \overline{A \cdot B} = \overline{A} + \overline{B}

You can check each by writing out all four rows of a truth table.

6.4 NAND and NOR as universal gates

A gate is universal if NOT, AND and OR can all be built from it alone. Then any digital circuit can be built from that one gate. Factories like this: one type of chip, many uses.

From NAND gates.

  1. NOT: join both inputs of one NAND. Y = NOT(A·A) = Ā. (1 gate)

  2. AND: NAND followed by a NAND wired as NOT. Y = NOT(NOT(A·B)) = A·B. (2 gates)

  3. OR: invert each input with a NAND-NOT, then feed both into a NAND. Y = NOT(Ā·B̄) = A + B by De Morgan. (3 gates)

From NOR gates.

  1. NOT: join both inputs of one NOR. Y = NOT(A + A) = Ā. (1 gate)

  2. OR: NOR followed by a NOR wired as NOT. Y = A + B. (2 gates)

  3. AND: invert each input with a NOR-NOT, then feed both into a NOR. Y = NOT(Ā + B̄) = A·B. (3 gates)

Wanted gateNAND gates neededNOR gates needed
NOT11
AND23
OR32

Worked example 6.2: Show that two NOT gates feeding a NAND gate act as an OR gate.

Solution: The NAND receives Ā and B̄. Its output is

Y=A‾⋅B‾‾=A‾‾+B‾‾=A+BY = \overline{\overline{A}\cdot\overline{B}} = \overline{\overline{A}} + \overline{\overline{B}} = A + B

Check: A = 0, B = 0 gives NAND(1, 1) = 0. Any other input gives at least one 0 into the NAND, so Y = 1. That is OR.

Worked example 6.3: The output of a NOR gate is fed into a NOT gate. What single gate is this?

Solution: Y = NOT(NOT(A + B)) = A + B. It is an OR gate.

6.5 Combinations of gates

To find the output of a circuit:

  1. Label the output of every gate (Y₁, Y₂, …).

  2. Write each one as a Boolean expression of the inputs.

  3. Combine into one expression for Y and simplify if you can.

  4. Make a truth table, or plug in the given inputs.

Worked example 6.4: Find Y = (A + B)·C for A = 1, B = 0, C = 1, and for A = 0, B = 0, C = 1.

Solution: First case: A + B = 1, so Y = 1·1 = 1. Second case: A + B = 0, so Y = 0·1 = 0.

Worked example 6.5: A and B go into an AND gate. Its output and a third input C go into a NOR gate. Write Y and its truth table rows where Y = 1.

Solution: Y = NOT(A·B + C). Y = 1 only when A·B = 0 and C = 0. So Y = 1 for (A, B, C) = (0, 0, 0), (0, 1, 0) and (1, 0, 0). In all other five rows Y = 0.

Worked example 6.6: Over four equal time intervals, input A is 0, 0, 1, 1 and input B is 0, 1, 0, 1. Find the outputs of a NAND gate and a NOR gate.

Solution: Take each interval as one truth table row.

  • NAND: 1, 1, 1, 0.

  • NOR: 1, 0, 0, 0.

In waveform questions, always line up the inputs interval by interval like this.

Worked example 6.7 (NEET-hard): The outputs of a NAND gate and an OR gate, both fed by A and B, go into an AND gate. Find the truth table of the final output.

Solution: Y = NOT(A·B) · (A + B).

ABNANDORY
00100
01111
10111
11010

Output is 1 when the inputs differ. This combination is called the exclusive-OR (XOR) gate.

Worked example 6.8 (NEET-hard): Simplify Y = NOT(A·B) + A.

Solution: By De Morgan, NOT(A·B) = Ā + B̄. So Y = Ā + B̄ + A = (A + Ā) + B̄ = 1 + B̄ = 1. The output is always 1, whatever the inputs.

Quick revision

  • NOT: Y = Ā. OR: Y = A + B. AND: Y = A·B. NAND: Y = NOT(A·B). NOR: Y = NOT(A + B).

  • OR is 0 only for all 0s; AND is 1 only for all 1s; NAND is 0 only for all 1s; NOR is 1 only for all 0s.

  • In Boolean algebra 1 + 1 = 1, A + 1 = 1, A·Ā = 0.

  • De Morgan: NOT(A + B) = Ā·B̄ and NOT(A·B) = Ā + B̄.

  • NAND and NOR are universal gates.

  • NAND: NOT 1, AND 2, OR 3 gates. NOR: NOT 1, OR 2, AND 3 gates.

  • Join both inputs of a NAND or NOR to get NOT.

NEET traps

  • Treating Boolean "+" as ordinary addition and writing 1 + 1 = 2.

  • Mixing up NAND and NOR outputs for the 00 row: both give 1 there; they differ at 01, 10 and 11.

  • Forgetting the small bubble at a gate's output, which means NOT.

  • Swapping the gate counts: OR needs 3 NAND gates but only 2 NOR gates.

  • In waveform questions, shifting one input by an interval while reading.

Practice MCQs: Chapter 6

Level 1: Concept check

1. The output of a two-input AND gate is 1 when (a) any one input is 1 (b) both inputs are 1 (c) both inputs are 0 (d) the inputs differ

2. The Boolean expression for a NOR gate is (a) A + B (b) A·B (c) NOT(A·B) (d) NOT(A + B)

3. A NOT gate has (a) one input and one output (b) two inputs and one output (c) one input and two outputs (d) no inputs

4. The output of a two-input OR gate is 0 when (a) both inputs are 1 (b) any one input is 0 (c) both inputs are 0 (d) the inputs differ

5. The universal gates are (a) AND and OR (b) NAND and NOR (c) NOT and OR (d) AND and NOT

6. For a NAND gate with A = 1 and B = 1, the output is (a) 1 (b) 2 (c) undefined (d) 0

7. In Boolean algebra, A + 1 equals (a) 1 (b) A (c) Ā (d) 0

8. In Boolean algebra, A·Ā equals (a) A (b) 1 (c) 0 (d) Ā

9. The gate whose output is 1 only when both inputs are 0 is (a) AND (b) NOR (c) OR (d) NAND

10. By De Morgan's theorem, NOT(A·B) equals (a) Ā·B̄ (b) A + B (c) A·B (d) Ā + B̄

Level 2: NEET standard

11. A gate gives outputs 0, 1, 1, 1 for inputs (A, B) = 00, 01, 10, 11. It is (a) OR (b) AND (c) NAND (d) NOR

12. A gate gives outputs 1, 0, 0, 0 for inputs 00, 01, 10, 11. It is (a) NAND (b) AND (c) NOR (d) OR

13. A NAND gate with both inputs joined together acts as (a) AND (b) NOT (c) OR (d) NOR

14. Inputs A and B each pass through a NOT gate, and the two outputs feed a NAND gate. The circuit acts as (a) AND (b) NOR (c) NAND (d) OR

15. A NOR gate followed by a NOT gate acts as (a) OR (b) AND (c) NAND (d) NOR

16. An AND gate followed by a NOT gate acts as (a) OR (b) NOR (c) NAND (d) AND

17. For Y = (A + B)·C with A = 0, B = 1, C = 1, the output is (a) 0 (b) 1 (c) 2 (d) undefined

18. The least number of NAND gates needed to make an OR gate is (a) 1 (b) 2 (c) 4 (d) 3

19. The least number of NOR gates needed to make an AND gate is (a) 3 (b) 2 (c) 1 (d) 4

20. Over four intervals, A is 1, 1, 0, 0 and B is 1, 0, 1, 0. The output of a NOR gate is (a) 1, 1, 1, 0 (b) 0, 1, 1, 1 (c) 0, 0, 0, 1 (d) 1, 0, 0, 0

21. The expression NOT(A·B) + A simplifies to (a) A (b) 1 (c) 0 (d) B

22. A and B feed an OR gate. Its output and A feed an AND gate. The final output is (a) B (b) A·B (c) A + B (d) A

Level 3: Challenge

23. The outputs of a NOR gate and an AND gate, both fed by A and B, go into an OR gate. The final output is 1 for (a) (0, 0) and (1, 1) only (b) (0, 1) and (1, 0) only (c) all inputs (d) (1, 1) only

24. The outputs of a NAND gate and an OR gate, both fed by A and B, go into an AND gate. The outputs for (A, B) = 00, 01, 10, 11 are (a) 1, 0, 0, 1 (b) 0, 0, 0, 1 (c) 0, 1, 1, 0 (d) 1, 1, 1, 0

25. NOT(Ā + B) equals (a) Ā·B (b) A·B̄ (c) A + B̄ (d) Ā + B̄

26. The two inputs of a NAND gate are A and Ā. The output is (a) always 0 (b) A (c) Ā (d) always 1

27. For Y = NOT(A·B + C) with A = 1, B = 0, C = 0, the output is (a) 1 (b) 0 (c) A (d) undefined

28. Over four intervals, A is 1, 0, 1, 1 and B is 1, 1, 0, 1. The output of an AND gate is (a) 1, 1, 1, 1 (b) 1, 0, 0, 1 (c) 0, 1, 1, 0 (d) 1, 1, 0, 1

29. Assertion (A): The NAND gate is called a universal gate. Reason (R): NOT, AND and OR gates can all be built using NAND gates alone. (a) Both true, R explains A (b) Both true, R does not explain A (c) A true, R false (d) A false, R true

30. Statement I: The output of a NOR gate is 1 only when all its inputs are 0. Statement II: An OR gate followed by a NOT gate gives an AND gate. (a) Both true (b) Both false (c) I true, II false (d) I false, II true

Answer key with reasons

QAnsReason
1bAND needs all inputs 1.
2dNOR is NOT of OR.
3aInverter has a single input.
4cOR is 0 only when all inputs are 0.
5bAny gate can be built from NAND or NOR alone.
6dNAND is 0 only when all inputs are 1.
7aAnything OR 1 is 1.
8cA and its complement are never both 1.
9bNOR is 1 only for all-zero inputs.
10dBreak the bar, change AND to OR.
11a0 only for 00 means OR.
12c1 only for 00 means NOR.
13bNOT(A·A) = Ā.
14dNOT(Ā·B̄) = A + B.
15aNOT(NOT(A + B)) = A + B.
16cNOT(A·B) is NAND.
17b(0 + 1)·1 = 1.
18dTwo NAND-NOTs on the inputs, then one NAND.
19aTwo NOR-NOTs on the inputs, then one NOR.
20cNOR is 1 only in the last interval (0, 0).
21bĀ + B̄ + A = 1.
22dA·(A + B) = A by absorption.
23aĀ·B̄ + A·B is 1 when inputs are equal.
24cNOT(AB)·(A + B) is XOR.
25bDe Morgan: A·B̄.
26dA·Ā = 0, and NOT(0) = 1.
27aA·B + C = 0, so Y = 1.
28bAND is 1 only where both are 1: intervals 1 and 4.
29aBuilding every basic gate is what makes it universal.
30cOR then NOT gives NOR, not AND.

Chapter 6 revision sheet

One-page summary

  • Digital signals have two levels: 1 (HIGH, true) and 0 (LOW, false). A logic gate gives an output fixed by its inputs.

  • NOT: Y = Ā. Output is the opposite of the input.

  • OR: Y = A + B. Output is 1 if any input is 1.

  • AND: Y = A·B. Output is 1 only if all inputs are 1.

  • NAND: Y = NOT(A·B). Output is 0 only when all inputs are 1.

  • NOR: Y = NOT(A + B). Output is 1 only when all inputs are 0.

  • In Boolean algebra "+" means OR and "·" means AND, so 1 + 1 = 1.

  • Key rules: A + 0 = A, A + 1 = 1, A·0 = 0, A·1 = A, A + A = A, A·A = A, A + Ā = 1, A·Ā = 0, NOT(Ā) = A.

  • Absorption: A + A·B = A and A·(A + B) = A.

  • De Morgan: NOT(A + B) = Ā·B̄ and NOT(A·B) = Ā + B̄ (break the bar, change the sign).

  • NAND and NOR are universal: each alone can build NOT, AND and OR.

  • From NAND: NOT = 1 gate (inputs joined), AND = 2, OR = 3, NOR = 4.

  • From NOR: NOT = 1, OR = 2, AND = 3, NAND = 4.

  • To solve a circuit, write the four input rows and pass them through each gate in turn; match the output column.

  • An n-input gate has 2ⁿ input combinations.

Must-remember table

GateExpressionOutput for AB = 00, 01, 10, 11NAND gates to build
NOTY = Ā1 (A = 0), 0 (A = 1)1
ORY = A + B0, 1, 1, 13
ANDY = A·B0, 0, 0, 12
NANDY = NOT(A·B)1, 1, 1, 01
NORY = NOT(A + B)1, 0, 0, 04
De Morgan 1NOT(A + B) = Ā·B̄——
De Morgan 2NOT(A·B) = Ā + B̄——

Memory aids

  • "OR wants Any, AND wants All": OR gives 1 if any input is 1; AND gives 1 only if all are 1.

  • "NAND = Not All, NOR = Not Any": NAND is 0 only when all inputs are 1; NOR is 1 only when no input is 1.

  • "Break the bar, change the sign": split the long bar over A + B or A·B, and swap + with · (De Morgan).

  • "1-2-3-4 with NAND": NOT, AND, OR, NOR need 1, 2, 3, 4 NAND gates.

  • "0111, 0001, 1110, 1000": output codes of OR, AND, NAND, NOR in the order 00, 01, 10, 11.

Concept connections

  • The diode and switch behaviour that makes a gate physically work comes from Chapter 2 here and from Physics Book 12: Current Electricity.

  • Truth tables and step-by-step logic are the same reasoning used for statement and assertion–reason questions throughout Physics Book 20: Experimental Skills.

  • Counting 2ⁿ input combinations is the same counting as the 2ⁿ gamete types from n heterozygous gene pairs in Biology Book 7: Genetics and Evolution.

Practice MCQs: Chapter 6, Level 4 (new NEET pattern)

31. Match each gate (List I) with its output column for inputs AB = 00, 01, 10, 11 (List II).

  • List I: A. OR · B. AND · C. NAND · D. NOR

  • List II: i. 1, 1, 1, 0 · ii. 0, 1, 1, 1 · iii. 1, 0, 0, 0 · iv. 0, 0, 0, 1

(a) A-iv, B-ii, C-i, D-iii (b) A-ii, B-iv, C-i, D-iii (c) A-ii, B-iv, C-iii, D-i (d) A-i, B-iv, C-ii, D-iii

32. Match each expression (List I) with its simplest form (List II).

  • List I: A. NOT(A + B) · B. NOT(A·B) · C. A + A·B · D. A + Ā

  • List II: i. 1 · ii. A · iii. Ā + B̄ · iv. Ā·B̄

(a) A-iii, B-iv, C-ii, D-i (b) A-iv, B-iii, C-i, D-ii (c) A-ii, B-iii, C-iv, D-i (d) A-iv, B-iii, C-ii, D-i

33. Match each arrangement (List I) with the single gate it acts as (List II).

  • List I: A. A NAND gate with its two inputs joined · B. A NAND gate followed by a NOT gate · C. NOT gates on both inputs, then a NAND gate · D. An OR gate followed by a NOT gate

  • List II: i. NOT · ii. OR · iii. AND · iv. NOR

(a) A-iii, B-i, C-ii, D-iv (b) A-i, B-ii, C-iii, D-iv (c) A-i, B-iii, C-ii, D-iv (d) A-iv, B-iii, C-ii, D-i

34. Match each gate (List I) with the least number of two-input NAND gates needed to build it (List II).

  • List I: A. NOT · B. AND · C. OR · D. NOR

  • List II: i. 3 · ii. 1 · iii. 4 · iv. 2

(a) A-ii, B-iv, C-i, D-iii (b) A-iv, B-ii, C-i, D-iii (c) A-ii, B-i, C-iv, D-iii (d) A-ii, B-iv, C-iii, D-i

35. How many of the following statements are correct?

  • A. NAND and NOR are universal gates.

  • B. A + 1 = 1

  • C. A·0 = A

  • D. A + A = 2A

(a) one (b) two (c) three (d) four

36. Choose the correct set of statements.

  • A. NOT(A + B) = Ā·B̄

  • B. NOT(A·B) = Ā·B̄

  • C. An AND gate with both inputs inverted acts as a NOR gate.

  • D. An OR gate with both inputs inverted acts as a NAND gate.

(a) A and B only (b) B and D only (c) A, C and D only (d) A, B, C and D

37. The inputs are A = 1 and B = 0. How many of the following are correct?

  • A. A AND B = 0

  • B. A NOR B = 0

  • C. A NAND B = 0

  • D. A OR B = 1

(a) one (b) two (c) three (d) four

38. For Y = Ā + B, choose the correct set of statements.

  • A. Y = 0 only when A = 1 and B = 0.

  • B. Y = 1 when A = 0 and B = 0.

  • C. Y = NOT(A·B̄)

  • D. Y = A·B

(a) A, B and C only (b) A and D only (c) B and C only (d) A, B, C and D

39. Over four equal time intervals t₁ to t₄, the input waveforms are A = 0, 1, 1, 0 and B = 0, 0, 1, 1. The output waveform is Y = 1, 1, 0, 1. The gate is

(a) NOR (b) AND (c) OR (d) NAND

40. A circuit has this truth table.

ABY
000
011
101
110

Its Boolean expression is

(a) A·B + Ā·B̄ (b) (A + B)·NOT(A·B) (c) NOT(A + B) (d) A + B

41. Inputs A and B go into a NOR gate. Its output is fed to both inputs of a second NOR gate, whose output is Y. The circuit is equivalent to a single gate, and Y for A = 0, B = 1 is

(a) OR; 1 (b) NOR; 0 (c) AND; 0 (d) NAND; 1

Case for Q42–43. A shop in Lucknow fits an alarm. It should ring (Y = 1) when the door is open (D = 1) and the system is armed (S = 1), or whenever the panic button is pressed (P = 1). So Y = D·S + P.

42. For which input set does the alarm not ring?

(a) D = 1, S = 1, P = 0 (b) D = 0, S = 0, P = 1 (c) D = 1, S = 0, P = 0 (d) D = 1, S = 1, P = 1

43. The least number of two-input NAND gates needed to build this alarm logic is

(a) 2 (b) 5 (c) 4 (d) 3

44. Y = A·B + Ā·B̄ + A·B̄ simplifies to

(a) A + B (b) A + B̄ (c) Ā + B (d) A·B̄

45. For three-input gates, the number of input combinations that give output 1 is, for NAND and for NOR respectively,

(a) 7 and 1 (b) 1 and 7 (c) 4 and 4 (d) 7 and 7

Level 4 answer key

QAnsReason
31bOR 0111, AND 0001, NAND 1110, NOR 1000
32dDe Morgan for A and B; absorption gives A; A + Ā = 1
33cJoined NAND = NOT; NAND then NOT = AND; inverted inputs into NAND = OR; OR then NOT = NOR
34aNOT 1, AND 2, OR 3, NOR 4 (OR plus one more NAND as NOT)
35bA and B true; A·0 = 0 and A + A = A
36cNOT(A·B) = Ā + B̄, so B is false; C and D follow from De Morgan
37cAND 0, NOR 0, OR 1 are right; NAND gives 1 (C false)
38aY is 0 only for A = 1, B = 0; De Morgan: NOT(A·B̄) = Ā + B; A·B differs at A = B = 0
39dA·B = 0, 0, 1, 0; its complement 1, 1, 0, 1 is NAND
40bY = 1 when exactly one input is 1: (A + B) is 1 and NOT(A·B) is 1
41aA NOR with joined inputs is a NOT, so Y = NOT(NOT(A + B)) = A + B; 0 + 1 = 1
42cD·S = 0 and P = 0, so Y = 0; every other set has D·S = 1 or P = 1
43dY = NAND(NAND(D, S), NAND(P, P)): one NAND for D·S, one to invert P, one to combine
44bA·B + A·B̄ = A; then A + Ā·B̄ = A + B̄
45a2³ = 8 rows; NAND is 0 only for 111, NOR is 1 only for 000
21 min left
‹
›