Latest Update: UPSC CSE 2025 Notification Out!
Computer Knowledge Notes

Logic Gates and Boolean Algebra Notes

Komal Gupta

UPSC Exam Expert & Content Editor

Updated 17 Oct 2026

PDF Notes: Logic Gates and Boolean Algebra Notes

Premium PDF · one-time payment of ₹5 · instant access

Logic gates are the basic building blocks of every digital circuit, from a simple calculator to the most powerful processor. A logic gate takes one or more binary inputs (0 or 1) and produces a single binary output according to a fixed rule. Boolean algebra, developed by the English mathematician George Boole in the mid-19th century, is the mathematics used to describe and simplify these rules. Later, Claude Shannon showed in 1937 that Boolean algebra could be used to design electrical switching circuits, which laid the foundation of digital electronics. Questions on logic gates and truth tables appear in the computer awareness sections of bank, SSC, railway and state exams, and frequently in technical and engineering recruitment tests. This note explains each gate with its truth table, the main Boolean laws and how gates combine to perform arithmetic.

Quick Facts at a Glance

  • Basic gates: AND, OR, NOT.
  • Universal gates: NAND and NOR, because any other gate can be built using only one of them.
  • Exclusive gates: XOR (output 1 when inputs differ) and XNOR (output 1 when inputs are the same).
  • Boolean values: 1 means TRUE (high voltage); 0 means FALSE (low voltage).
  • De Morgan's theorems: NOT(A AND B) = NOT A OR NOT B; NOT(A OR B) = NOT A AND NOT B.

1. Basic Logic Gates

AND Gate

The AND gate gives output 1 only when all inputs are 1. Think of two switches connected in series with a bulb: the bulb glows only if both switches are ON. Boolean expression: Y = A · B (read as "A AND B").

A B A AND B
0 0 0
0 1 0
1 0 0
1 1 1

OR Gate

The OR gate gives output 1 when at least one input is 1. This is like two switches in parallel: the bulb glows if either switch is ON. Boolean expression: Y = A + B.

A B A OR B
0 0 0
0 1 1
1 0 1
1 1 1

NOT Gate (Inverter)

The NOT gate has only one input and gives the opposite value. Input 0 gives 1; input 1 gives 0. Boolean expression: Y = A' (or A with a bar on top).

2. Universal Gates

NAND Gate

NAND means "NOT AND". It gives the opposite of AND: output is 0 only when all inputs are 1; otherwise, it is 1. Expression: Y = (A · B)'.

A B NAND
0 0 1
0 1 1
1 0 1
1 1 0

NOR Gate

NOR means "NOT OR". Output is 1 only when all inputs are 0; otherwise, it is 0. Expression: Y = (A + B)'.

A B NOR
0 0 1
0 1 0
1 0 0
1 1 0

Why Are They Called Universal?

Any logic circuit, including AND, OR and NOT, can be built using only NAND gates, or only NOR gates. For example, connecting both inputs of a NAND gate together produces a NOT gate. This is very useful in chip manufacturing, because building an entire circuit from one type of gate simplifies design and production. Many early computers, including the Apollo Guidance Computer used in the Moon landings, were built mainly from NOR gates.

3. Exclusive Gates

XOR (Exclusive OR)

XOR gives output 1 when the inputs are different, and 0 when they are the same. Expression: Y = A ⊕ B = A'B + AB'.

A B XOR XNOR
0 0 0 1
0 1 1 0
1 0 1 0
1 1 0 1

XNOR (Exclusive NOR)

XNOR is the opposite of XOR. It gives 1 when the inputs are the same. For this reason, it is also called an equality detector.

4. Important Boolean Algebra Laws

