Logic Gates

Logic gates are fundamental building blocks of digital circuits. They perform basic logical functions based on one or more binary inputs (0 or 1) and produce a single output. Here’s an overview of the most common logic gates:

  1. AND Gate: Outputs 1 only if all inputs are 1. Otherwise, the output is 0.

    • Symbol: A · B

    • Truth table:

      • 0, 0 → 0

      • 0, 1 → 0

      • 1, 0 → 0

      • 1, 1 → 1

  2. OR Gate: Outputs 1 if at least one input is 1. If both inputs are 0, the output is 0.

    • Symbol: A + B

    • Truth table:

      • 0, 0 → 0

      • 0, 1 → 1

      • 1, 0 → 1

      • 1, 1 → 1

  3. NOT Gate: Inverts the input. If the input is 1, the output is 0, and vice versa.

    • Symbol: ¬A

    • Truth table:

      • 0 → 1

      • 1 → 0

  4. NAND Gate: The inverse of an AND gate. It outputs 0 only when all inputs are 1.

    • Symbol: ¬(A · B)

    • Truth table:

      • 0, 0 → 1

      • 0, 1 → 1

      • 1, 0 → 1

      • 1, 1 → 0

  5. NOR Gate: The inverse of an OR gate. It outputs 1 only when all inputs are 0.

    • Symbol: ¬(A + B)

    • Truth table:

      • 0, 0 → 1

      • 0, 1 → 0

      • 1, 0 → 0

      • 1, 1 → 0

  6. XOR Gate (Exclusive OR): Outputs 1 if the inputs are different; otherwise, it outputs 0.

    • Symbol: A ⊕ B

    • Truth table:

      • 0, 0 → 0

      • 0, 1 → 1

      • 1, 0 → 1

      • 1, 1 → 0

  7. XNOR Gate (Exclusive NOR): The inverse of an XOR gate. It outputs 1 if the inputs are the same.

    • Symbol: ¬(A ⊕ B)

    • Truth table:

      • 0, 0 → 1

      • 0, 1 → 0

      • 1, 0 → 0

      • 1, 1 → 1

These gates form the foundation of complex digital systems like computers, where they control the flow of data and perform calculations.