- [Craig] In this video, we're going to go over truth tables.
Now each time we show you a truth table,
we're going to be showing you the associated logic gate that we introduced in the previous video.
Now remember, the logic gates and the symbols themselves will not be in your exam and are not in the specification,
but hopefully, this will give you a much better understanding of how truth tables work
and will help you to link the knowledge up and thus,
make you better at answering questions in the exam.
(uplifting piano jingle)
So the inputs and outputs from gates and logic circuits can be written in what is known as a truth table.
This is where all the possible inputs are noted and together with the output.
Let's take a look at how we construct these truth tables now for each of the three basic gates.
So we're going to start with the not gate on the left, and you can see here we've labelled up the input.
Well, there's only one input to a not gate,
so we're going to call that A,
and we've got a column for that here in the table underneath column A.
The output for that is, therefore, not A, and that's the second column.
There can only be two possible inputs if we've got a single input, and that's a zero and a one.
We know that if we input a zero that the output is one,
and if we input a one, the output is zero.
So that's the truth table for a not gate showing all the possible inputs and outputs.
Now with an and gate we've got two possible inputs.
So we've got two columns here called A and B
and that means we need more rows in our truth table because there's more combinations.
We could input two zeros, a zero and a one, a one and a zero, or two ones.
And the final column is the output which is the result of A and B.
So if you remember with an and gate,
both the inputs A and B need to be one for the output to be one.
So in this row, the output would be zero, in this row the output would be zero,
in this row, the output would be zero,
but in the final situation where both A and B are one, the output will be one.
In a similar fashion, the or gate has two inputs.
So we've got two columns for A and B and four possible combinations.
Remember with an or gate,
only one of the inputs needs to be on or one for the output to be one.
So in the first row, they're both zero,
so the output is zero.
In the second one, the output is one because at least one of the inputs is a one.
The same is true for the third row and for the fourth row.
So let's get a little bit more complicated now.
So here we have two logic gates joined together in sequence,
we have an or gate,
and then the output from the or gate is fed into one of the inputs of an and gate along with another input.
Now although this can sometimes look daunting at first, it's no more complicated.
The first thing to note is we have three inputs now; A, B and C.
So I've got three columns there, but I've got two outputs.
I've got the output from the or gate which is A or B, and we're going to call that D in green.
And then we've got the output from the final and gate,
which is the result of A or B and the new input from C.
So effectively here I've got five columns.
Now the first thing to do is write all the possible combinations for the three original inputs, A, B and C.
And the best thing to do here is simply to count up in binary.
So you can see I've got nought in the first row,
followed by one in the second row,
then a two, three, four, five, six, and then seven.
So I've gone all the way from nought, nought, nought to one, one, one,
counting up in binary so I can be sure that I've got all the possible valid combinations.
So the first thing I do is just deal with one gate in isolation,
and it's best to start from the left-hand side,
so ignore the and gate completely.
We're just dealing with A and B being our inputs and D being our output.
This is an or gate, so either A or B can be one and our output, D, will be one.
So in these two rows, the output is zero,
in these two rows, B is one, so that's fine, the output is one.
In these two rows, A is one, so the output is one, and these two rows, A and B, are both one.
That's fine for an or gate, so the output is one.
We're now done with the or gate, so we can proceed to the and gate.
So our and gate has two inputs.
It has input C and input D, which is effectively the output from the or gate that we worked out just now,
and remember with an and gate, both inputs C and D need to be one for the output E to be one.
So we have zero and zero, so that'd be a zero.
One and zero would be a zero, zero and one would be a zero,
one and one, both inputs being a one means the output E is a one,
then we have zero, another one,
a zero, and a one.
So although at first it can look a bit daunting,
if you break it down step by step, it really is quite straightforward.
So let's just have a little recap then on the screen for you to take some notes,
these are the three basic gates you need to know about for GCSE and their associated truth tables.
(uplifting piano jingle)