Identify and use standard logic gate symbols: AND, OR, NOT, NAND, NOR, XOR

Boolean Logic: Gates & Symbols 🚦

What is Boolean Logic?

Boolean logic is the math behind digital circuits. It uses only two values: True (1) and False (0). Think of it as a light switch that can be either on or off. In computer science, we write these values as 1 and 0 and use symbols like &land; for AND, for OR, and ¬ for NOT.

Logic Gate Symbols & Their Meaning

Below is a quick reference of the most common logic gates. Each gate takes one or more inputs (A, B, etc.) and produces one output (Y). The symbol is the shape you see on circuit diagrams.

Gate Symbol (ASCII) Logical Expression Truth Table
AND A & B Y = A \land B
ABY
000
010
100
111
OR A | B Y = A \lor B
ABY
000
011
101
111
NOT ¬A Y = \lnot A
AY
01
10
NAND A ↑ B Y = \lnot(A \land B)
ABY
001
011
101
110
NOR A ↓ B Y = \lnot(A \lor B)
ABY
001
010
100
110
XOR A ⊕ B Y = (A \lor B) \land \lnot(A \land B)
ABY
000
011
101
110

How to Read a Truth Table

1. List all possible input combinations (for two inputs, there are 4 rows). 2. For each row, calculate the output using the gate’s rule. 3. The final column is the gate’s output.

Analogy: Think of a truth table like a recipe card. The inputs are the ingredients (A, B), and the output is the dish you get. If you change an ingredient, the dish changes according to the recipe (gate rule).

Quick Practice: Identify the Gate

  1. Inputs: A=1, B=0 → Output Y=0. Which gate could this be? 🤔
  2. Inputs: A=0, B=0 → Output Y=1. Which gate matches? 🤔
  3. Inputs: A=1, B=1 → Output Y=0. Identify the gate. 🤔

Answers: 1️⃣ AND, 2️⃣ NOT (when B is ignored), 3️⃣ NAND or NOR (depends on the other input). Use the truth tables to confirm!

Using Gates in a Simple Circuit

Let’s build a tiny “smart light” that turns on only when both the motion sensor (M) and the light sensor (L) are active. That’s an AND gate!

  • M = 1 (motion detected)
  • L = 1 (dark room)
  • Output Light = M ∧ L = 1 → Light turns on.

If either sensor is off, the light stays off. Simple, right? 🎉

Takeaway Summary

  • AND: both inputs must be 1.
  • OR: at least one input is 1.
  • NOT: flips the input.
  • NAND: AND then NOT.
  • NOR: OR then NOT.
  • XOR: outputs 1 only when inputs differ.

Remember: practice by drawing truth tables and sketching simple circuits. The more you play, the easier it becomes! 🚀

Revision

Log in to practice.

1 views 0 suggestions