From the course: Programming Foundations: Discrete Mathematics

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Truth tables

Truth tables

From the course: Programming Foundations: Discrete Mathematics

Start my 1-month free trial

Truth tables

- [Voiceover] To evaluate complex statements, it's often helpful to use truth tables. Truth tables provide a visual representation of the sentence, using variables for each proposition and operators for any logical connectors such as and, or, but, nor. Let's start with a very simple example of a truth table. This truth table only has two values, p and not p. So the two values for p are either T for true or F for false. Not in front of the variable changes the value true to false and false to true. Okay, let's look at a more complicated truth table. Here's two truth tables. On the left, I have two variables, p and q, representing propositions, and the question is, what happens when I evaluate p or q? On the right, the same two variables, and I'm going to evaluate p and q. We'll start by filling in the table on the left. We'll start with p as true, true, false, false. Now, I'll fill in the q values. This time, I'll alternate. True, false, true, false. Now, p or q. True or true is true…

Contents