A Summer 2015 Mathematics A To Z: xor


Xor.

Xor comes to us from logic. In this field we look at propositions, which can be be either true or false. Propositions serve the same rule here that variables like “x” and “y” serve in algebra. They have some value. We might know what the value is to start with. We might be hoping to deduce what the value is. We might not actually care what the value is, but need a placeholder for it while we do other work.

A variable, or a proposition, can carry some meaning. The variable “x” may represent “the longest straight board we can fit around this corner”. The proposition “A” may represent “The blue house is the one for sale”. (Logic has a couple of conventions. In one we use capital letters from the start of the alphabet for propositions. In other we use lowercase p’s and q’s and r’s and letters from that patch of the alphabet. This is a difference in dialect, not in content.) That’s convenient, since it can help us understand the meaning of a problem we’re working on, but it’s not essential. The process of solving an equation is the same whether or not the equation represents anything in the real world. So it is with logic.

We can combine propositions to make more interesting statements. If we know what whether the propositions are true or false we know whether the statements are true. If we know starting out only that the statements are true (or false) we might be able to work out whether the propositions are true or false.

Xor, the exclusive or, is one of the common combinations. Start with the propositions A and B, both of which may be true or may be false. A Xor B is a true statement when A is true while B is false, or when A is false while B is true. It’s false when A and B are simultaneously false. It’s also false when A and B are simultaneously true.

It’s the logic of whether a light bulb on a two-way switch is on. If one switch it on and the other off, the bulb is on. If both switches are on, or both switches off, the bulb is off. This is also the logic of what’s offered when the menu says you can have french fries or onion rings with your sandwich. You can get both, but it’ll cost an extra 95 cents.

Author: Joseph Nebus

I was born 198 years to the day after Johnny Appleseed. The differences between us do not end there. He/him.

9 thoughts on “A Summer 2015 Mathematics A To Z: xor”

    1. There’s a surprising amount of mathematics behind stuff McDonald’s does, actually. Have you ever encountered the McNugget problem?

      The idea dates to the early days when Chicken McNuggets were sold in packs of 6, 9, or 20. If you wanted to get 12 McNuggets, that’s easy enough: buy two packs of 6. If you want 15, buy a pack of 9 and a pack of 6. If you want 18, buy three packs of 6 or two packs of 9. If you want 26, buy a pack of 20 and a pack of 6. And so on.

      But you can’t get exactly seven McNuggets. And you can’t get exactly ten. You can’t get exactly 19, either.

      What’s the largest number of McNuggets you can’t buy, then?

      Like

Please Write Something Good

This site uses Akismet to reduce spam. Learn how your comment data is processed.