Mega-Giga Plus Exponents: Part Two of the “Math is Fum” Series

See Part I of the “Math is Fum” series here.

Mega and Giga
As a continuation from last week’s posting, let’s talk about computer memory. Many people translate the prefix “mega” as meaning “million”. As far as the metric system goes, mega means million, and when someone says “megabyte” most people translate that to mean “one million bytes”. But when speaking of computer memory or hard drive space, mega does not equal exactly 1 million. Actually, it equals 1,048,576. Where does this strange value come from?

You’ll remember from the last “Math is Fum” lesson that computers use binary (base-2) to store numbers and do calculations. So it makes sense that when a computer refers to memory or hard drive space, it would use binary math to do so. Which is where the number 1,048,576 comes from – it can also be written as 2^20, or 2 to the 20th power. (It can also be said “2 multiplied by itself 20 times”.)

Thus, when your computer says you have 75MB (Megabytes) available on your hard drive, it means you have about 78,643,200 bytes free. (Computers do sometimes round these numbers up or down to display a nice even number, so 75MB may be a little less than that or a little more than that.)

If you’ve already guessed that a gigabyte is not exactly 1,000,000,000 bytes, you’re brilliant - it is in fact 2^30, or 2 raised to the 30th power. 1GB to a computer is 1,073,741,824 bytes.

For most of us, thinking of mega and giga as one million and one billion, respectively, will get us through the day as we use computers. Since memory and hard drive space is so cheap these days, it’s no longer necessary for programmers to try to squeeze out every last byte when writing software. That's either a good thing or a bad thing, depending on whose opinion is sought.

See this page for a more detailed discussion of MB, GB, and how hard drives are labeled – some do refer to 1MB as equal to exactly one million bytes for marketing purposes, which sometimes confuses computer users who see less hard drive space than they expected.

Math for Those Who Enjoy Artificial Light
Let’s move on to a new topic – powers of two.

Picture a light switch. It has two positions – on and off. It can’t be both on and off at the same time. How many combinations of on and off positions can one light switch have? Just two – on and off. (If only all of math were this easy!)

Now picture two light switches next to each other. How many combinations of on and off positions can the two switches have together? Listing out the combinations, we get:

Switch 1 off, Switch 2 off
Switch 1 on, Switch 2 off
Switch 1 off, Switch 2 on
Switch 1 on, Switch 2 on

There are four combinations.

Another way we could write this is to use a 1 to indicate “on” and a 0 to indicate “off.” The on/off combinations of the switches above could be written like this instead:

00 (both switches off)
10
01
11 (both switches on)

Let’s add another light switch to make three in a row. How many combinations of on and off positions are there now? Most people would probably say “Six!” But in fact, there are eight.

Here are the possible combinations of switches

000 (all switches are off)
001
011
010
100
101
110
111 (all switches are on)

It’s easy to write out the possible combinations for a small number of light switches, but what if you have six switches? How many combinations of on and off are available? You could start writing out a long list of all the possible values:

000000
000001
000011
000010
Etc.

But that would be exhausting. Fortunately, there’s an easier way to figure it out.

The number of combinations of on/off positions for a given number of light switches is 2 multiplied by itself that many times, or two to the power of the number of light switches.

Let’s check out this rule see if it works.

With 2 light switches, the total number of combinations is 4, which is 2 to the second power (or 2 x 2). This matches the number we found earlier.

With 3 light switches, the total number of combinations is 2 to the third power, or 8 (or 2 x 2 x 2). This also matches the number we found earlier.

To answer the question about 6 light switches, the total number of combinations is 2 to the sixth power, or 64. (or 2 x 2 x 2 x 2 x 2 x 2)


Sandwich-Themed Math
It’s lunchtime, and you’re hungry. You want to make a sandwich. A raid of the refrigerator yields a loaf of bread and five tasty ingredients: mayonnaise, swiss cheese, lettuce, relish, and honey mustard. You could just pile all that on the bread and eat it, but then we wouldn’t have any math to do. So keep reading. (If you're really hungry, stop reading and eat a banana.)

How many combinations of ingredients can you make into a sandwich? You’ll always use two slices of bread, so that doesn’t factor into the calculations.

Here are a few examples of sandwich ingredient combinations:
Mayo, cheese, lettuce
Cheese, relish
Lettuce, honey mustard.

We could spend all day writing those words, or we could create some shorthand for the ingredients:

Let’s use 1s and 0s to denote whether or not the ingredient is used on a sandwich. We’ll use the order they’re listed above (mayo, swiss cheese, lettuce, relish, and honey mustard) to determine where to put the 1 or 0.

For example,
10101 means the sandwich has mayo, no cheese, lettuce, no relish, and honey mustard.
11001 means the sandwich has mayo, cheese, no lettuce, no relish, and honey mustard.

This looks a little bit like the light switch problem above. Now think of it this way: an ingredient can either be ON or OFF the bread; mayo is either on or off, lettuce is either on or off. Now we know how to solve this problem, because it’s the same problem as light switches that can be on or off. There are 5 possible ingredients, so there are (you guessed it!) 2^5 possible combinations of sandwiches, including a sandwich that has no ingredients other than bread. (2^5 = 2x2x2x2x2 = 32.) That may seem like too many combinations of ingredients, but it’s correct.

A Little More Difficult
Going back to switches and electrical wiring (and I’m assuming you’ve turned off the circuit breaker), let’s say you have a different kind of switch – a ceiling fan switch. The switch rotates and has three positions: off, low speed, and high speed. If you have one switch, you obviously have three possible positions. If you have two switches, how many combinations do you have? Hint: it’s not 6.

You could write them out if you want:

Off Off
Off Low
Off High
Low Off
Etc.

There is an easier way, though. Just as we raised 2 to the power of the number of light switches above, we can raise 3 to the power of the number of ceiling fan switches. 3^2 = 3 raised to the second power = 3x3 = 9 possible positions.

You can say this a different way: The number of combinations possible for a switch with N positions is N raised to the power of the number of switches. In this example, N = 3, and the number of switches = 2, the number of possible combinations is 3^2, which is 9.

What about seven ceiling fan switches? How many possible combinations of positions are there? 3 raised to the 7th power, or 2,187. That seems like a really high number at first, but if you start to write out all the combinations one by one, you’ll start to believe it.

------

Here at the Math Is Fum Institute, we hope you enjoyed this installment. In the next installment, I will attempt to prove Newton’s Second Law of Thermodynamics using only a pocket calculator, two ceiling fan switches, and a 3-oz. jar of honey mustard.

No comments:

Post a Comment