Section 4: Truth Tables



An essential part of working with boolean logic is being able to accurately follow the logical implications of what you’re looking at. As we discussed at the end of the previous section, there are strictly finite numbers of combinations for the values, but there can still be a lot of them. A truth table is a collection of values based on some initial condition. As a first example, look at the table below for the OR and AND operations.

p q p ∨ q p ∧ q
T T T T
T F T F
F T T F
F F F F

If you follow any row of the table it tells you, given initial values of p and q, what the corresponding values are for OR and AND between the two variables.

This can be helpful because you can break larger expressions into smaller pieces and follow them nicely. Referring back to De Morgan’s Laws:

p q ¬p ¬q ¬p ∨ ¬q p ∧ q ¬(p ∧ q)
T T F F F T F
F T T F T F T
T F F T T F T
F F T T T F T

Rather than approaching the entire expression as a whole, I instead only looked at one piece at a time. Once I identified the values of ¬p and ¬q it is much simpler to find the values of ¬p ∨ ¬q by comparing the NOT values directly. Finally, notice that the two highlighted columns have identical values in every case. This proves that the two expressions are equivalent. This truth table proves one of De Morgan’s laws is true just like the example at the end of the previous section, except it is easier to make sure we get every value covered.

Writing truth tables out by hand can get tedious and messy very quickly, but with the use of a simple spreadsheet you can make larger tables with ease. Sometimes we have more than just two variables, in which case we just need to make sure to have every possible combination of the variables. Sometimes, as you will see with the table below, you might have some columns that have duplicated values since they don’t use one (or more) of the variables. That’s completely fine! We put them in anyway because later columns might need them.

Just as an organizational tip, when you list out all the options for your variables, it is helpful to keep a system in place to group same values. This helps ensure that you get every combination, and can help you keep track of your later implications. Notice in the table below that I first altered r, then q, and finally p.

Try to fill out the table, then check your answers.

p q r p → q q ⊕ r (p → q) ↔ (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




And with that we’ve finished our first chapter! You should hopefully feel mildly comfortable working with basic logic at this point. In the next chapter we will extend this introduction and look into how boolean logic applies to the fundamentals of computing.

If you want more information or problems to explore formal logic more, this page has a lot of good resources.


← Previous PageNext Page →