Skip main navigation

New offer! Get 30% off one whole year of Unlimited learning. Subscribe for just £249.99 £174.99. New subscribers only. T&Cs apply

Find out more

Truth tables: A recap

In this step recap a simple proposition and constructing a truth table.

Recap: a simple proposition

Let’s look again at a simple proposition: “If it rains, then I will stay indoors.”

To see how this compound proposition works we will need two propositions. Let (p) represent the proposition “It rains” and let (q) represent the proposition “I stay indoors”.

We can then use the logical operators that we learned in the previous activity to represent the statement “If it rains, then I will stay indoors”. We can represent the statement as: (p rightarrow q).

The truth table for this proposition would display all possible combinations of the truth values of (p) and (q), along with the resulting truth value of the proposition (p rightarrow q). The truth table is below.

(p) (q) (p rightarrow q)
T T T
T F F
F T T
F F T

From the truth table, we can see that the proposition “If it rains, then I will stay indoors” is true in three out of four possible cases. The truth table allows us to systematically evaluate the proposition’s truth value and to understand the logical behaviour of the compound proposition.

Before we continue, let’s quickly recap truth tables and how to construct them.

Recap: Constructing a truth table

You can construct a truth table by completing the following steps.

  1. Identify the number of propositional variables involved in the compound proposition.
  2. Determine the number of rows required in the truth table based on the number of propositional variables. The number of rows is equal to 2 raised to the power of the number of propositional variables. For example, if there are two variables then there will be four rows ((2^2 = 2times 2)). If there are four variables then there will be 16 rows ((2^4 = 2times 2times 2times 2)).
  3. Create a column for each propositional variable involved in the expression or statement. Label each column with the corresponding variable.
  4. Add an additional column for the final output or truth value of the logical expression or statement.
  5. Fill in the rows of the truth table by systematically evaluating the truth values of each propositional variable for each row. Start by assigning the value ‘true’ (T) to the first half of the rows and ‘false’ (F) to the second half of the rows. Then, alternate the truth values for each variable in subsequent columns to complete the rows.
  6. Apply the logical operators (AND, OR, NOT, etc.) involved in the compound proposition to determine the final output or truth value for each row.
  7. Fill in the final output column with the resulting truth values of the logical expression or statement for each row.
  8. Review the truth table to ensure that it accurately represents the logical behaviour of the expression or statement.

Here is an example of filling in a truth table for the logical expression ((p land q) lor (neg p)). The proposition is made up of two simpler propositions. The two proposition are ((p land q)) and ((neg p)). Each of these propositions should have their own column. The final truth table is shown below.

(p) (q) (neg p) (p land q) ((p land q) lor (neg p))
T T F T T
T F F F F
F T T F T
F F T F T

In this example, we have two propositional variables (p) and (q), and we want to evaluate the truth value of the expression ((p land q) lor (neg p)). We systematically evaluate the truth values of (p) and (q) for each row, apply the logical operators (“and”, “or”, “not”) to determine the final output, and fill in the truth table accordingly.

This article is from the free online

An Introduction to Logic for Computer Science

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now