Here’s the first in a 3 part series on logic, which is obviously important for science. This first part will be on deduction, then next week will be on induction (which is the main method used in the sciences), and finally we’ll talk about the very controversial Bayesian logic.
Deduction is when you take a set of assumptions, apply rules to them, and reach a conclusion. Math is a form of deduction, as is computer programming (computers are essentially just deduction machines). These assumptions are either true or false, there is no in-between, and therefore the conclusions they reach are also either 100% true or 100% false.
These assumptions (and conclusions) are often represented by single letters. The most common are p and q, but I prefer using A and B since they’re a bit more distinctive. For example let’s say:
A: “It is raining outside”
B: “My driveway is wet”
With that in mind, let’s look at our first logical operation, NOT. (No, not the Wayne’s World not, the logical not)
This is called a truth table. It goes through all the possible truth values of the inputs and lists the truth value of the output. In this case we only have one input, so we only have 2 rows (A can be either true or false). As you can see (and as you could probably have guessed without a table), NOT is the opposite of whatever the original is. If A is “It is raining outside”, then NOT A would be “It is not raining outside”. So if it really is raining outside then A would be true and NOT A would be false. If it was sunny with no clouds then A would be false and NOT A would be true.
One last note before we move on, most of these logical operations have symbolic shorthand. NOT has a lot, on a keyboard ~ would be pretty common (~A = NOT A), while in writing software it would be ! (so != would be “not equals”).
Ok, let’s do AND.
|A||B||A AND B|
This truth table is a little more interesting since it has two inputs. As you can see, and as you would expect, AND is only true when both inputs are true. Using the A and B from above, if it is both raining outside and my driveway is wet, then A AND B would be true. But if my driveway is wet, but it’s not raining then A AND B would be false.
Now let’s do a slightly tougher one, OR.
|A||B||A OR B|
OR is tricky because it’s the first one to break the expectations set by it’s common English usage. Usually when somebody says “or” they mean one or the other, but not both. If you tell a kid they can have a chocolate bar or a pop, you’d be upset if they tried to get both. But in deduction it’s still considered true as long as one is true. The version that matches the English is called the exclusive or, represented as XOR (XOR is actually used a bit more in electronics, while OR is used more in programming).
AND and OR are kind of opposites (although obviously not exactly). A lot of times you use these with a big long list of statements (A OR B OR C OR D OR …) and you have to choose whether to use OR or AND to get the results you want. With OR, you want it to be true if even one item is true, with AND you want it to be true only if every item is true.
All of these so far have been pretty simple, but now we’re getting to the glue that holds all these together and make them actually do stuff, IF…, THEN…
|A||B||IF A, THEN B|
IF-THEN is used in English all the time. In fact, I’ve already used it in this article. It’s impossible to avoid. “If you kick a field goal, then you get 3 points.” “If you start writing a weekly science article in the offseason, then you’ll be stuck doing it for the rest of your life.”
This is where deduction gets interesting because there’s actually a bit of directionality to it. AND and OR are reversible. A AND B is the same as B AND A. But this is not so with IF-THEN. IF A THEN B is not the same as IF B THEN A. You can even check on the truth table if you want. (If you want one that is reversible then IF AND ONLY IF, or IFF, is the one you want.)
But it also gets a bit tricky. The first row of the truth table makes sense (A and B are both true, so of course IF A THEN B is true), and the second row also makes sense (If you say IF A, THEN B, and A is true, but B doesn’t follow, then that statement isn’t true). The third row also makes sense, although it’s a little weird (If A is false, then you’d expect B to also be false). But why is the 3rd row true?
Let’s go back to the raining (A) and the wet driveway (B). The statement becomes “IF it is raining outside THEN my driveway is wet”. Just from common knowledge we can see that this statement is true, so we know the second row (It is raining, but my driveway is not wet) is wrong. We also of course know the first row is right (Raining would cause my driveway to be wet). And the last row makes sense (If it’s not raining then it makes sense for my driveway to be wet).
But what if it’s not raining, but my driveway is wet anyway? Does that mean the statement “IF it is raining outside THEN my driveway is wet” is wrong? Not necessarily. There are other ways for my driveway to become wet. I could be watering the lawn and some of the water got on the driveway. I could be washing my car. Just because it’s not raining doesn’t mean other things couldn’t have caused the driveway to be wet, and that makes the statement as a whole true.
This is actually a common logical fallacy called affirming the consequent. Whether or not B is true tells you nothing about A, even though A being true means B must be true.
That’s the basics of deduction. Outside of math and computers deduction actually isn’t all the useful in everyday life. It’s when we get to induction where things start to get interesting.