Introduction to Logic: Part 2 : Constructing Truth Tables

This article continues assuming you've read the Introduction to Logic: Part 1, where we discussed negation, conjunction, and disjunction statements.

Truth Table Construction

We read that each of the previous statements have their own truth table. A truth table is a visual tool that helps us see the logical outcomes of every possible combination of statements. For the following example, let p,q, and r be statements.
p && [(q || r) && (r || p)]

Number of combinations

The total number of possible outcomes is equal to 2^n, where n is equal to the number of statements. In this example we have three statements in the form of p, q, and r. Thus the number of combinations is 2^3, or 8.

Organizing the table

When creating the truth table, it's extremely important that you keep it organized. My method for constructing organized truth tables is:
  • Begin with statements themselves
  • Place the simplest compound statements to the left of the table, and move progressively to the more complex compound statements
So for our example of p && [(q || r) && (r || p)], here's how you should construct the truth table:
p q r q || r r || p (q || r) && (r || p) p && [(q || r) && (r || p)]
Note that the last column will always end up being the original series of statements. So the first thing we must do is populate the p,q, and r columns with all the possible combinations of True and False. There is a simple pattern you can follow that makes populating these columns extremely easy. In this example, we have 8 combinations since we have 3 statements. For one statement column, alternate between True and False every 4 statements. The next statement column, alternate between True and False every 2 statements. For the last statement column, alternate between True and False every statement. So for p,q, and r, the initial truth table population would look like so:
p q r
T T T
T T F
T F T
T F F
F T T
F T F
F F T
F F F

Filling in the table

So now we know how to populate the initial fields. Now we get down to the meat of the situation: Evaluating the compound statements to complete the truth table. The great thing about how we organized the truth table is that we can solve simple compound statements and use the solutions to solve complex compound statements. Let's walk through the population of a row. For the sake of demonstration, let's choose a more complex combination: p is true, q is false, r is true.
p q r q || r r || p (q || r) && (r || p) p && [(q || r) && (r || p)]
T F T
Now we move on to the next column, q || r. Since r is true, q || r is true.
p q r q || r r || p (q || r) && (r || p) p && [(q || r) && (r || p)]
T F T T
Similarly, r || p is true
p q r q || r r || p (q || r) && (r || p) p && [(q || r) && (r || p)]
T F T T T
Since q || r and r || p are both true, then the statement (q || r) && (r || p) is also true.
p q r q || r r || p (q || r) && (r || p) p && [(q || r) && (r || p)]
T F T T T T
Since p is true and (p || q) && (r || p) is true, then the statement p && [(p||q) && (r || p)] is true.
p q r q || r r || p (q || r) && (r || p) p && [(q || r) && (r || p)]
T F T T T T T

Final Product

Repeating this process for all 8 combinations, the following truth table is produced:
p q r q || r r || p (q || r) && (r || p) p && [(q || r) && (r || p)]
T T T T T T T
T T F T T T T
T F T T T T T
T F F F T F F
F T T T T T F
F T F T F F F
F F T T T T F
F F F F F F F

Feedback

Have any questions concerning truth tables? Leave us a comment below! January 03, 2011
About the Author:

Joseph is the lead developer of Vert Studios Follow Joseph on Twitter: @Joe_Query
Subscribe to the blog: RSS
Visit Joseph's site: joequery.me