Filling-in-truth-tables
Filling-in-truth-tables
Hello and welcome back. In this short video, we're going to have a look at truth tables and
how to fill them in given a logical expression. So just before we do that, let's just quickly
recap what a truth table is. So a truth table is a way to represent the logical relationship
between the propositions or the variables showing the truth or falsity of each combination of
the inputs. And truth tables are commonly used right across computer science and
mathematics, in particular in the design of digital logic circuits and in theoretical
computer science.
So let's consider the following formula. So A or B and not A and B. So we can see from this
formula that there are two variables, the variable A and the variable B. And each of these
variables represents some proposition that is either true or false. Now, because we have
two variables, the truth table that comes from this expression will have four rows.
OK, so let's just start off. So we know that the truth table is going to have four rows. So
what we've got here is we've got the start of a table where the first row represents the
column headings. So we've got a column for the variable A and we've got a column for the
variable B. And the following four rows are all of the combinations that we can have for A
and B. So we've got where A is false and B is false. We've got where A is false and B is
true. The next row is where A is true and the following and B is false. And then we have a
row for where both A and B are true.
So what we're going to do is we're going to grow this truth table one column at a time until
we eventually end up at the complete formula which was A or B and not A and B. OK, so to
do that we're going to have a new column and this column is going to be headed with the
formula A or B. So this is just a straightforward disjunction of the variables A and B. So
starting from the top, A or B well that's false or false, so that will have the value false. The
next row down will be false or true, well, that should be true. The next row is true or false,
so that will be true. And then finally the last row is true or true which will be true.
Now, what we've got here is just the straightforward truth table for the disjunction of two
variables. And this is what you saw earlier in the introduction to the logical
connectives section.
So the next column that we're going to have a look at is going to be the expression A and B,
so this is the conjunction of the variables A and B. So in this first row, what we're going to
have is we're going to take the conjunction or the “and” of the false and false, so that will be
false. The next one is the conjunction of false and true, so that will be false. The next one is
the conjunction of true and false, which will be false. And finally the last row will be the
conjunction of true and true, which is true.
The next column will be the negation of the expression A and B. So all that we're going to
take here is we're going to take whatever value we see in the previous column, the column
with the header A and the B and we're going to take the negation of it. So the negation of
false is true. The next one, the negation of false is true. The negation of false is true again.
And finally for the last row, the negation of true is false.
Now, putting all this together we're looking for the truth values of the expression A or B and
not A and B. So what you can see here is that we've worked out what each of these sub
expressions are. So we've got A or B in the third column and we've got not A and B in the
fifth column. So really all that we have to do to calculate what value should go in each of the
rows for the final column, it’s to take the conjunction or the “and” of the value that's in
column three and the value that's in column five.
So for the top row we have false and true. Well, that should be false. For the next row down
we have true and true, so that will be true. For the next column down we have true and true.
And finally, for the final column we have true and false, which will be false. So we've now
constructed a truth table for the expression A or B and not A and B. You might notice that in
fact this truth table looks very similar to one of the logical connectives that you've already
seen and that is of the exclusive “or”. So if you have a look at the first two columns and the
final column, you'll see that it's essentially an exclusive “or”. And that's because this
expression A or B and not A and B is logically equivalent to the exclusive “or” operator that
you've seen previously.
Let's move onto something a little bit more complicated and perhaps with, well, with more
variables. So we're going to have a look at the expression A and B or C. Now, in this
expression, in this formula, we've got three variables and they are A, B and C. And
consequently the truth table is going to have eight rows. So again, we start off with a
column that represents each of the variables. And the rows are all the combinations of truth
values that we can assign to the variables A, B and C. And again, like we did in the
previous example, we're going to grow this table one column at a time until we reach the
final formula.
So the first column that we're going to have a look at is the expression B or C. So we're
going to take the disjunction of the column headed B and the column headed C. So for the
first row, that's equivalent to saying false or false, and that's going to be false. The next row
is false or true, which is true. The next row is true or false, which is true. The next row is
true or true, which is true. The next row is false or false, that should be false. The following
row is false or true, which is true. The last but one row is true or false, which is true. And
finally, the final row is true or true, which is true.
So now we've got that column calculated, let's move on to the final column, which is going
to be for the overall expression that is A and B or C. Now, because we've already
calculated, we've already evaluated what B or C is. This column is going to contain the
result of taking the conjunction of the column headed A, which is our first column, with the
column headed B or C. So we're going to take the conjunction of the first column and this
column. So now let's have a look at how we can evaluate this column. So for the first row,
this is going to be false, and false, which is false. For the next row down, that will be false,
and true, which is false. For the next row, that will be false, and true, which is false. The
next row is going to be false, and true, which is false. The next row is true, and false, which
is false. The next row is true, and true that should be true. The next row is true, and true,
which is true. And finally, the last row is true, and true, which is true. So we've now
completed the truth table for the expression A and B or C.
So just to summarise, we've figured out how to complete a truth table. So given an
expression, we now know how to complete a truth table for it, and that is we break it down
into each of its sub expressions. We have a column for each of those sub expressions, and
we build the table out one column at a time until we reach the final expression itself. And
truth tables have applications in digital circuit design and in theoretical computer science.