โšกElectrical Circuits and Systems I

Logic Gate Truth Tables

Study smarter with Fiveable

Get study guides, practice questions, and cheatsheets for all your subjects. Join 500,000+ students with a 96% pass rate.

Get Started

Why This Matters

Logic gates are the fundamental building blocks of every digital system, from simple circuits to complex processors. Understanding them goes beyond memorizing which input combinations produce which outputs. You need to grasp the underlying Boolean algebra principles, gate universality, and how gates combine to perform logical operations. These concepts form the foundation for circuit simplification, combinational logic design, and eventually sequential logic.

The truth tables encode the logical behavior that makes digital electronics predictable and designable. Understanding the relationships between gates lets you analyze circuits quickly and choose the right gate for any application. Don't just memorize the tables; know why each gate behaves the way it does and when you'd reach for one gate over another.


Basic Logic Operations

These three gates represent the fundamental Boolean operations. Every other gate can be built from some combination of AND, OR, and NOT.

AND Gate

The AND gate outputs 1 only when all inputs are 1. Think of it as a "both must be true" check, which makes it perfect for condition-checking circuits.

  • Boolean expression: Aโ‹…BA \cdot B or simply ABAB. The multiplication analogy works well here: any zero input "zeros out" the result.
  • Common uses: enable signals and masking operations where multiple conditions must be satisfied at the same time.
ABAโ‹…BA \cdot B
000
010
100
111

OR Gate

The OR gate outputs 1 when any input is 1. It's the "at least one true" gate, ideal for combining multiple trigger conditions into a single output.

  • Boolean expression: A+BA + B. Think of addition where any nonzero term gives a nonzero result, though 1+1 still equals 1 in Boolean algebra, not 2.
  • Common uses: interrupt handling and any scenario where multiple events should trigger the same response.
ABA+BA + B
000
011
101
111

NOT Gate (Inverter)

The NOT gate outputs the complement of its single input. It's the only basic gate with just one input.

  • Boolean expression: Aโ€พ\overline{A} or Aโ€ฒA'. It simply flips the signal.
  • Essential for generating complementary signals and applying De Morgan's theorem during circuit simplification.
AAโ€พ\overline{A}
01
10

Compare: AND vs. OR. Both take two inputs, but AND needs all inputs high while OR needs any input high. A quick pattern to remember: AND's truth table has three 0s and one 1; OR's has three 1s and one 0. They're almost mirror images of each other.


Universal Gates

A universal gate is one that can, by itself, implement any Boolean function. That means you can build AND, OR, NOT, and every other gate using only NAND gates, or using only NOR gates. This matters for IC design because manufacturing a chip with a single gate type simplifies fabrication.

NAND Gate

The NAND gate outputs 0 only when all inputs are 1. It's literally an AND followed by a NOT, hence "NOT-AND."

  • Boolean expression: Aโ‹…Bโ€พ\overline{A \cdot B}. The output is the inverse of AND for every input combination.
  • Universal gate: you can construct any logic function from NAND gates alone. Building these constructions is a common exam question.
ABAโ‹…Bโ€พ\overline{A \cdot B}
001
011
101
110

To make a NOT gate from a NAND: tie both inputs together. When A=0A = 0, 0โ‹…0โ€พ=1\overline{0 \cdot 0} = 1. When A=1A = 1, 1โ‹…1โ€พ=0\overline{1 \cdot 1} = 0. That's inversion.

NOR Gate

The NOR gate outputs 1 only when all inputs are 0. It's an OR followed by a NOT, hence "NOT-OR."

  • Boolean expression: A+Bโ€พ\overline{A + B}. It produces the complement of OR for every input combination.
  • Also a universal gate. Historically, NOR gates were used exclusively in the Apollo Guidance Computer.
ABA+Bโ€พ\overline{A + B}
001
010
100
110

To make a NOT gate from a NOR: same trick, tie both inputs together. When A=0A = 0, 0+0โ€พ=1\overline{0 + 0} = 1. When A=1A = 1, 1+1โ€พ=0\overline{1 + 1} = 0.

Compare: NAND vs. NOR. Both are universal and both have inverted outputs, but their truth tables are complements. NAND outputs three 1s and one 0; NOR outputs one 1 and three 0s. Know how to build a NOT from each (tie both inputs together), and you'll be set for universality questions.


Exclusive Gates

These gates care about whether inputs match or differ, which makes them essential for comparison operations, arithmetic circuits, and error detection.

XOR Gate (Exclusive OR)

The XOR gate outputs 1 when the inputs are different. Unlike OR, it outputs 0 when both inputs are 1.

  • Boolean expression: AโŠ•BA \oplus B, which expands to ABโ€พ+Aโ€พBA\overline{B} + \overline{A}B. That expanded form spells out exactly what's happening: "A is 1 and B is 0, or A is 0 and B is 1."
  • Critical applications: binary addition (XOR produces the sum bit), parity generators, and comparator circuits.
ABAโŠ•BA \oplus B
000
011
101
110

XNOR Gate (Exclusive NOR)

The XNOR gate outputs 1 when the inputs are the same. It functions as an equality detector.

  • Boolean expression: AโŠ•Bโ€พ\overline{A \oplus B}, which expands to AB+Aโ€พBโ€พAB + \overline{A}\overline{B}. It outputs 1 for matching inputs (both 0 or both 1).
  • Used in error detection, digital comparators, and anywhere you need to verify two signals match.
ABAโŠ•Bโ€พ\overline{A \oplus B}
001
010
100
111

Compare: XOR vs. XNOR are exact complements. XOR asks "are they different?" while XNOR asks "are they the same?" Both output two 1s and two 0s, just in opposite positions. For binary addition, XOR gives you the sum bit; for equality checking, XNOR is your gate.


Quick Reference Table

ConceptBest Examples
Outputs 1 for single conditionAND (all inputs 1), NOR (all inputs 0)
Outputs 0 for single conditionOR (all inputs 0), NAND (all inputs 1)
Universal gatesNAND, NOR
Inverted versionsNAND (inverted AND), NOR (inverted OR), XNOR (inverted XOR)
Difference detectionXOR
Equality detectionXNOR
Single-input operationNOT
Used in binary additionXOR (sum bit), AND (carry bit)

Self-Check Questions

  1. Which two gates are considered universal, and what does "universal" mean in this context?

  2. Compare the truth tables of AND and NAND. How many output values differ between them, and why?

  3. If you need a gate that outputs 1 only when two input signals are different, which gate would you choose? What if you needed the opposite behavior?

  4. Using Boolean expressions, explain why A+Bโ€พ\overline{A + B} and Aโ€พโ‹…Bโ€พ\overline{A} \cdot \overline{B} produce the same truth table. Which theorem does this demonstrate?

  5. You're designing a circuit that should activate an alarm when either sensor A or sensor B detects motion, but not when both detect motion simultaneously. Which single gate implements this logic? Write out the truth table to verify your answer.