 Welcome back to our last example of proof using cases. The proposition we're going to look at this time introduces a function that might be new to you. It's called the floor function. The floor function, and we denote it with these two little symbols that look like absolute value signs, except there's literally a floor on the bottom of them, takes real numbers as input and produces integers as output. Here's the formal definition. The floor of x is defined to be the largest or greatest integer that is less than or equal to x. So for example, the floor of 5.1 is 5, because 5 is the greatest integer that is less than or equal to 5.1. And the floor of 2.99999 is 2, because 2 is the greatest integer less than or equal to 2.99999. The floor function is really important in computer science because it's a way of converting floating point decimals to integers. And informally we can think of the floor function as rounding a real number down to the next integer below it. The proposition for this example involves the floor function. So let's do two concept checks to help you instantiate the definition. First, what is the floor of negative 1.3? Is it 0, 1, negative 1, sorry, negative 2, or negative 0.3? So pause the video and come back when you have an answer. So the right answer here is negative 2. The floor function takes a real number and maps it to the greatest integer that is less than or equal to the input. So that's a downward rounding. It would take negative 1.3 to negative 2, because negative 2 is less than negative 1.3. Remember that negative 2 is less than negative 1, not greater than negative 1. For the second concept check, what is the floor of x when x is an integer? Is it x, x minus 1, x plus 1, or 0? So the answer here will be just x itself. If you start with an integer and round it anywhere, nothing happens, because it's already an integer. So with those two concept checks, I think we have a sense of how the floor function behaves. And with that, we're ready for our proposition. So we're going to prove that for all real numbers x, the floor of x plus the floor of minus x is either 0 or 1. So as we've done before, let's ask three questions before we dive in. First, what did the terms mean? Second, why might we use cases on this problem? And third, what are the cases? So in terms of the terms, I think we're pretty good with what the terms mean at this point. We've instantiated the definition in several different and diverse cases. And if we're still shaky, we could do more examples and use, say, Wolfram Alpha to check our work. So why should we use cases at all? The argument for using cases would come from our experiences. Remember back a couple of videos ago when we were proving something about the absolute value? This is a problem that was in a lot of ways similar to the problem that we have now. Back then, we needed to establish an equation, which we are trying to do now. And back then, the main term involved in the equation had different behaviors based on the input, which is also the case now. So in other words, we've seen a problem that is similar in some sense to our new problem. So what worked on the old problem could map well onto the new problem. Now this illustrates a very important principle of problem solving in general. If you are deciding how to work a problem, look for a similar and related problem to solve and solve it first, or examine its solution for ideas. So finally, what are the cases going to be here? We'll do that as a concept check. Take a look at all the possibilities here for different cases and write down what you think the answer will be. So interestingly, the answer here is going to be E. This proof is going to be kind of interesting and different because here we're going to use two sets of cases. If we think back to our earlier concept check, you might get an idea of how those cases might break down. First of all, we'll split the cases into one where x is an integer and another where x isn't an integer. So here's the first case. If x is an integer, then so is minus x. So as we saw earlier, the floor functions aren't going to do anything. They'll just return x and minus x respectively. When we add those two floors together, we're going to get zero, which is one of the two results in the disjunction that we could get to satisfy that proposition. So this is kind of a divide and conquer strategy. I've divided the proof into cases and then just tackled the easy case. And now onto the not so easy case where x is not an integer. Here, I'm actually going to use two more cases. One, a sub case where x is going to be positive, and another sub case where x is negative. There was technically a third sub case where x is equal to zero, but since zero is an integer, I've already treated that with case one. So why choose positive and negative for these two cases? Well, again, it's because we have an understanding of how the floor function actually works. And I invite you to think back to the instantiations we did earlier in the video. The floor function has a certain behavior for positive numbers that's definitely different than it is for negative numbers. Remember how floor 5.1 was fairly easy to get our minds around, but we had to think a little bit to get floor of negative 1.3. So that difference in behavior serves as a guide in my selection of the cases to use. So first, let's take the case where x is positive. And for this, we're going to let the letter n represent the integer part of x. That's the number the integer you get when you take x and just strip away its decimal parts. For example, the integer part of 5.2 would just be 5. Now, when x is positive, then the floor of x is just n. For example, the floor of 5.1 was equal to just 5, and that's obtained just by stripping away the 0.1. Now, since x is positive, that of course means minus x is negative. Now, think back to what the floor of a negative number is. It's not obtained just by stripping off the decimal part. If I try to just do that with a negative number, I end up going up in value. For example, if I started with negative 1.3 and I just stripped off the decimal, I would get negative 1, which is a greater integer. It's not the same thing as the floor of negative 1.3. To get the floor value, I need to strip off the decimal, but then subtract 1 to get it to go down as it should. So the floor of negative x is the integer part of negative x, which in this case is minus n. But then I have to subtract 1 from that to get the right floor value. And again, an example helps. The floor of negative 4.6 is supposed to be negative 5. So I strip off the decimal to get negative 4, and then to get it to the right place, I have to subtract a 1. So with that, if I add the floor of x and the floor of minus x, I'm going to get n, the integer part of the positive number x, and I'm adding that to negative n minus 1, which is going to give us minus 1. That's one of the possible results we could have for the proposition. Now, the second sub-case is where x is negative. This looks an awful lot like the proof for when x is positive. Only since x is negative, the floor maps to the integer part minus 1, as we discussed earlier. And if x is negative, then minus x is positive. And so the floor of minus x is minus n, and there's no subtraction, because minus n is actually a positive number here. Adding these terms together gives us the result that we need. It's minus 1 this time. So there's the whole proof. I used two sets of cases in the proof, interestingly, and mainly that's just to isolate the parts of the proof that are easy from those that were not as easy, and then do the easy parts quickly and focus energy on the not as easy parts. And notice importantly that the choice of cases stems from a really solid understanding of the terms that are involved, in this case, the floor function itself. So that does it for our videos on proof using cases. The best way to build your skills from here on out is just to study worked examples and think carefully about the decision-making processes that the writer is using when you read this stuff to make cases. And then do a lot of these types of proofs yourself with help from a friend or with your professor. Thanks for watching.