You're offline — cached pages and worlds still work

Logic Gates & Switches

Introduction to Boolean logic AND, OR, NOT. Aligned with Logic Gates simulator.

Logic Gates & Switches

Logic Gates & Switches

What you'll learn

  • Understand logic gates as fundamental building blocks of digital circuits.
  • Learn truth tables for AND, OR, NOT, NAND, NOR, XOR gates.
  • See how logic gates relate to switches in circuits.
  • Understand Boolean algebra basics.

Key concepts

What is a Logic Gate?

A logic gate is an electronic circuit that performs a logical operation on one or more binary inputs (0 or 1) to produce a single binary output.

  • Input/Output: 0 (LOW, false) or 1 (HIGH, true)
  • Gates are built from transistors acting as switches.

The 7 Basic Gates

NOT Gate (Inverter)

Input AOutput
01
10

Symbol: A → [NOT] → Ā (A-bar)

AND Gate

ABOutput (A·B)
000
010
100
111

Output is 1 only when all inputs are 1.

OR Gate

ABOutput (A+B)
000
011
101
111

Output is 1 when at least one input is 1.

NAND Gate (NOT AND)

Output = complement of AND. Universal gate — can build all other gates.

ABOutput
001
011
101
110

NOR Gate (NOT OR)

Output = complement of OR. Also a universal gate.

ABOutput
001
010
100
110

XOR Gate (Exclusive OR)

Output is 1 when inputs are different.

ABOutput (A⊕B)
000
011
101
110

XNOR Gate

Output is 1 when inputs are the same. Complement of XOR.

Switches and Logic Gates

A transistor acts like a switch:

  • Base = input signal
  • 0V at base → transistor OFF → output HIGH (1) — this is a NOT gate behaviour
  • 5V at base → transistor ON → output LOW (0)

Two transistors in series (both must be ON) → AND logic Two transistors in parallel (either ON) → OR logic

Boolean Algebra Laws

LawExpression
IdentityA + 0 = A; A · 1 = A
NullA + 1 = 1; A · 0 = 0
ComplementA + Ā = 1; A · Ā = 0
De Morgan's 1(A·B)' = A' + B'
De Morgan's 2(A+B)' = A' · B'

Applications

SystemLogic Gates Used
CalculatorAdder circuits (XOR + AND)
Memory (RAM)NAND flip-flops
CPU operationsAND/OR/NOT for ALU
Security (locks)AND gates (all conditions must be met)

Quick check

  • Write the truth table for a 2-input AND gate.
  • What makes NAND a universal gate?
  • Using De Morgan's theorem, simplify (A + B)'.
  • What is the output of XOR when both inputs are 1?
  • How does a transistor act as a switch in a logic gate?

Open the Practice tab for graded questions on Logic Gates & Switches.

Key Takeaways (TL;DR)

  • What you'll learn
  • Key concepts
  • Quick check

Master this topic with Drishti OS

Get unlimited mock tests, AI-powered mentorship, and complete video courses when you join.

Start Free Practice