No history yet

Contrapositive and Logical Equivalence

Transcript

Beau

Okay, so last time we really hammered out this idea of 'if P, then Q'. The whole P arrow Q thing. And I'm with you, I get it. If it's raining, then the ground is wet. Simple enough.

Jo

Right. The conditional statement. It establishes a sort of one-way street, logically speaking. The truth of P guarantees the truth of Q.

Beau

Exactly. But it feels like... I don't know, like there should be other ways to say the same thing. Like, if you can go from A to B, shouldn't there be another path that's just as valid?

Jo

That is an excellent question. And you're right, there is. There's a powerful and, frankly, beautiful symmetry in logic. We have this idea called logical equivalence.

Beau

Logical equivalence. Okay. That sounds... significant. Does it just mean 'says the same thing'?

Jo

In a way, yes, but with mathematical precision. Two statements are logically equivalent if they have the exact same truth value in every single possible scenario. No exceptions. They are perfect logical stand-ins for each other. We even have a symbol for it, it's like an equals sign with three lines.

Beau

Okay, so not just 'they feel similar,' but 'they are identical' from a true-or-false perspective. So what's the logically equivalent statement to our 'if it's raining, then the ground is wet'?

Jo

It's something called the contrapositive. And it sounds a little strange at first. The contrapositive of 'If P, then Q' is 'If not Q, then not P'.

Beau

Whoa, okay. Not Q, then not P. So for our example... 'If the ground is not wet... then it is not raining.' Huh.

Jo

Exactly. Think about it. Does that feel true? If you look outside and the ground is completely bone dry, can you conclude that it's not currently raining?

Beau

Yeah, absolutely. One hundred percent. Because if it *were* raining, the ground would *have* to be wet, which we know it isn't. So it can't be raining. Wow, okay. That... clicks. It's like looking at the problem from the other end.

Jo

That's the perfect way to put it. You flip the statements, and you negate both of them. So P implies Q... becomes not-Q implies not-P. Let's try another. If a shape is a square, then it is a rectangle. What's the contrapositive?

Beau

Okay, so... P is 'the shape is a square,' Q is 'it is a rectangle.' So, not-Q... 'If a shape is not a rectangle'... implies not-P... 'then it is not a square.' Yes! That's true too! If it's not even a rectangle, there's no way it can be a square.

Jo

See? Your intuition confirms it. But in logic and math, we can't just rely on intuition. We have to prove it. And the way we prove two statements are logically equivalent is with a truth table.

Beau

Ah, the tables again. Okay, I'm ready. So we're going to compare the final column for 'P implies Q' with the final column for 'not-Q implies not-P', and if they're identical, it's proven?

Jo

You've got it. So let's quickly build it. We need columns for P, and Q. And we list all the possibilities: True-True, True-False, False-True, False-False.

Beau

Right. And the column for 'P implies Q' we already know. It's only false in one case: when P is true but Q is false. The broken promise. So the column goes True, False, True, True.

Jo

Perfect. Now, to build up to the contrapositive, we need a couple of intermediate columns. Let's make one for 'not P' and one for 'not Q'. That's easy, we just flip the truth values of P and Q.

Beau

Okay, so 'not P' would be False, False, True, True. And 'not Q' would be False, True, False, True. Got it.

Jo

Now for the final column: 'not-Q implies not-P'. We just apply the same implication rule, but to these new columns. Remember, the only time an implication is false is when the first part is true and the second part is false.

Beau

Okay, looking at the 'not Q' and 'not P' columns... First row: False implies False. That's true. Second row: True implies False. Ah, there it is! That's our one false case.

Jo

Keep going.

Beau

Third row: False implies True. That's true. Fourth row: True implies True. Also true. So the final column is... True, False, True, True.

Jo

And now... compare that column to the original 'P implies Q' column.

Beau

They're... identical. True, False, True, True. Wow. So it's not just a feeling, it's structurally, mathematically, the exact same statement.

Jo

That's logical equivalence. And this specific equivalence is one of the most powerful tools in all of mathematics and computer science. It's the basis for a type of argument called an indirect proof, or a proof by contrapositive.

Beau

How does that work? Why would you... why would you need to do that? Why not just prove the original statement directly?

Jo

Because sometimes, proving 'P implies Q' is incredibly hard. The path from P to Q is murky and complicated. But proving 'not-Q implies not-P' can sometimes be shockingly simple.

Beau

Give me an example. A mental movie.

Jo

Okay. Imagine we want to prove this statement: 'If the number n-squared is odd, then the number n must be odd.' Trying to go from a squared number back to the original number involves square roots, and that can get messy.

Beau

Right, I can see that. So P is 'n-squared is odd' and Q is 'n is odd'. What's the contrapositive?

Beau

Let's see... flip and negate. So... 'If n is *not* odd, then n-squared is *not* odd'.

Jo

And what's another word for 'not odd'?

Beau

Even. So... 'If n is even, then n-squared is even'. Oh! That's way easier to prove! If n is even, you can write it as 2 times some other number, k. So n-squared is (2k) squared, which is 4k squared... which is definitely even!

Jo

And since you just proved the contrapositive is true, and we know the contrapositive is logically equivalent to the original statement...

Beau

...then the original statement *must* be true. Without ever having to touch a square root. That... that feels like a magic trick.

Jo

It's not magic, it's just a different door into the same room. Sometimes the front door is locked, so you just go around to the perfectly good, unlocked back door. The contrapositive is the back door.