2.1.12
Construct truth tables using the above operators. (AND, OR, NOT, NAND, NOR and XOR)
Teaching Note:
For example, Maria wonâ€™t go to school if it is cold and raining or she has not done her homework.
Not more than three inputs are used.
LINK Thinking logically.
TOK Reason as a way of knowing.
Sample Question:
The last assessment statement was aimed at defining, as a dictionary would, AND, OR etc. logic gates. This assessment statement is about visually showing all the possible outputs of particular logic gates, depending on the inputs. We do so via "truth tables".
When there are only two possible boolean inputs, that makes for four possible variations of inputs.
The four possible inputs with two boolean on/off switches or states are:
At this point it would be a good idea to at least take a peak at circuit diagrams to make the connection between truth tables and circuits.
In context of circuits/transistors  In context of programming conditional block  The general way of defining the inputs  
Input 
Input 
Input 
Input 
Input 
Input 

1st possible combo:  off  off  false  false  0  0  
2nd possible combo:  off  on  false  true  0  1  
3rd possible combo:  on  off  true  false  1  0  
4th possible combo:  on  on  true  true  1  1 
We can show these facts in summary form with simple "truth tables"
The diagram below shows the AND and OR truth tables, and also their equivalent circuit representations.
Here are the boolean operation symbols we use in truth tables:
AND: a thick dot
OR: a + sign
NOT: a line over top
XOR: a + with a circle around it
Note that when doing "two step" tables like below, for example getting to NAND from AND, or NOR from OR, it's alway best to explicitly show the first step in a column of its own (rather than just do the intermediate step in your head.)
AND and NAND Truth Tables
A 
B 


0 
0 
0 
1 
0 
1 
0 
1 
1 
0 
0 
1 
1 
1 
1 
0 
OR and NOR Truth Tables
A 
B 


0 
0 
0 
1 
0 
1 
1 
0 
1 
0 
1 
0 
1 
1 
1 
0 
OR and XOR Truth Tables
A 
B 

AB 
0 
0 
0 
0 
0 
1 
1 
1 
1 
0 
1 
1 
1 
1 
1 
0 
NOT Truth Table
A 
_ A 
0 
1 
1 
0 
When there are three possible boolean inputs, that makes for eight possible variations.
The eight possible inputs with three boolean on/off switches or states are:
We typically write these eight combinations for our threeinput truth tables as follows:
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
There is a trick to writing down all these eight combinations correctly, and in conventional order.
Step 1: first write, down the page 4 zeros and 4 ones:
0
0
0
0
1
1
1
1
Step 2: then, beside the 2 zeros and 2 ones, like this:
0 0
0 0
0 1
0 1
1 0
1 0
1 1
1 1
Step 3: and then, beside those, alternating 1s and 0s, like this:
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
In terms of exercises that get you to construct truth tables, you could be asked to reproduce any of the two input truth tables above, or you could be asked to construct a truth table for a particular three input situation. For example, "Construct a truth table to show the various outputs of the following ciruit: A and B or C".
The goal is to show the outputs for each of the eight possible inputs. Even without the inclusion of parentheses and NOT operators, there will be at least two steps to solve each exercise, but there may be as many as three or four steps (see examples below).
You'll need to keep in mind order of operations, as you go step by step through these.
Boolean Order of Operations
The goal with these is to show, via a truth table, the expected outputs based on each of the eight possible inputs.
For example, below, for A and B or C, if the three inputs are all off, then the outpout is off, whereas if A and B are off, but C is on, there will be current comming out the other end. And so on.
For each of these, you take them one step at a time, following the order of operations. So in the below case, you do A or B first, due to the parentheses, and then you do ***that result*** and C. That gives you your final set of results.
With a NOT thrown in, in the example below, it will be the first thing evaluated. Then, it's the A and B. So finally the result of A and B is combined through OR with the NOT C result.
With the next example, the NOT is done first, but to know what to negate, we need to solve A OR B.