Real-Life Math
Justin Funke is a computer systems security analyst. He says the
minimum math requirement for this career is advanced high school math, but
he recommends that you take some post-secondary math courses. And be ready
to put on your thinking cap. You will encounter math problems you may have
never encountered before.
"It's not going to be math
that you already know," he says. "You have to understand math as a general
science."
An important part of computing theory, especially in the
security area, is dealing with numbers in different number systems. Two of
those systems are decimal and binary.
The decimal system is the most
common one people use. But computers cannot understand it. They use the binary
system, and you have to understand it because it is absolutely critical for
some important aspects of Internet engineering.
A unique decimal number
identifies every computer on the Internet. This number is called the IP address,
and many strange-looking addresses can only be understood if they are converted
(at least mentally) to binary.
So how does binary work? All digital
computers represent data as a collection of bits. A bit is the smallest possible
unit of information. A bit can be in 1 of 2 states -- turned off or on. If
it is turned off, it has a value of 0. If it is turned on, it has a value
of 1. So if 1 bit has 2 different states, how many states do 2 bits have?
The
answer is 4 -- 2 x 2. Why?
Both bits can be turned off. So they
each have a value of 0. It would read like this: 0 0
If both bits are
turned on, each has value of 1. It would read like this: 1 1
If only the
first bit is turned on, it can be read as 1 0
And if only the second bit
is turned on, it can read as 0 1.
Likewise, 3 bits have 8 states -- 2
x 2 x 2 = 8. So how many states do 4 bits have?
The answer is 2
x 2 x 2 x 2 = 16. Is there a pattern here? Of course.
The number
of possible states doubles with every extra bit. So 8 bits -- or 1 byte --
has 256 possible states. This allows you to represent every number from 0
to 255 in binary form.
So how do you convert decimal into binary?
Remember
that each bit has a specific number of states. One bit, for instance, has
2 states. That is also its numeric weight if you turn it on. So 1 bit has
a weight of 2, 2 bits have a weight of 4, and so on. That allows you to build
the table below, starting from 0 bits to 7 bits. (The 0 bit position has only
1 state -- 0 -- because it is turned off permanently.)
Bit Position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
Weight | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Assume now that you want to represent the value of 0 in binary
form. It would read like this:
00000000
Why?
Because if you want to represent 0 in binary, you have to turn off every bit
-- assign it a value of 0 instead of 1.
Of course, if you want to represent
255, you have to turn on every bit. It would read like this:
11111111
You
are a computer systems security analyst. Convert the following decimal numbers
into binary.
Here are a few general rules you should keep in mind.
Begin
at the leftmost bit position. If the number is larger than or equal to the
bit's weight, write a 1 in the bit position, subtract the bit's
weight from the number, and continue with the difference. If the number is
less than the bit's weight, write a 0 in the bit position and continue
without any subtraction.