Logic Gates
Logic gates are digital circuits whose output, 0 or 1, follows a fixed logical rule of the inputs, written as a truth table or a Boolean expression. NOT, OR and AND are the basic gates; NAND and NOR are universal, because each alone can build every other gate. This page covers digital signals, gate symbols and truth tables, Boolean algebra and De Morgan's theorems, timing diagrams, universal gates, diode logic and ICs. Logic gates give quick, scoring questions in NEET and JEE Main.
- ★ Must learn NOT: ; OR: ; AND:
- ★ Must learn NAND: (0 only when all inputs are 1); NOR: (1 only when all inputs are 0)
- XOR: (1 when the inputs differ); XNOR: (1 when they are equal)
- ★ Must learn De Morgan: and
- Identities: , , , , , , ,
- Absorption: , ,
- ★ Must learn Universal gates: NAND makes NOT ( gate), AND (), OR (); NOR makes NOT (), OR (), AND ()
- A gate with inputs has rows in its truth table
- ★ Must learn Output column for : AND 0001, OR 0111, NAND 1110, NOR 1000, XOR 0110, XNOR 1001
1. Analog and Digital Signals
An analog signal is a voltage or current that varies continuously with time and can take any value in a range (the output of a microphone, a sine wave). A digital signal has only two allowed levels, written with the binary digits 0 and 1. In positive logic the high level, say , is 1 and the low level, , is 0.
A room light is a simple digital system: the switch is either ON or OFF (input) and the lamp is either lit, 1, or dark, 0 (output). Digital circuits built from logic gates run calculators, digital watches, computers, robots, industrial controls and telecommunication systems.
Why only two levels? A circuit only has to decide "high or low", so a noisy or slightly distorted signal (say instead of ) is still read correctly. This noise immunity is the main reason digital electronics replaced analog processing in computers and communication.
2. Logic Gates and Truth Tables
- Logic gate: a digital circuit whose output is related to its inputs by a fixed logical rule. It is called a gate because it controls the flow of information.
- Truth table: lists the output for every combination of inputs; inputs give rows.
- Boolean expression: the same rule in algebra: means OR, means AND and a bar means NOT.
The five common gates are NOT, OR, AND, NAND and NOR; XOR and XNOR are built from them but are asked often enough to learn too. One table holds all of them:
| NOT | OR | AND | NAND | NOR | XOR | XNOR | ||
|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 1 |
- NOT (inverter): one input, one output; it gives the opposite of the input, .
- OR: two or more inputs; if any input is 1, .
- AND: two or more inputs; only if all inputs are 1, .
- NAND (NOT-AND): an AND followed by a NOT; only when all inputs are 1.
- NOR (NOT-OR): an OR followed by a NOT; only when all inputs are 0, that is, neither one input nor the other is 1.
- XOR (exclusive OR): when the inputs are different; XNOR gives 1 when they are equal (an equality detector).
Remember only the odd row. AND is 1 only for 11; OR is 0 only for 00; NAND is 0 only for 11; NOR is 1 only for 00. A bubble flips the whole output column. The same rules hold for 3 or more inputs: a 3-input NAND is 0 only for 111, one row out of 8.
2.1 Switch analogy
Think of a closed switch as 1 and a lit lamp as 1. Switches in series behave as AND, switches in parallel as OR, and a switch connected across the lamp behaves as NOT.
Output 1 for and . Column: 0111. Switches in parallel.
Output 1 for and only; 0 for 11. Column: 0110. .
NAND gate with , : what is ?
Which gate gives 1 only when both inputs are 0?
How many rows does the truth table of a 3-input gate have?
3. Boolean Algebra and De Morgan's Theorems
Boolean algebra (after George Boole) works with variables that can only be 0 or 1. Its rules look like ordinary algebra with a few surprises: in Boolean algebra , because OR only asks whether any input is 1.
| Law | OR form | AND form |
|---|---|---|
| Identity | ||
| Null (dominance) | ||
| Idempotent | ||
| Complement | ||
| Double NOT | ||
| Commutative | ||
| Distributive | ||
| Absorption |
De Morgan's theorems let you move a bar across an operator: break the bar and change the sign.
The first says a NOR gate is an AND gate with inverted inputs; the second says a NAND gate is an OR gate with inverted inputs. Proof of the first by truth table (the last two columns match):
| 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 |
4. Timing (Waveform) Diagrams
Gates also reshape pulse trains. When the inputs are given as waveforms, the output changes only at an instant where some input changes, so the method is always the same:
- Draw a vertical line at every edge of every input and label the instants
- In each interval read and (high , low ).
- Apply the gate's rule to get for that interval.
- Draw as flat segments that change level only at the marked instants.
OR = union, AND = overlap. Shade the high parts of both inputs: the OR output is high wherever any shading exists; the AND output only where the shadings overlap. NAND and NOR are these outputs turned upside down. If one input of a NAND is held at 1, the output is just the other input inverted.
5. Universal Gates: NAND and NOR
NOT, AND and OR together can realise any logic function. A gate that can produce all three by itself is called universal: NAND and NOR are the two universal gates. That is why a chip maker can build a whole processor from one type of gate.
| Gate to build | NAND gates needed | NOR gates needed |
|---|---|---|
| NOT | 1 | 1 |
| AND | 2 | 3 |
| OR | 3 | 2 |
| NAND | 1 | 4 |
| NOR | 4 | 1 |
| XOR | 4 | 5 |
| XNOR | 5 | 4 |
1-2-3, and the names swap. With NAND: NOT 1, AND 2, OR 3. With NOR: NOT 1, OR 2, AND 3. The "own" function (AND for NAND, OR for NOR) needs only 2 gates: the gate plus one more as NOT.
XOR from four NAND gates. Let . Two more NANDs give and , and the fourth gives
Half adder. Adding two bits gives Sum and Carry (for : Sum 0, Carry 1, the binary number 10). One XOR and one AND gate add two bits, which is how arithmetic starts in a processor.
Minimum number of NAND gates for an OR gate? For an AND gate?
How is a NOR gate turned into a NOT gate?
Are XOR or AND gates universal?
6. Identifying Gate Combinations
Most exam questions give a small network of gates and ask which single gate it equals. Label every intermediate output, fill a 4-row truth table, then read the output column. The same few combinations come again and again:
| Circuit | Output | Acts as |
|---|---|---|
| NOR, then NOT | OR | |
| NAND, then NOT | AND | |
| NOT on each input, then NOR | AND | |
| NOT on each input, then NAND | OR | |
| NOT on each input, then AND | NOR | |
| NOT on each input, then OR | NAND | |
| NAND or NOR with inputs joined | NOT | |
| Two NOT gates in series | no change (buffer) |
Bubble pushing. Moving a bubble from the output of a gate to all of its inputs (or the reverse) swaps AND with OR. So an OR gate with bubbles on both inputs is a NAND, and an AND gate with bubbles on both inputs is a NOR. Two bubbles on the same wire cancel.
XOR from basic gates. The expression can be read straight off as a circuit: two NOT gates, two AND gates and one OR gate.
NOT gates on both inputs of an AND gate give which gate?
A NOR gate followed by a NOT gate gives which gate?
Simplify and .
7. Gates from Diodes, and Integrated Circuits
Gates are built from semiconductor devices. The simplest are made of diodes and a resistor (positive logic, and ). In the OR gate, any input at forward biases its diode and lifts the output; the other diode is then reverse biased and isolates its input. In the AND gate, any input at forward biases its diode and pulls the output down; the output stays high only when both inputs are high.
7.1 Integrated circuits (ICs)
- An IC holds many transistors, diodes, resistors, capacitors and their connecting wires on one piece of semiconductor crystal (a chip), made by photolithography. Many logic gates are integrated in one chip.
- The IC was invented by Jack Kilby at Texas Instruments in 1958; he received the Nobel Prize in Physics in 2000. ICs are found in cars, televisions, phones and almost every electrical device.
- A microprocessor is an IC that processes all the information in a computer: keys pressed, programs, games.
- Moore's law (Gordon Moore, co-founder of Intel): the number of transistors on a chip doubles at a steady rate, about every two years, while each transistor gets smaller and cheaper. Moore joked that if cars had improved as fast, a luxury car would travel half a million miles on a gallon and be cheaper to throw away than to park.
8. One-Mark Facts and Revision
| Question | Answer |
|---|---|
| Basic gates | NOT, OR, AND |
| Universal gates | NAND, NOR |
| Gate with one input | NOT (inverter) |
| Rows for inputs | |
| Bubble on a symbol | NOT (inversion) |
| Equality detector | XNOR |
| Positive logic | high (), low () |
| IC inventor | Jack Kilby, Texas Instruments, 1958 (Nobel 2000) |
Use the flowchart for any gate or waveform problem, then the mind map for a last revision.
9. Solved Examples
| Interval | (OR) | ||
|---|---|---|---|
| before | 0 | 0 | 0 |
| to | 1 | 0 | 1 |
| to | 1 | 1 | 1 |
| to | 0 | 1 | 1 |
| to | 0 | 0 | 0 |
| to | 1 | 0 | 1 |
| after | 0 | 1 | 1 |
Answer: is low before and from to , and high in every other interval, as drawn in Figure 4. OR is 0 only where both inputs are 0.
| Interval | (AND) | ||
|---|---|---|---|
| before | 0 | 0 | 0 |
| to | 1 | 0 | 0 |
| to | 1 | 1 | 1 |
| to | 0 | 1 | 0 |
| to | 0 | 0 | 0 |
| to | 1 | 0 | 0 |
| after | 0 | 1 | 0 |
Answer: is high only from to , the one interval where both inputs are high; it is low everywhere else (Figure 4).
| Interval | (NAND) | ||
|---|---|---|---|
| before | 1 | 1 | 0 |
| to | 0 | 0 | 1 |
| to | 0 | 1 | 1 |
| to | 1 | 0 | 1 |
| to | 1 | 1 | 0 |
| to | 0 | 0 | 1 |
| after | 0 | 1 | 1 |
Answer: only before and from to , where ; in the other five intervals (Figure 5).
(a) The NOR output is ; the NOT gate inverts it again:
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 0 | 1 |
(b) The NOR gate receives and :
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 0 | 0 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 | 1 |
Answer: column is OR, and column is AND. By De Morgan, .
A NAND gate with joined inputs gives , a NOT gate.
(a) . Column : AND.
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 | 1 |
(b) Column : OR (De Morgan: ).
Answer: (a) AND, 2 gates; (b) OR, 3 gates (Figure 6).
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 0 | 1 |
For , : , so both inputs of the second gate are 0 and . The other rows follow the same way.
Answer: OR (column ): a NOR gate followed by a NOR used as NOT.
(A) AND
(B) NAND
(C) NOR
(D) XOR
Answer: (C). The output is 1 only when both inputs are 0, the NOR rule . AND would read 0001, NAND 1110 and XOR 0110.
(A) OR
(B) AND
(C) NAND
(D) NOR
Answer: (B). By De Morgan,
Distribute:
Answer: ; the output does not depend on at all. (Shortcut: the distributive law with gives .)
| Interval | (NOR) | ||
|---|---|---|---|
| before | 0 | 0 | 1 |
| to | 1 | 0 | 0 |
| to | 1 | 1 | 0 |
| to | 0 | 1 | 0 |
| to | 0 | 0 | 1 |
| to | 1 | 0 | 0 |
| after | 0 | 1 | 0 |
Answer: the NOR output is the OR output of Figure 4 turned upside down: high only before and from to , where both inputs are 0.
has its anode at and conducts. then has its anode at and its cathode at the output (high), so it is reverse biased and carries no current.
(a) Ideal: and .
(b) Silicon: and .
Answer: (a) , ; (b) , ; only conducts. is still read as logic 1.
NOR is 1 only in the row ; NAND is 0 only in the row .
Answer: NOR output 1 means ; NAND output 0 means . Each gives one unique row, so the inputs are fixed completely.
- Write the truth table of a NAND gate whose two inputs are joined and fed by . Which operation does it perform?Answer: : ; : . It is a NOT gate.
- A NOR gate has its inputs joined. A second circuit sends and through NOR gates with joined inputs and then into a third NOR gate. Identify both operations.Answer: First: NOT. Second: , AND.
- Which gate gives an output 1 only when its two inputs are different?Answer: XOR
- An AND gate is followed by a NOT gate. Find for , and name the combination.Answer: 0; NAND
- Simplify .Answer:
- A 3-input NAND gate: how many rows are in its truth table, and in how many is the output 0?Answer: 8 rows; output 0 only in one row ()
- What is the minimum number of NOR gates needed to make an AND gate?Answer: 3
- In a NAND gate, is held at 1 and is a square wave . What is the output?Answer: : with ,
Common Mistakes to Avoid
- Treating as ordinary addition. In Boolean algebra (OR), not 2.
- Writing . De Morgan: when the bar breaks, the sign changes, so .
- Taking NAND as AND with inverted inputs. , while is NOR.
- Mixing up OR and XOR. They differ only for : OR gives 1, XOR gives 0.
- Missing an edge in a waveform problem. Mark every edge of every input; the output can change only there.
- Using 2 NAND gates for OR or 2 NOR gates for AND. The own function needs 2 gates, the other needs 3 (NAND: AND 2, OR 3; NOR: OR 2, AND 3).
- Calling AND, OR or XOR universal. Only NAND and NOR can build every other gate on their own.
- Ignoring the drop in diode logic with silicon diodes: the OR high level is , and the AND low level is .
Frequently Asked Questions
What is a logic gate?
A logic gate is a digital circuit whose output, 0 or 1, follows a fixed logical rule of its inputs. Its behaviour is given by a symbol, a truth table listing the output for every input combination, and a Boolean expression. The common gates are NOT, OR, AND, NAND and NOR, with XOR and XNOR built from them.
Why are NAND and NOR called universal gates?
NOT, AND and OR together can realise any logic function, and a NAND gate alone can build all three: NOT with one gate, AND with two, OR with three. A NOR gate alone does the same: NOT with one, OR with two, AND with three. So a complete digital system can be made from only NAND or only NOR gates.
What is the difference between OR and XOR gates?
An OR gate gives 1 when at least one input is 1, including when both are 1. An XOR (exclusive OR) gate gives 1 only when the inputs are different, so for both inputs 1 it gives 0. Their output columns for inputs 00, 01, 10, 11 are 0111 and 0110.
What are De Morgan's theorems?
De Morgan's theorems say that the complement of A plus B equals A bar times B bar, and the complement of A times B equals A bar plus B bar. In words: break the bar and change the sign. They show that a NOR gate equals an AND gate with inverted inputs, and a NAND gate equals an OR gate with inverted inputs.
How do you find the output waveform of a logic gate?
Draw a vertical line at every instant where any input changes and label the instants. In each interval read the input levels as 0 or 1, apply the gate's truth table and draw the output as a flat level for that interval. The output can change only at an input edge, which makes the method quick and reliable.
How is an OR gate made from NAND gates?
Invert each input with a NAND gate whose two inputs are joined, then feed A bar and B bar into a third NAND gate. Its output is the complement of A bar times B bar, which by De Morgan's theorem equals A plus B. So three NAND gates make an OR gate, while two NAND gates make an AND gate.
Which logic gate questions come in NEET?
NEET usually asks for the output of a small combination of gates, the gate that matches a given truth table, NAND and NOR as universal gates, and output waveforms for given input pulses. Knowing the output columns of all gates and De Morgan's theorems lets you answer most of these in under a minute.
How are logic gates asked in JEE Main?
JEE Main gives a network of two to four gates and asks for its truth table or the single gate it equals, Boolean simplification with De Morgan's theorems, and timing diagrams. Circuits with NAND or NOR gates wired as inverters, and XOR built from basic gates, are common. Label each intermediate output to avoid errors.
Previous year questions on Logic Gates
21 questions from past papers, each with a step-by-step solution.
- JEE Main 2026 Apr 2 Shift 2, Physics Q5
- JEE Main 2026 Apr 4 Shift 1, Physics Q13
- JEE Main 2026 Apr 5 Shift 1, Physics Q20
- JEE Main 2026 Apr 6 Shift 2, Physics Q18
- JEE Main 2026 Apr 8 Shift 2, Physics Q20
- JEE Main 2026 Jan 21 Shift 1, Physics Q17
- JEE Main 2026 Jan 22 Shift 1, Physics Q9
- JEE Main 2026 Jan 22 Shift 2, Physics Q10
- JEE Main 2026 Jan 23 Shift 2, Physics Q13
- JEE Main 2026 Jan 24 Shift 2, Physics Q14
Show all 21 questions
- JEE Main 2026 Jan 28 Shift 2, Physics Q5
- JEE Main 2025 Apr 2 Shift 2, Physics Q13
- JEE Main 2025 Apr 3 Shift 1, Physics Q3
- JEE Main 2025 Apr 3 Shift 2, Physics Q13
- JEE Main 2025 Apr 4 Shift 1, Physics Q15
- JEE Main 2025 Apr 7 Shift 2, Physics Q11
- JEE Main 2025 Jan 22 Shift 2, Physics Q13
- JEE Main 2025 Jan 24 Shift 2, Physics Q15
- JEE Main 2025 Jan 28 Shift 1, Physics Q13
- JEE Main 2025 Jan 29 Shift 1, Physics Q15
- JEE Main 2025 Jan 29 Shift 2, Physics Q18
Ready to master Electronic Devices?
Take a full mock test, practice concept-by-concept, and get an AI-powered rank prediction — all on Fundamenthol.