Law AND form OR form
Identity A · 1 = A A + 0 = A
Null (domination) A · 0 = 0 A + 1 = 1
Idempotent A · A = A A + A = A
Complement A · A' = 0 A + A' = 1
Double negation (A')' = A
Commutative A · B = B · A A + B = B + A
Associative (A · B) · C = A · (B · C) (A + B) + C = A + (B + C)
Distributive A · (B + C) = A·B + A·C A + (B · C) = (A + B) · (A + C)
Absorption A · (A + B) = A A + A · B = A

5. De Morgan's Theorems

These two theorems, named after the mathematician Augustus De Morgan, are among the most frequently asked results.

  • First theorem: (A · B)' = A' + B'. The complement of a product equals the sum of the complements. In gate terms, a NAND gate equals an OR gate with inverted inputs.
  • Second theorem: (A + B)' = A' · B'. The complement of a sum equals the product of the complements. A NOR gate equals an AND gate with inverted inputs.

A simple way to remember: "break the bar and change the sign".

6. Gates in Action: The Half Adder

Computers add numbers using circuits built from gates. A half adder adds two single bits A and B and produces a sum and a carry. The sum is given by an XOR gate (A ⊕ B) and the carry by an AND gate (A · B). For example, 1 + 1 gives sum 0 and carry 1, which is binary 10. A full adder also accepts a carry from the previous column, and many full adders together can add numbers of any length. This is how the arithmetic logic unit (ALU) inside the CPU performs calculations.

7. Simplifying Boolean Expressions: Worked Examples

Boolean laws let us reduce complex expressions to simpler ones, which means fewer gates, lower cost and faster circuits.

  1. Simplify A + A · B. By the absorption law, A + A·B = A(1 + B) = A · 1 = A.
  2. Simplify A · (A' + B). Distribute: A·A' + A·B = 0 + A·B = A · B.
  3. Simplify (A + B)(A + B'). Using the distributive law in OR form: A + B·B' = A + 0 = A.
  4. Simplify (A' · B')'. By De Morgan's theorem, (A')' + (B')' = A + B.

In exams, such simplification questions usually need only one or two laws. Write the expression, look for a variable combined with its own complement (which gives 0 or 1), or a variable repeated (which can be absorbed), and the answer often appears within a line.

8. Logic Gates in Everyday Technology

Logic gates are not just textbook ideas. A car's seat-belt warning can be described as an AND condition: the alarm sounds when the ignition is ON and the seat belt is NOT fastened. A house burglar alarm is an OR condition: it rings if the door or the window sensor is triggered. A two-way staircase switch, which lets you turn a light on or off from either end, behaves like an XOR gate, because changing either switch changes the light. Modern processors contain billions of transistors arranged into such gates, performing these simple decisions billions of times every second.

9. Practice Questions

  1. What is the output of an AND gate with inputs 1 and 0? Answer: 0.
  2. What is the output of a NOR gate when both inputs are 0? Answer: 1.
  3. What is the output of an XOR gate when both inputs are 1? Answer: 0.
  4. Simplify A + 1. Answer: 1.
  5. Simplify A · A'. Answer: 0.

Memory Tricks for Truth Tables

  • AND: "All or nothing" – output 1 only if all inputs are 1.
  • OR: "Any one is enough" – output 1 if any input is 1.
  • NAND and NOR: Take the AND or OR table and flip every output.
  • XOR: "Odd one out" – output 1 when the number of 1s is odd.
  • XNOR: "Same is 1" – output 1 when both inputs match.

With these five phrases, you can rebuild any truth table in seconds during the exam.

Also note that a gate with n inputs has 2n rows in its truth table: two inputs give 4 rows and three inputs give 8 rows.

Frequently Asked Questions

What is a logic gate?

An electronic circuit that takes one or more binary inputs and produces a single binary output based on a logical rule.

Which are the basic logic gates?

AND, OR and NOT.

Which gates are called universal gates?

NAND and NOR, because any other gate can be built using only one of them.

When does an AND gate give output 1?

Only when all its inputs are 1.

When does an OR gate give output 0?

Only when all its inputs are 0.

What does a NOT gate do?

It reverses the input: 0 becomes 1 and 1 becomes 0.

When does an XOR gate give output 1?

When its two inputs are different.

Which gate is called an equality detector?

The XNOR gate, because it gives 1 when inputs are equal.

Who developed Boolean algebra?

George Boole, an English mathematician, in the mid-19th century.

What does De Morgan's first theorem state?

(A · B)' = A' + B'.

Which gates are used in a half adder?

An XOR gate for the sum and an AND gate for the carry.

How can a NOT gate be made from a NAND gate?

By connecting both inputs of the NAND gate together.

About the Author

Komal Gupta

UPSC Exam Expert & Content Editor

Komal is a senior UPSC exam strategist with 8+ years of experience helping aspirants crack CSE, CDS and NDA exams. She writes in-depth notification breakdowns, exam pattern guides and preparation strategies.