### Truth Tables

Truth tables are used to show the logical outputs of logic gates. When combined together, logic gates are called logic circuits.

Describing logic gates uses a similar process to describing an equation in maths. In fact, the same rules of using brackets are applied.

When resolving your logic circuits, resolve the brackets on the left first, then the middle gate, then the brackets on the right. For example, the logic circuit shown to the left would be written as the following logic equation:

`D = A AND (B OR NOT C)`

Notice that the logic equation appears to be reading the diagram from the right, then from the top to the bottom. The value of D is dependent on what the values of A, B, and C are, and we can show all possible values by creating a truth table.

The first step is to create a column for all the inputs and one for the output, and enough rows to hold all possible values.  The number of rows is calculated at 2^(number of inputs):
 A B C D ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
Once you have created your table, set out the possible combinations of inputs. The process of creating these is called grey code. Start with Column A – add in 0, then 1, then repeat a mirror of that until the column is full like this:
 A B C D 0 ? ? ? 1 ? ? ? 1 ? ? ? 0 ? ? ? 0 ? ? ? 1 ? ? ? 1 ? ? ? 0 ? ? ?
Next, fill in column B but this time use 2 zeros, then 2 ones like this:
 A B C D 0 0 ? ? 1 0 ? ? 1 1 ? ? 0 1 ? ? 0 1 ? ? 1 1 ? ? 1 0 ? ? 0 0 ? ?
Finally, complete Column C by using four zeros, then four ones (notice that we’re increasing by powers of two for each column). Like this:
 A B C D 0 0 0 ? 1 0 0 ? 1 1 0 ? 0 1 0 ? 0 1 1 ? 1 1 1 ? 1 0 1 ? 0 0 1 ?
Now our grey code is in place we can test each of the inputs against our logic circuit. Let’s start with the first line. Because A is part of the AND gate and it is false, then the output cannot be true.
 A B C D 0 0 0 0 1 0 0 ? 1 1 0 ? 0 1 0 ? 0 1 1 ? 1 1 1 ? 1 0 1 ? 0 0 1 ?
Try the rest for yourself, then click the button below to reveal the answer. ​