| English | 意味 |
|---|---|
| logic gate/ˈlɒdʒɪk ɡeɪt/ | 論理ゲート |
| truth table/truːθ ˈteɪbl/ | 真値表 |
| Boolean/ˈbuːlɪən/ | ブール |
| logic expression/ˈlɒdʒɪk ekˈspreʃn/ | 論理式 |
The master's thesis that built the digital world
- In 1937 a 21-year-old student, Claude Shannon, noticed that the on-off relays in telephone exchanges behaved exactly like the true-false algebra George Boole had written a century earlier.
- His thesis showed that any logical statement could be built as a circuit of switches, and any circuit of switches described as a logical statement.
- Every processor made since is a very large number of those switches, arranged into a handful of standard logic gates 逻辑门.
- This lesson is the handful: six gates, their symbols, and their truth tables.
What a logic gate is
- A logic gate is a small circuit that carries out one Boolean 布尔 operation. Every input and every output is either 0 (false, low voltage) or 1 (true, high voltage).
- For each gate you must know three things: its symbol, its function in words, and its truth table 真值表, which lists the output for every combination of inputs.
- Every gate in this course has two inputs except NOT, which has one.

The six gates: a shape for each, and a bubble where the output is inverted
Logic gates
output from the truth table
Toggle A and B through a gate and watch the truth table row light up.
NOT, AND, OR
- NOT inverts its single input: 0 becomes 1 and 1 becomes 0.
- AND outputs 1 only when both inputs are 1.
- OR outputs 1 when at least one input is 1, so it is 0 only when both inputs are 0.
| A | B | A AND B | A OR B |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 |
A NOT gate outputs 1 when its input is 0.
難易度 1/5 · 100 コイン + 今日初回完了時に小ボーナス付与
NOT inverts: 0 → 1 and 1 → 0.
An AND gate outputs 1 when:
難易度 1/5 · 100 コイン + 今日初回完了時に小ボーナス付与
AND outputs 1 only if every input is 1; otherwise 0.
An OR gate outputs 0 only when:
難易度 1/5 · 100 コイン + 今日初回完了時に小ボーナス付与
OR is 1 if at least one input is 1, so it is 0 only when every input is 0.
NAND, NOR, XOR
- NAND is NOT AND: the output is 0 only when both inputs are 1, and 1 otherwise.
- NOR is NOT OR: the output is 1 only when both inputs are 0.
- XOR (exclusive OR, also written EOR) outputs 1 when the inputs are different, and 0 when they are the same.
| A | B | A NAND B | A NOR B | A XOR B |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 0 |
A XOR gate outputs 1 when:
難易度 1/5 · 100 コイン + 今日初回完了時に小ボーナス付与
XOR (exclusive OR) is 1 when the inputs differ (0,1 or 1,0) and 0 when they are the same.
A NAND gate outputs 0 only when:
難易度 1/5 · 100 コイン + 今日初回完了時に小ボーナス付与
NAND = NOT AND, so it is 0 exactly when AND would be 1 (all inputs 1), and 1 otherwise.
A NOR gate with both inputs 0 outputs what value (0 or 1)?
難易度 1/5 · 100 コイン + 今日初回完了時に小ボーナス付与
NOR = NOT OR. OR of (0,0) is 0, so NOR is 1. NOR is 1 only when all inputs are 0.
Worked example: building a truth table
- Task: construct the truth table for a NOR gate.
- Write the input columns A and B and list every combination in binary counting order: 00, 01, 10, 11. Four rows, never three, never repeated.
- Apply the rule to each row. NOR is 1 only when both inputs are 0, so the output column reads 1, 0, 0, 0.
- The order matters for the marks: the examiner compares your output column with the scheme row by row.
Put the rows of a two-input truth table in the order the examiner expects.
難易度 3/5 · 200 コイン + 今日初回完了時に小ボーナス付与
Binary counting order: 00, 01, 10, 11. The output column is then compared with the mark scheme row by row.
Worked example: defining a gate in words
- Task: define the function of an XOR gate.
- The mark-scheme wording: the output is 1 when the inputs are different, or equivalently when exactly one input is 1; the output is 0 when both inputs are the same.
- For NAND: the output is 0 only when both inputs are 1. For NOR: the output is 1 only when both inputs are 0.
- "Only when" and "at least one" are doing the work in these sentences. Leave them out and the definition also describes another gate.
Reading a symbol
- AND has a flat back and a rounded front, like a D. OR has a curved back and a pointed front. XOR is OR with an extra curved line across its inputs.
- A small circle, the bubble, on the output means "invert". AND with a bubble is NAND, OR with a bubble is NOR.
- NOT is a triangle with a bubble: one input, one output.

Flat back for AND, curved back for OR, an extra line for XOR, a bubble for NOT
Match each description of a symbol to its gate.
難易度 2/5 · 140 コイン + 今日初回完了時に小ボーナス付与
The back of the shape says AND or OR; the extra line says exclusive; the bubble says inverted.
Recognising a gate from its output column
- Read the output column from the 00 row down to the 11 row.
- 0 0 0 1 is AND. 0 1 1 1 is OR. 0 1 1 0 is XOR.
- 1 1 1 0 is NAND. 1 0 0 0 is NOR. The inverted gates begin with a 1 where their partner begins with a 0.
For inputs A = 0 and B = 1, which gates output 1? Select all that apply.
難易度 2/5 · 140 コイン + 今日初回完了時に小ボーナス付与
One input is 1, so OR and XOR give 1; both are not 1, so AND gives 0 and NAND gives 1; both are not 0, so NOR gives 0.
Writing the logic expression
- A logic expression 逻辑表达式 writes the gate as words:
X = A AND B,X = A OR B,X = NOT A,X = A NAND B,X = A NOR B,X = A XOR B. - Brackets show which operation happens first when gates are joined:
X = (A AND B) OR C. - The expression, the truth table and the circuit are three views of one function. Next lesson joins the gates into circuits and moves between all three.
A circuit outputs 1 only when both of its inputs are 1. Which logic expression describes it?
難易度 1/5 · 100 コイン + 今日初回完了時に小ボーナス付与
"Only when both" is the AND definition. NAND is its inverse, OR needs only one input, XOR needs them to differ.
Marks that slip away
- XOR is not OR. For inputs 1 and 1, OR gives 1 and XOR gives 0.
- NAND is NOT (A AND B), not (NOT A) AND B. The bubble is on the output.
- Truth-table rows go 00, 01, 10, 11. A table in another order is marked as wrong even when every row is right.
- A NOT gate has one input. Every other gate in this course has exactly two.
You've got it
- a gate does one Boolean operation on inputs of 0 and 1; know each symbol, function and truth table
- AND = both 1 · OR = at least one 1 · NOT = invert · NAND = 0 only when both 1 · NOR = 1 only when both 0 · XOR = inputs differ
- the bubble on a symbol inverts the output; truth tables run 00, 01, 10, 11
- a logic expression writes the same function in words:
X = A NAND B