GoalExplain what a logic gate is and use an AND gate and its truth table.
New words
logic gate · a tiny part of a circuit that takes one or two inputs and gives one outputBoolean value · a value that is only true or false, written as 1 or 0truth table · a table that lists every possible input and the output for eachAND gate · a gate whose output is 1 only when both of its inputs are 1
Explanation
Digital devices make decisions with logic gates. Electricity is either on or off, so it is perfect for binary: on is 1 (true) and off is 0 (false). A logic gate takes one or two inputs and gives one output. Inputs are often named A and B, and the output Z. The gate type decides the output. An AND gate gives 1 only when input A and input B are both 1. In every other case it gives 0. A truth table lists all the input patterns and the output for each. Logic gates are found in lifts, washing machines, traffic lights and phone chargers.
A
B
A and B
1
1
1
1
0
0
0
1
0
0
0
0
Worked examples
A: pitch dry?
B: ten players?
Z: match on?
Meaning
0
0
0
wet and too few: no match
0
1
0
wet: no match
1
0
0
too few players: no match
1
1
1
dry and enough players: match on
A school football match goes ahead only if the pitch is dry (A) AND at least ten players have come (B). Write 1 for yes and 0 for no. The match is only on when both are yes.
Input A and Input B→AND gate→Output Z
A gate is drawn as a box with the inputs on the left and the output on the right. The real symbol is a special shape for each gate, but a labelled box works for planning.
A: break time
B: switch on
Z: bell rings
1
0
0
1
1
1
A school bell rings only if the clock says break time (A) AND the bell switch is on (B). With A = 1 and B = 0 the output is 0, so the bell stays quiet, even though it is break time.
Class activity
Gate game (no computer): make two cards, A and B, with 1 on one side and 0 on the other. Write the rule ‘Z = 1 only if A = 1 and B = 1’. Your partner turns the cards in secret, shows them and you call the output of an AND gate. Do eight rounds and write the results in a truth table. Then think of a real decision that needs two things, such as ‘I can go cycling if the bike is ready AND an adult is with me’. Write it as A, B and Z. If you have a computer or tablet, an adult can help you check your truth table with a spreadsheet.
Practice
1
Cover the table at the top of the lesson. Now complete the truth table for an AND gate from memory.
A
B
Z
0
0
?
0
1
?
1
0
?
1
1
?
0 AND 0 = 0, 0 AND 1 = 0, 1 AND 0 = 0, 1 AND 1 = 1. Only the last row has an output of 1.
2
A greenhouse door unlocks if the code is right (A) AND the card is valid (B). A = 1 and B = 0. Is the door unlocked? Explain.
No. Z = 1 AND 0 = 0, because an AND gate needs both inputs to be 1, so the door stays locked.
3
Write one decision of your own that works like an AND gate. Name A, B and Z.
A sensible answer, for example: I can paint (Z) if I have paper (A) AND I have a brush (B).
4
True or false: an AND gate gives 1 when at least one input is 1. Explain.
False. That describes an OR gate. An AND gate needs both inputs to be 1.