Logic Gates: OR, AND, NOT, NAND, NOR for JEE Main
Reviewed Last updated 2026-11-21. Syllabus topic: Logic gates.
In short. AND: 1 only when both inputs are 1. OR: 1 when either is 1. NOT: inverts. NAND and NOR are the inverted AND and OR. Joining the inputs of a NAND or NOR makes a NOT, and each can build any gate.
- Boolean forms: AND Y = A.B, OR Y = A + B, NOT Y = A-bar, NAND Y = (A.B)-bar, NOR Y = (A + B)-bar.
- Truth tables: write all input combinations (2ⁿ rows) and evaluate gate by gate, from the input side.
- NAND and NOR are universal: joined inputs give NOT; NAND-NAND and NOR-NOR combinations give AND and OR.
- De Morgan laws: (A.B)-bar = A-bar + B-bar and (A + B)-bar = A-bar . B-bar.
- Speed: for a network, find the input combinations that force the output, rather than filling every row.
Syllabus line: Electronic Devices Semiconductors, semiconductor diode: I-V characteristics in forward and reverse bias, diode as a rectifier; I-V characteristics of LED, the photodiode, solar cell, Zener diode, Zener diode as a voltage regulator. Logic gates (OR. AND. NOT. NAND and NOR). (NTA JEE (Main) 2026 syllabus, Physics, Unit 19 (https://jeemain.nta.nic.in/document/syllabus-2026/))
Before you start
Prerequisites
- Semiconductors, p-n junction diode and rectifier: Gates are built from switching devices; the diode as a one-way switch is the simplest idea. Read this first if diode conduction and cut-off are unclear.
- LED, photodiode, solar cell and Zener diode: Not needed for gate algebra, but read it if the whole chapter is on your list.
- Units and dimensions (lesson planned): Gate questions are dimensionless, but timing diagrams use seconds and milliseconds. Read this first if time units slip.
Related topics
- Semiconductors, p-n junction diode and rectifier
- LED, photodiode, solar cell and Zener diode
- Electronic Devices (lesson planned)
The concept step by step
Binary signals and logic levels
A digital signal has only two values: high (logic 1, for example about 5 V in a school circuit) and low (logic 0, about 0 V). A logic gate takes one or more such inputs and gives one output whose value depends only on the present inputs. Gates are described by a truth table, which lists every input combination and the resulting output. With n inputs there are 2ⁿ rows, so two-input gates have 4 rows and three-input networks have 8.
AND, OR and NOT
AND: the output is 1 only when all inputs are 1, written Y = A.B. OR: the output is 1 when at least one input is 1, written Y = A + B. NOT: a single input, the output is the opposite, Y = A-bar. For two inputs, the AND column reads 0, 0, 0, 1 for the rows 00, 01, 10, 11, and the OR column reads 0, 1, 1, 1. A good everyday picture: two switches in series light a lamp only if both are on (AND), in parallel if either is on (OR).
NAND and NOR
NAND is AND followed by NOT: Y = (A.B)-bar, giving 1, 1, 1, 0 for 00, 01, 10, 11. NOR is OR followed by NOT: Y = (A + B)-bar, giving 1, 0, 0, 0. Memory aid: NAND is 0 only when both inputs are 1; NOR is 1 only when both inputs are 0. Joining both inputs of a NAND or NOR to the same signal A gives Y = A-bar, so each acts as a NOT gate.
Building gates from NAND or NOR
NAND is a universal gate. NOT: join the inputs. AND: NAND followed by a NOT made from another NAND. OR: invert both inputs with NOT gates made from NAND, then feed them to a NAND, since (A-bar . B-bar)-bar = A + B. NOR is universal in the same way: NOT by joining the inputs; OR by NOR followed by NOR with joined inputs; AND by inverting both inputs and then using NOR, since (A-bar + B-bar)-bar = A.B. The identities behind this are the De Morgan laws.
Evaluating a gate network
Label each gate output with a letter and work from the inputs to Y. For two or three inputs make the full truth table; for four inputs it is quicker to work backwards from the output: ask which gate output values force Y to 1, then which inputs force those values. Always evaluate NAND and NOR with their inversion included, and keep one column per internal node. A single check row, such as all inputs 0 or all inputs 1, often eliminates three of four options in a multiple-choice item.
Worked examples
Each solution shows the marks every step would earn. The sanity check tests units and size of the answer.
Example 1 (easy)
A NAND gate has inputs A = 1 and B = 1. Find the output (0 or 1).
| Step | Marks |
|---|---|
| NAND is AND followed by NOT. | 1 |
| A.B = 1.1 = 1. | 1 |
| NOT of 1 is 0, so Y = 0. | 1 |
| Total: 3 marks | 3 |
Answer: Y = 0
Fast method: NAND is 0 only for 11.
Sanity check: Cross-check with the table 1, 1, 1, 0: the fourth row (11) is 0. A NAND gate never gives 0 for any other row.
Example 2 (easy)
Both inputs of a NOR gate are joined to a signal A = 0. Find the output.
| Step | Marks |
|---|---|
| With joined inputs the gate sees (0, 0). | 1 |
| NOR(0, 0) = NOT(0 + 0) = NOT 0. | 1 |
| Y = 1: the gate acts as a NOT gate. | 1 |
| Total: 3 marks | 3 |
Answer: Y = 1
Fast method: Joined inputs make a NOT: invert 0 to 1.
Sanity check: Check with A = 1: NOR(1,1) = NOT(1) = 0, so the circuit really inverts the input in both cases.
Example 3 (medium)
Two NOR gates are connected as follows: gate 1 takes inputs A and B and gives P; gate 2 has both inputs joined to P and gives Y. Find the number of input combinations (A, B) for which Y = 1.
| Step | Marks |
|---|---|
| Gate 2 acts as a NOT, so Y = NOT P. | 1 |
| P = NOR(A, B) = NOT(A + B), so Y = A + B. | 1 |
| Y = 1 for the combinations 01, 10 and 11: three combinations. | 1 |
| Total: 3 marks | 3 |
Answer: 3
Fast method: NOR then NOT is OR: three ones in four rows.
Sanity check: Limiting case: for A = B = 0 the NOR gives 1 and the second gate inverts it to 0, so Y = 0 as an OR requires. The count 3 matches the OR column 0, 1, 1, 1.
Example 4 (medium, multi-step)
Three NOR gates are used. Gates 1 and 2 have their inputs joined to A and to B respectively. Their outputs go to the two inputs of gate 3, whose output is Y. Find Y for A = 1, B = 1, and the number of combinations with Y = 1.
| Step | Marks |
|---|---|
| Gate 1 gives A-bar, gate 2 gives B-bar. | 1 |
| Y = NOR(A-bar, B-bar) = NOT(A-bar + B-bar) = A.B by De Morgan law. | 2 |
| For A = B = 1 the output is 1; Y = 1 only for the combination 11, so the count is 1. | 1 |
| Total: 4 marks | 4 |
Answer: Y = 1 for A = B = 1; one combination in all
Fast method: NOR with inverted inputs is AND: only 11 gives 1.
Sanity check: The count 1 matches the AND column 0, 0, 0, 1. Test 01: gate 1 gives 1, gate 2 gives 0, gate 3 gives NOR(1, 0) = 0, consistent with AND.
Example 5 (hard, multi-step)
Four NAND gates are connected: P = NAND(A, B); Q = NAND(A, P); R = NAND(B, P); Y = NAND(Q, R). Find the number of input combinations (out of four) for which Y = 1.
| Step | Marks |
|---|---|
| Evaluate row by row. For 00: P = 1, Q = 1, R = 1, Y = 0. | 1 |
| For 01: P = 1, Q = NAND(0,1) = 1, R = NAND(1,1) = 0, Y = 1. For 10 the result is the same by symmetry: Y = 1. | 2 |
| For 11: P = 0, Q = 1, R = 1, Y = 0. | 1 |
| Y = 1 for the two rows 01 and 10, so the count is 2 (the output is 1 when the inputs differ). | 1 |
| Total: 5 marks | 5 |
Answer: 2
Fast method: Try the rows 00 and 11 first: both give 0. The mixed rows give 1, so the count is 2.
Sanity check: The output is 0 when A = B, so the network is never high for equal inputs; with four rows, two and two is plausible for a network that distinguishes equal from unequal inputs.
Example 6 (hard)
For inputs A, B and C, Y = (A AND B) OR (NOT C). Find the number of input combinations, out of eight, for which Y = 1.
| Step | Marks |
|---|---|
| A AND B = 1 for 110 and 111 (two combinations). | 1 |
| NOT C = 1 for C = 0: 000, 010, 100, 110 (four combinations). | 1 |
| The combination 110 is in both lists; the union has 2 + 4 - 1 = 5. | 2 |
| Y = 1 in 5 of the 8 combinations. | 1 |
| Total: 5 marks | 5 |
Answer: 5
Fast method: Count Y = 0 instead: needs C = 1 and not both A and B: 001, 011, 101 gives 3 zeros, so 8 - 3 = 5.
Sanity check: Counting the zeros gives 3 and the ones 8 - 3 = 5; the two methods agree. Y can never be 1 for C = 1 unless A and B are both 1, so most of the C = 1 rows give 0.
Example 7 (medium)
Input A is high from t = 0 to 2 ms and low from 2 to 4 ms. Input B is high from 1 to 3 ms and low otherwise in the 4 ms window. Find, in ms, the total time for which the output of an AND gate is high in the 4 ms window.
| Step | Marks |
|---|---|
| Divide the window into 1 ms steps. | 1 |
| A is 1 at steps 0-1 and 1-2; B is 1 at steps 1-2 and 2-3. | 1 |
| Both are 1 only in 1-2 ms. | 1 |
| Output high for 1 ms. | 1 |
| Total: 4 marks | 4 |
Answer: 1 ms
Fast method: AND is high only in the overlap of the high intervals: 1 ms to 2 ms.
Sanity check: Units: ms. The overlap cannot exceed the shorter pulse (2 ms), and 1 ms does not. An OR gate for the same inputs would be high for 3 ms (0 to 3), more than the AND, as it must be.
Formulas and units
| Result | Formula | Valid when | Units or note | Worked example |
|---|---|---|---|---|
| AND | Y = A.B; table 0 0 0 1 | not applicable | none (logic) | Example 1 |
| OR | Y = A + B; table 0 1 1 1 | not applicable | none (logic) | Example 2 |
| NOT | Y = A-bar; 0 to 1, 1 to 0 | not applicable | none (logic) | Example 1 |
| NAND | Y = (A.B)-bar; table 1 1 1 0 | not applicable | none (logic) | Example 1 |
| NOR | Y = (A + B)-bar; table 1 0 0 0 | not applicable | none (logic) | Example 2 |
| De Morgan laws | (A.B)-bar = A-bar + B-bar; (A + B)-bar = A-bar . B-bar | not applicable | none (logic) | Example 4 |
| NOT from NAND or NOR | join the two inputs | NAND or NOR with both inputs tied together | none (logic) | Example 2 |
| OR from NAND | NAND(A-bar, B-bar) = A + B (three NAND gates) | not applicable | none (logic) | none |
| Number of table rows | 2ⁿ for n inputs | not applicable | rows | none |
Common mistakes and speed
- Confusing NAND with NOR (1110 versus 1000). Why it tempts: Both are inverted gates and both give 1 for the row 00; the difference lies in the other rows, which are rarely checked.
- Treating (A.B)-bar as A-bar . B-bar. Why it tempts: The bar looks distributive over the product, but De Morgan swaps AND with OR when the bar is moved across.
- Forgetting that a NAND or NOR with joined inputs is a NOT. Why it tempts: Joined inputs look like a mistake or a short circuit, so the gate is evaluated as if it had two independent inputs.
- Forgetting the inversion in NAND or NOR when evaluating a network. Why it tempts: In a five-gate network the AND or OR core is evaluated quickly and the final bar is skipped, giving the complement of the correct output.
- Double-counting a combination when two conditions overlap. Why it tempts: Each condition is counted on its own and the totals are added without checking whether the same row appears in both.
Time per question and fast method
Target: about 60 seconds per question.
Write the output columns of AND, OR, NAND, NOR from memory (0001, 0111, 1110, 1000). For a network, test the rows 00 and 11 first: they usually remove two or three options. For counting questions work backwards from the output value that forces Y.
Recall quiz
Pick an option for each question. Your answers stay on this page and are not sent anywhere.
Score: 0 of 6 correct. Pick an option for each question.
Practice
- Which logic gate gives an output 1 only when both of its inputs are 0? Verified (T1)
- Three NAND gates are connected as follows. Gate 1 has both inputs joined to A. Gate 2 has both inputs joined… Verified (T1)
- In a circuit with inputs A, B and C, a NOR gate takes A and B and gives P. A NAND gate takes B and C and… Verified (T1)
- Four inputs A, B, C and D feed this network. P = NAND(A, B). Q = NOR(C, D). X = NAND(P, Q). Y = NOR(X, C).… Verified (T3)
Previous-year questions
Previous-year questions are not imported yet. Previous-year questions are not imported yet; see the official papers on the NTA site. Official NTA papers page.
Going deeper and revision
Truth tables and Boolean expressions
Two-input tables for the inputs 00, 01, 10, 11: AND gives 0 0 0 1; OR gives 0 1 1 1; NAND gives 1 1 1 0; NOR gives 1 0 0 0; NOT gives 1 for input 0 and 0 for input 1. Boolean algebra rules used in problems: A + A = A, A.A = A, A + A-bar = 1, A.A-bar = 0, A + 0 = A, A.1 = A, A + 1 = 1, A.0 = 0, and double negation (A-bar)-bar = A. The associative, commutative and distributive laws hold, and the dual rule A + B.C = (A + B)(A + C) is also valid. Gates with three inputs extend the same rules: a three-input AND gives 1 only for 111.
De Morgan laws and universality
De Morgan: (A.B)-bar = A-bar + B-bar and (A + B)-bar = A-bar . B-bar. In words: NAND equals OR of the inverted inputs, NOR equals AND of the inverted inputs. These explain why NAND builds OR (invert both inputs, then NAND) and why NOR builds AND. Gate count for building from NAND: NOT 1 gate, AND 2 gates, OR 3 gates. From NOR: NOT 1, OR 2, AND 3. A standard trap is to confuse (A.B)-bar with A-bar . B-bar; test with A = 1, B = 0, where the first is 1 and the second is 0. A truth-table check is always safer than algebra under time pressure.
Gate networks and timing diagrams
In a timing-diagram item the inputs are given as high and low intervals against time. The output of a gate changes only when the inputs change (ideal gates, no delay). Divide the time axis at every input edge, evaluate the gate in each segment, and add up the durations when asked how long the output is high. For example, AND of two pulses is high only during the overlap of the pulses, OR is high during the union and NOR is high only when both inputs are low. For networks, a NOT gate on a pulse swaps the high and low durations within one period. Check that the durations of the high and low segments add up to the total time of the diagram.
Physical realisation and what examiners test
In the syllabus the gates are treated as black boxes with truth tables; simple diode circuits can realise OR and AND with a resistor, and a transistor switch gives NOT, but the paper tests logic behaviour rather than circuit detail. Typical items: identify the gate from its truth table; output of a combination of gates for given inputs; equivalent single gate of a NAND-only or NOR-only network; number of input combinations for which the output is 1; a statement-type question on universal gates; output from a timing diagram. Edge cases: unconnected inputs are not logic 0 in general; two inputs joined together make AND and OR behave like a buffer and NAND and NOR like a NOT. XOR and XNOR are not named in the syllabus, though a four-NAND network may appear as a puzzle in which the output is 1 when the inputs differ.
Memory hook
Suppose the strongroom of a village cooperative bank has two locks, and the manager and the cashier each hold one key.
- If the door opens only when both keys are turned, the door acts as an AND gate: the output is 1 only for input 11.
- If either of two guards at two doors can raise the alarm, the alarm acts as an OR gate: any 1 gives 1.
- A warning lamp that is lit while the door is shut and goes out when it is opened is a NOT gate.
- A lamp that is lit unless both keys are turned is a NAND; a lamp that is lit only when no key is turned is a NOR.
AND needs every input high, OR needs any input high, and NAND and NOR are the same tests with the lamp inverted.
AND: all keys. OR: any key. NAND and NOR: the same, with the lamp reversed.
Revision card
Try to answer each without looking above.
- Write the truth-table columns of AND, OR, NAND and NOR for the rows 00, 01, 10, 11.
- State the two De Morgan laws.
- Show how a NAND gate becomes a NOT gate.
- Build OR from NAND gates and count the gates.
- Explain how to count output-1 rows of a network by working backwards.
- How is an AND gate output read from a timing diagram?
Sources and review
Reviewed Reviewed on 2026-11-20: every number recomputed by code and independently reviewed; textbook section references pending.
- Method: Every number in worked examples, recall checks and notes recomputed by code; claims recomputed independently by a separate verifier run using other numerical methods; textbook section references not yet attached; wording defects found were fixed afterwards and re-linted (code checks re-run) but not re-reviewed by a second run; syllabus scope compared with the NTA JEE Main 2026 syllabus text (by the verifier; see the report)
- Reviewer: independent verifier agent run (not the author)
- Date: 2026-11-20
- Defects found: 1; fixed: 1
- Report: content/reviews/learn8-edv-2026-11-21.md
Textbook section references are not attached to this lesson yet.
Sources used
- Syllabus: NTA JEE (Main) 2026 syllabus, Physics, Unit 19 (https://jeemain.nta.nic.in/document/syllabus-2026/), imported into syllabus/lines/jee-main/2026.json
- NTA JEE (Main) 2026 syllabus, Physics, Unit 19, read for scope
- Scope covers the OR, AND, NOT, NAND and NOR gates named in the syllabus line, with truth tables, universality and gate networks.
- Standard results of school-level semiconductor electronics; no textbook section reference attached yet (to be sourced at verification). Content written fresh for this site.
How labels work: see how answers and lessons are verified. Found a mistake? Use Report an error on any question page.