Lesson 2 - Logic Gates
What is a Logical Statement?
A logical statement is any statement that can be assigned a true or false value. Logical statements are much like human language. They are different because logical statements only have one correct interpretation while human language is much more complex and can have a variety of different interpretations. In other words, logical statement work in absolutes, while human language is relative, nuanced, and contains exceptions.

Types of Logical Operators
- AND
- OR
- NOT
Observe the picture above. The logical statement
There is a red flower AND a yellow flower.
has a value of true, because there exists both a red and yellow flower in the image.
However, the statement
There is a red flower AND a blue flower.
is a false statement. In order for the statement to be true, both a red flower AND a blue flower must exist in the image.
The OR operator is true when at least one element in the logical statement is true.
With the example above, the statement
There is a red flower OR a blue flower.
is true.
There is a red flower OR a yellow flower.
is also true.
The NOT operator negates a statement. It switches true statements to false.
It also switches false statements to true.
Continuing with the above example,
There is NOT a blue flower.
is a true statement.
There is NOT a red flower.
is a false statement.
Computer scientist abstract the idea of logic gates to zeros and ones. This way they can represent logical statements using binary, since binary is the language that computers are built on.
| Binary | Words |
|---|---|
| 0 | False |
| 1 | True |
In the world of computing, logic gates are made to compute things, such as adding two number together. We make truth table to easily represent the values of logic gates.
Drawing Logic Circuits
When engineers are planning circuits, they draw diagrams to represent their logic circuits.
AND Diagram

OR Diagram

NOT Diagram

They also attach these circuits to each other to create more complex circuits.
a AND (NOT b) Diagram

Truth Tables
Computer scientists use truth tables to show the outputs of logical gates for all possible inputs. The truth table below represents the statement.
a AND b
a, b are the inputs. The statement returns an output based on the values of the inputs. In other words, output is the evaluation of the logical statement.
Truth Table: a AND b
| a | b | Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Truth Table: a OR b
| a | b | Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Truth Table: NOT a
| a | b | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
Notice that the value of b does not matter for this statement.
We can make logical statements with more than two clauses. These truth tables have more than two input columns.
Truth Table: a AND b AND c
| a | b | c | Output |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
Notice that when we have more clauses, our truth table grows. Precisely, the table will have 2^n rows, where n is the number of clauses.
We can also combine logical operators to make more complicated logical circuits. To keep things neat, it is a good idea to order the inputs to look like increasing binary numbers, as I have below.
Truth Table: a OR (NOT b)
| a | b | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Practice
Draw truth tables for the following logical statements.
(NOT a) AND ba AND (b OR c)(a AND b) OR c(NOT (a AND b)) OR c
See the solutions at the bottom of this page.
Making Logic Gates in Minecraft
In Minecraft, we can simulate the logic circuits that Computer Engineers create. This is done via the Redstone feature of the game.
We place threads of redstone to input into blocks. Then we place a torch on top of the block. The output of the redstone needs to be on the same level as the torch that we placed on top of the block. Doing this will create a NOT gate.
AND in Minecraft

OR in Minecraft

NOT in Minecraft

Aside: More Logical Operators
There are more logic operators than the ones previously described. They include but are not limited to:
NAND (inverse AND – only false when both inputs are true)
| a | b | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
XOR (exclusive or – one or the other, but not both)
| a | b | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Activity 1: Doors with Passwords
Let’s use our knowledge of logical gates to create a door with a password in Minecraft. Select a binary number to use as a password and then use AND gates and NOT gates so that your door only opens when the correct input is entered. (Inputs will be levers)
Activity 2: Multiple Passwords
In the past activity, your door should only open for one specific sequence. Can you make a door that has two passwords? Hint: The door should open when you input your first password OR your second password.
Practice Problem Solutions
Truth Table: a OR (NOT b)| a | b | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
| a | b | c | Output |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
Truth Table: (a AND b) OR c
| a | b | c | Output |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
Truth Table: (NOT (a AND b)) OR c
| a | b | c | Output |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
