 In algebra, we're interested in evaluating algebraic expressions for specific values of the variable and recognizing when two different looking expressions are actually equal. You know, if we take, for example, x plus y squared, and you compare that to the expression x squared plus y squared. Now, many of us watching this video probably are aware that these quantities, in fact, are not equal to each other. That's not equality. It's, in fact, not equality. But why are they not equal to each other? Well, it turns out you can pick up an instance of these variables. So if you assign x to be 3 and you take y to be 4, just as an example, on the left-hand side, you would end up with 3 plus 4 squared. That would be 7 squared, which is 49. That is not the same thing as taking 3 squared plus 4 squared, which would give us 9 plus 16, which is equal to 25. 25 and 49 are not the same number. And so this is evidence that those two algebraic expressions are not equal to each other. Now, in logic, we want to know whether or not a pair of statements with similar forms take, for example, not p and q. Is that equal to not p and not q? After all, there's some similar relationships going on there. We could ask the same question, are these equal to each other? Well, much like the equation we saw earlier that wasn't actually an equation, if you find, if you were to plug in values of the variables and get a disagreement ever, that would suggest that the two expressions are not the same thing. One is actually different for each other. Now, as opposed to algebraic expressions, Boolean statements are much simpler because the Boolean variables, the primitives, can only take on two possible values. A statement is either true or false. And so as you evaluate the primitives inside of a statement, you can actually brute force and try every combination. With algebra, this is typically not the case because you often have infinitely many values for the variables there. But in Boolean logic, you only have two options per variable. So depending on the number of variables, there's only two to the end, if n is the number of variables, there's only two to the end many options. And so with a few variables, you can actually brute force and try every combination. And this what's leads to what's commonly referred to as a truth table. Now, in order to work with a truth table, typically what one does is one creates columns of the table for variables in place. You might have the variable P, Q and R, and so your row typically will represent the expression. You'll start with things like your variables P, Q and R, if there's more, add some more in there. And then you might throw in like a not P and not R if they show up in your expression. And then you'll just keep on adding more and more complicated expressions like not P and Q, not R and Q, building up until eventually you get to the expressions you're interested in. Now, in order to build truth tables, you're also going to make rows for each of the possible truth values. We'll see that in just a second. But it's a good reminder, what are the calculations that the operations we see with Boolean logic? How do they work? So for example, if you look at this truth table right here, we'll just take one primitive P and it can take on two values, true and false. The operation of negation will change the sign. So whenever you negate something that switches the sign, true becomes false, false becomes true. That's pretty simple. Let's look at the AND operation here. Now AND will involve two primitives, which may or may not be the same thing. We'll consider them as if they're different. We'll call our primitives P and Q right here. Now, since we have two primitives that can both be true and false, there's actually four combinations. There's true, true, true false, false, true, false, false. Writing down all of these values is much like writing a number in binary. So you have two options for the first bit, two options for the second one, and so you get four options total. Then if you're looking at AND, the thing to remember about conjunctions is that a conjunction is true only if both primitives are true. For an AND statement to be true, you must be true and true. If you have any falses in an AND statement, it makes it false. So if P and Q are true, so is AND. If Q is false, AND is false. If P is false, AND is false. If they're both false, then AND is false. Now OR statements work the other way around. So again, we list the four possibilities here for our two primitives P and Q. For an OR statement, ORs are true if ever there's any true statements involved in here. That is, they can only be false when both primitives are false. So if you have false OR false, that does give you a false statement. Otherwise, a disjunction is always true. True and true gives you true. True OR false is true. False OR true is true as well. Now remember our conditional statement like we see right here. We draw this with an arrow. The order does matter. We have our hypothesis here and our conclusion there. Again, there's two primitives involved here, so we have four combinations. Now, a conditional is only false when the premise is true, but the conclusion is false. And that makes the conditional statement false. If, on the other hand, the premise is false, then the conclusion is under no obligation. It could be true or false. The conditional statement is then true. This is when we say the conditional is vacuously true. And then over here, if P is true, the conclusion and Q is true. Sorry, if the premise is true and the conclusion is true, then the conditional is true as well. For conditionals, you want to pay attention to this line. The hypothesis is true, but the conclusion is false. That makes the conditional false. Now for a biconditional, which is the last operation we've learned about, a biconditional is true when P and Q have the same truth value. So if P and Q are both true, the biconditional is true. If P and Q are both false, the biconditional is a true statement. Biconditionals are false when the truth values disagree. If you have true and false or false and true, that makes the biconditional false there. Alright, so now with that reminder out of the way, let us consider a building a truth table. I'm going to do this by hand intentionally. So when you look at this expression here, not P and Q or P and Q, there's two primitives in play there. There is P and there is Q. So we're going to draw those. So we're going to get P right here and Q right here. And because I have two variables, I need to have four rows inside of my table. It doesn't have to look super pretty, but I am doing this on the computer, so I can at least guarantee my lines are straight. And so you're going to have four years. The way I like to do it is take the last variable you're going to consider. It's going to alternate true, false, true, false, like so. And then the next variable, the P here, it's going to alternate but every other time. So you get true, true, false, false. I'll probably take a look at with three variables and see how that affects things. So next, you don't necessarily want to start off with the whole thing. You want to put piece by piece in there and feel free to take lots of space. There is a not P in there. So maybe I put that into my table. Okay. What are some other things I do need to do a not P and Q. I also probably should consider the P and Q. So just adding a new column every time I want to make it a little bit more complicated. Then the final statement not P and Q or P and Q. So now we fill these things in. Not P is pretty easy to switch the sign of P. So false, false, true, true for not P and Q. Remember, you're now looking at these columns right here. Whenever you have a false that makes it false. So you have a not P is false. They're both false right here. In this case, they're both true. And in the last case, they're false like so. Now we have another and statement. Remember and is true when they're both through. So you get a true right here and then false everywhere else. And then finally the operation play here is a disjunction. So disjunctions are true if any part of it is true. So we're looking now at these two columns of my table there. So you have a true. You have a false. You have a true and you have a false like so. And so then this would be the final truth value through this expression right here. This is what we are trying to calculate from this truth table. Let's look at another example here. I have three variables in play this time. So I'm going to make my table a little bit bigger. Or maybe I'll just make the rows a little bit more skinny. So we're going to have a column for P. We're going to have a column for Q. Sorry about that for Q and for R. And so before I do anything else, I'm going to write these things on here. I'm going to have a P, a Q and an R. And I think I'm going to switch up my color here to make it a little bit easier to read P, Q and R. And so if we look at all the possibilities, we need to have eight rows here. So there's one, two, three, four, five, six, seven. I think that should fill it out for us here. I'm going to just have to just bring it down just a little bit more. And so looking at the values that can appear here for the first variable, we're just going to alternate true, false, true, false, true, false. Like so. Now for the next one, we're going to alternate every two spots. So true, true, false, false. Next, we're going to do true, true, and then false, false. Then for the third one, we're going to alternate every four. So we're working powers of two. We alternate every one spot, which was two to the zero. Then we alternate every two spots to the first. Now we're going to alternate every four. So true, true, true, true. And then false, false, false, false. So these are all the possibilities we can take on with this truth table here. So now looking at the expressions, what are we interested in? We'll be interested in a not P, a not R. Probably interested in a not P and Q. And then the final statement itself, not P and Q or not R. And so then we'll add some lines to our table to make it a little bit easier to read. This doesn't have to be the prettiest thing ever, but it does make it a lot easier to read the better we do there. So now for not P, notice that it'll just be the opposite of P. So you get false, false, false, false. True, true, true, true. For not R, same basic thing. You're going to get false, true, false, true. False, true, false, true, like so. Then we're going to do not P and Q. So we look for when they're both true statements. So we're looking at this column and this column right here for an and statement. So for the first row, you have true and false. So that's a false. Then for the next row, you get that again, true and false. Then you're going to get false and false. And then false and false again. Then you're going to get true, true, true, true, false, true, false, true. So most of those are false, but that's what you expect for an and statement. Then finally, to do the last column, not P and Q or not R, my knots need to look more like negation symbols like so. So now we're going to consider not R and this column. So we're doing an or looking at those two columns. Well, false or false is false. True or false is true. False and false is, I should say false or false is false. Then the next we have true and false. That's a true, false and true. That's a true. There's a true, false and false and then true and false. So then the final column there looks like false, true, false, true, true, false and true. So this then gives us the evaluation of this expression. We've considered all of the eight possibilities there. Let's do one last example of this. This next one will be a little bit shorter because it only has two variables, P and Q. But this time let's use a conditional statement, see how that might affect some things. And so much like we did before, we're going to draw it so that we have our two variables, P and Q. There's going to be four rows in there. So we get something like the following. We have our column for P or column for Q. And we look at all the possible truth values. True, true, true, false, false, true and false, false. And so then with this one, one of the expressions will be interested in. We'd be interested. We could do a not P if you want to. You can skip some of the columns if you feel more comfortable with it. Now for the sake of this video, we're going to put a not P and a not Q in there. They both seem to come into play. I'll be very interested in this expression right here, not P or Q. I'm also interested in this one, not P and not Q. And then finally I want the whole enchilada. We're going to take not P or Q implies not P and not Q. Got a little cramp there, but that's okay. This is a lot easier if you're to do it on paper for sure. All right, so now let's fill this thing out. Not P is pretty easy to switch all the signs. So you get false, false, true, true. Same thing for Q, switch all the signs. False, true, false, true. Now for the next one, we're looking at not P or Q. So with an or statement, you would get true. Again, we're looking at these two, these columns right here. The next one, look at false, false. That's a false, true or true. That's a true. And then false or true, that's a true. Then for the next column, we have not P and not Q. So we're looking at these two columns now and we're doing an and statement. False and false is a false. False and true, that's also false. True and false, that's false. And then finally true, true. That's a true statement right there. And so now then the final one, we have this conditional statement. This is our premise. And this is our conclusion with regard to a conditional. Remember, a conditional is only false when you are true premise and false conclusion, like the very first line. So this is going to give us a false right here. But this one false implies false. That's actually a true statement. It's vacuously true. Then we have another true implies false. That is a false statement. And then you have a true implies true. That is a true statement as well. So then we've discovered the four truth values for our expression right here. False true, false true. And so this then illustrates for us how one can build a truth table to help you calculate log logical expressions. And we'll see in of course in the next lecture how one can use a truth table then to make some analysis of other logical concepts.