Last updated: 2/19/03
Link back to course Welcome...
Worksheet: Truth Tables and Switch Circuits
Truth Tables
A Truth Table shows how the truth or falsehood of a result depends
upon the starting values. In Philosophy and Logic, truth tables are used to
analyze statements such as, "All men are mortal. Socrates is a man.
Therefore Socrates is mortal." Truth Tables apply to computer science
because a bit can be only 0 or 1, just like a statement such as, "All men
are mortal" can only be false or true. The usual convention is 0
corresponds to False while 1 corresponds to True. This is what we wil use here,
although we could just as well choose the opposite. We will first apply Truth
Tables to binary multiplication and addition. Later we will use electric
switches as basic devices or building blocks for computers, and then more
abstract devices known as Logic Gates. In each case, we will fill out Truth
Tables, and then use these Truth Tables to see if such devices correspond to
binary arithmetic.
Truth Table for binary multiplication:
Consider bits A, B and C, where C = A × B.
| A | B | C = A × B |
| 0 | 0 | |
| 0 | 1 | |
| 1 | 0 | |
| 1 | 1 |
This Truth Table summarizes everything about binary multiplication.
Next, consider bits A, B, C and D where C = units bit of A + B and D is the carry bit.
| A | B | C = A × B | D = Carry |
| 0 | 0 | ||
| 0 | 1 | ||
| 1 | 0 | ||
| 1 | 1 |
Switches (there will be a connection)

We start with a simple electrical circuit with a battery, a switch A and a light bulb C,
as in the figure above. The switch "A" shown here in a
"neutral" position, but really cannot stay there except when moving
from one position to the other. The switch has a pivot or joint (the
little circle at the left), two contacts (the upper and lower little circles on the right)
and a switch element (the straight line, which pivots at the joint and is in contact with
either the upper or lower contact).

With the circuit shown, if the switch is up, there is a complete path for the current, the
current flows, and the bulb is on. Test the existence of a complete circuit by starting
out from the "+" battery terminal - the one with the little bump on the end, and
tracing around with your pencil, without picking the pencil up, and
moving only along lines or across the little circles that are the switch
contacts. The switch provides a current path from the pivot to
whichever contact the switching element is touching. Electricity, and your
pencil, can
pass right through the pivot and contacts, but cannot jump between them - it can only take
the path laid out by the switching element. If you can find a complete path with no gaps,
then there is a complete circuit. When there is a complete circuit, current
flows. when current flows the bulb is light. See the shining light marks around
the bulb?

For the circuit shown, if the switch is down, there is no path for the
current, current cannot flow, and the bulb is off. Here, there is a gap when your
pencil
reaches the end of the down-pointing switch; there is no path from there to the rest of
the circuit on the right side.
In binary notation, if switch A is down, we will call that a zero; up and we will call it one. If bulb C is off, we will call that zero; on and we will call it one. We can now turn this into a Truth Table.
| A | C |
| 0 | 0 |
| 1 | 1 |
Fill out the truth table for the switch combination below. Now there are
two switches, A and B, and either one can be up (1) or down (0), for a total of four
combinations. Frequently there are switches at the top and bottom of a set of stairs,
wired in this parallel combination. If the light is off, flipping either switch turns the
light on. Similarly, if it is on, flipping either switch turns it off. NOTE: In this style
of electrical diagram, wires cross without making electrical contact. When you
are tracing the circuit, and you come to a crossing, you cannot turn but must
only continue straight across in your original direction. This is "crossing
without contact."

| A | B | C |
| 0 | 0 | |
| 0 | 1 | |
| 1 | 0 | |
| 1 | 1 |
Now fill out the truth table below for binary addition (C = A + B)
| A | B | C = A + B |
| 0 | 0 | |
| 0 | 1 | |
| 1 | 0 | |
| 1 | 1 |