CSC110 - Computer Mathematics

Module 1 Section 2- Introducing the Binary Number System

Everything about the binary number system is the same as the decimal number system with just one difference: the base is 2 instead of 10.

Binary means base 2(note the prefix bi). Base 2 (binary) has 2 digits: 0, 1. Since binary numbers are made up of binary digits, we often call a binary digit a bit (short for binary digit). We may also refer to a place value position as a bit. In other words, the binary number '1010' requires 4 bits to write, and those bits are '1', '0', '1' and '0'.

For any number system that has a base b, the first b non-negative numbers are represented by the digits themselves. For base b=2 (binary), the first 2 numbers are 0 and 1.

Counting in binary is just like counting in decimal, except that you run out of digits much more quickly and have to resort to more value places sooner. To count the number of eggs in a dozen in binary would be as follows: 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100. The following table will show how this sequence looks in both binary and decimal, so you can compare them.
 
Eggs In Decimal In Binary Comments
0
0
1
1
So far, the sequences are exactly the same
2
10
Here, binary has run out of digits and must resort to another place, whereas decimal still has more digits to use.
3
11
4
100
Again, binary has run out of digits in the 2's place, and must expand to the 4's place. Decimal still has not exhausted it's 1's place.
5
101
6
110
7
111
8
1000
9
1001
10
1010
Finally, decimal must resort to a second value place, then 10's.
11
1011
12
1100
Things you might have noticed about binary numbers:

After looking at these facts, you may be asking the question Why are we even interested in binary numbers? They've got disadvantages! The disadvantages of taking up more space to write a small number, and the problems human beings who are used to decimal numbers will have when they work with binary numbers are certainly of concern. However, binary numbers are natural for modern digital computers to work with. Here's why.

First, let's understand what the word digital means. The counterpart to digital is analog. You can understand the difference by thinking about a clock...well, two clocks. Here they are:

The digital clock is capable of representing a finite amount of information. It can tell us the time by showing use 1 of 12 possible hours, 1 of 60 possible minutes, and either AM or PM. There's no way for the digital clock to show us how much of the minute has passed. Even if you added two more digits for seconds, you wouldn't be able to tell how far between seconds you are.  And even if you added more digits for that, the actual time could always be "between" two possible times the digital clock can show. You would have to have an infinite number of digits in the display to be able to tell exactly what time it was using the digital clock. Of course, that's not practical! Digital can mean descrete, as it does in this example. That means that there is a finite number of things the clock can show, even though the thing it represents (the current time) could have an infinite number of actual values.

The analog clock is able to show an infinite number of values, because the hands sweep through a continuous domain. In other words, when the time is actually between two minutes, the hand will be positioned halfway between two minutes on the face of the analog clock. Digital computers (such as the digital clock) often have to represent analog information, and do so by choosing the closest discrete value to the continuous value. For example, if the time is actually 4:03:12PM, then our digital clock would either show 4:03PM or 4:04PM.

The simplest discrete domain to work with, and the one that modern digital computers work with, has only two values. These values are known by several names. 'OFF' and 'ON', 'NO' and 'YES', 'FALSE' and 'TRUE', and (you guessed it) '0' and '1'. The reason computers use binary is because the values '0' and '1' can be represented by electricity. If there is electrical current on a wire, we'll say that wire is signalling a '1'. If there is no electrical current on a wire, then we'll say it is signalling a '0'.

Computer engineers are experimenting with computers that use more than two values, but they are not yet practical.  These computers would use different levels of eletrical current to represent more discrete values. For example, no current could be '0', medium current could be '1', and high current could be '2' - which would give you a trinary computer. For our studies, however, we will constrain ourselves to the binary computer. It's simple, and it is the current technology.

We should be able to apply expanded notation to binary numbers. For example, the binary number '10110' written in expanded notation would be:

(1x10100)+(0x1011)+(1x1010)+(1x101)+(0x100)

Notice that everything is written in binary. You would read it as "1 times 2 to the 4th plus 0 times 2 to the 3rd plus 1 times 2 to the 2nd plus 1 time 2 to the 1st plus 0 times 2 to the 0." However, we are going to use expanded notation as a tool for converting binary to decimal. So let's rewrite the expanded notation as a decimal expression:

(1x24)+(0x23)+(1x22)+(1x21)+(0x20)

Now, by actually carrying out a computation, we can condense this to a base 10 (decimal) number which is equivalent to the binary '10110'. Remember, they are the same number, just written differently. So the above becomes:

(1x16) + (0x8) + (1x4) + (1x2) + (0x1) = 16 + 0 + 4 + 2 + 0 = 22

So, '10110' in binary is the same as '22' in decimal.

Another observation you may have made is that anytime a '0' is in a bit position, it will never contribute anything but zero to the sum. So, if we are going to convert binary to decimal this way, we can save a lot of time by just not writing down the '0' bits to begin with. For example, let's convert the binary number '10010' to decimal, and remember that '0' doesn't contribute to the sum. We get:

(1x24)+(1x21) = 8 + 2 = 10

And another observation now is that the '1' bits always contribute exactly that power of two. In other words, you waste time doing the multiplication. All you have to do is write a series of powers of two as a sum. For example, let's convert the binary number '1011011' keeping this in mind:

26+24+23+21+20 = 64+16+8+2+1 = 91

Fractions also work, just as with decimal numbers. Negative exponents are used to denote negative powers of two. Instead of a "decimal" point we now have a "binary" point. The place value of the postion to the right of the binary point is 2-1, or one-helf. Next is 2-2, or one-fourth. So what is the binary number '100.101' in decimal? First, write the expanded notation:

22+2-1+2-3 = 4 + 1/2 + 1/8 = 4 5/8 = 4.625

Homework Questions

    Write the following binary numbers in expanded notation, including all information even if it is redundant:

  1. 0
  2. 1
  3. 10
  4. 110
  5. 10.01
  6. 0.01
  7. 1101.01
  8. 100.01
  9. 111.11
  10. 0.1

    Convert the above numbers (listed again below) to decimal using the expanded notation as an intermediate form.

  11. 0
  12. 1
  13. 10
  14. 110
  15. 10.01
  16. 0.01
  17. 1101.01
  18. 100.01
  19. 111.11
  20. 0.1
Next Section: Properties of Binary Numbers
Previous Section: Review of the Decimal Number System
Return to Module Index