Binary Numbers


Introduction to Computer Use
Madison Area Technical College
by Kevin Mirus

The purpose of this little article is to better explain the binary number system, how to convert from the binary to decimal number systems, and how to convert from the decimal to binary number systems.

The Binary Number System

To better understand the binary number system, it helps to review the decimal number system first. The decimal number system uses ten different symbols (the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9) arranged using positional notation. Positional notation is used when a number larger than 9 needs to be represented; each position of a digit signifies how many groups of 10, 100, 1000, etc. are contained in that number. Specifically, each position of a digit represents a group that is ten times as large as the group represented by the the position to the right. Thus, the number 1,065 represents a number that contains one group of 1000, zero groups of 100, six groups of 10, and 5 "groups" of 1. Notice that the size of the groups represented by each position in the number correspond to a power of 10:

Group Size for Positional Notation of Decimal Numbers
100 = 1
101 = 10
102 = 100
103 = 1,000
104 = 10,000
105 = 100,000
106 = 1,000,000
etc.    

Along similar lines, the binary number system uses only two different symbols (the digits 0 and 1) that are also arranged using positional notation. When a number larger than 1 needs to be represented, positional notation is used to represent how many groups of 2, 4, 8, etc. are contained in that number. Each position in a number represents a group that is two times as large as the group represented by the the position to the right. Thus, in the binary number system, 1011 represents a number that contains one group of 8, zero groups of 4, one group of 2, and 1 "group" of 1(which adds up to 8 + 2 + 1 = 11). Notice that the size of the groups represented by each position in the number correspond to a power of 2 (see the table below for more powers of 2). Also notice that it is hard to tell what number system you are talking about when you are dealing with numbers like 1011 and 11. To avoid this type of confusion, a decimal subscript is often used to specify exactly what number system is being used. Thus, we write 10112 = 1110.

Group Size for Positional Notation of Binary Numbers
20 = 1
21 = 2
22 = 4
23 = 8
24 = 16
25 = 32
26 = 64
27 = 128
etc.    

Notice that eight entries are recorded in the table above. That is because computer scientists often group information into eight digit binary numbers, called a byte (a single binary digit is called a bit). A byte can represent any number from 0 ( = 000000002) to 255 ( = 111111112). This explains why the number 255 turns up a lot with computers, such as a setting choice of 255 colors for your monitor.

 

Binary to Decimal Conversion

To convert from a number represented in the binary number system to a number represented in the decimal number system, all you need to do is add up the groups (whose size is always a power of two) represented by each position in the binary number. It helps to put things into a column to see the pattern. Thus, to convert the number 101011012 into the decimal number system:

The number 101011012:
has 1 group of size 27 = 1 x 27 = 128
has 0 group of size 26 = 0 x 26 = 0
has 1 group of size 25 = 1 x 25 = 32
has 0 group of size 24 = 0 x 24 = 0
has 1 group of size 23 = 1 x 23 = 8
has 1 group of size 22 = 1 x 22 = 4
has 0 group of size 21 = 0 x 21 = 0
has 1 group of size 20 = 1 x 20 = +   1
    173
Thus, 101011012 = 17310

For practice, you should see if you can show that 11001102 = 10210 and that 100010101112 = 111110.

 

Decimal to Binary Conversion

To convert from a number represented in the decimal number system to a number represented in the binary number system, all you need to do is repeatedly subtract the largest power of two that you can from the decimal number, then place ones or zeros in the correct position to represent these groups. To see what this means, let's look at how to do this with decimal numbers and then binary numbers:

How many stars are in the picture below?
BinDecP01.gif
It's hard to say offhand...

 

It's easier to count the stars if they are put into groups of 1, 10, 100, ...
BinDecP02.gif
It's easy to see that the picture contains:
1 group 100
3 groups of 10
2 "groups" of 1.
Thus, there are 132 stars.

 

To count in binary, look for groups of 1, 2, 4, 8, 16, 32, 64, 128, ...
BinDecP03.gif
It's easy to see that the picture contains:
1 group 128
0 groups of 64
0 groups of 32
0 groups of 16
0 groups of 8
1 group of 4
0 groups of 2
0 "groups" of 1.
Thus, there are 100001002 stars.
Therefore, 13210 = 100001002

To convert from decimal to binary by hand it is again easier to use a columnar format to keep things organized. The table below whows how to convert 201 into binary. Once you understand the example, try to see if you can show that 19610 = 110001002 and that 196710 = 111101011112.

To convert 20110 to binary:
it contains 1 group of size 27=128 1 201
-128
73
it contains 1 group of size 26=64 1 73
-64
9
it contains 0 group of size 25=32 0 9
-0
9
it contains 0 group of size 24=16 0 9
-0
9
it contains 1 group of size 23=8 1 9
-8
1
it contains 0 group of size 22=4 0 1
-0
1
it contains 0 group of size 21=2 0 1
-0
1
it contains 1 group of size 20=1 1 1
-1
0
Thus, 20110 = 110010012

 


| Mirus Home | MATC Home | Math Home | Math Club |
matclogo © 2003 by Kevin Mirus (kmirus@madison.edu or kjmirus@execpc.com).
This document was last modified .