Associated Topics || Dr. Math Home || Search Dr. Math

### Digital Computers and Binary

Date: 07/02/2000 at 15:23:19
From: Marcia
Subject: Digital computers and the binary number system

How do digital computers use the binary number system?

Date: 07/10/2000 at 16:32:55
From: Doctor TWE
Subject: Re: Digital computers and the binary number system

Hi Marcia - thanks for writing to Dr. Math.

Wow! There's a lot to that question, but I'll try to cut to the chase.

Computers are electronic devices that use small components called
transistors to record and process information. As used in digital
computers, each transistor is like an on/off switch. (They can also be
used as amplifiers, where the output is a fixed multiple of the input,
but that's not how they're used in computers.) When used to store
numbers, a transistor that's "on" (or saturated) represents the digit
1 and a transistor that's "off" (or cut off) represents the digit 0.

With a single transistor, therefore, I can only count 0 and 1. But as
in the decimal system, I can use more digits to represent a number.
How do we represent numbers larger than 9 in decimal? We add more
digits. The next place value in decimal is 10 (because we had to stop
at 9 with 1 digit), and we can proceed 10, 11, 12, etc. These
represent:

10   1  <- Place values
--   -
1   0  =  1*10 + 0*1  =  10 + 0  =  10
1   1  =  1*10 + 1*1  =  10 + 1  =  11
1   2  =  1*10 + 2*1  =  10 + 2  =  12
:   :      :      :         :        :
1   9  =  1*10 + 9*1  =  10 + 9  =  19
2   0  =  2*10 + 0*1  =  20 + 0  =  20
2   1  =  2*10 + 1*1  =  20 + 1  =  21
2   2  =  2*10 + 2*1  =  20 + 2  =  22
:   :      :      :         :        :
9   9  =  9*10 + 9*1  =  90 + 9  =  99

Once I reach 99, I've exhausted all combinations of two digits, so I
have to add a third digit to represent 100. Then I can continue to 999
before requiring a fourth digit, and so on.

In binary, I can't represent a 2 as a single digit (I only have 0 and
1 as digits), so I'll need a new place value for 2's. Thus the second
place value in binary will be 2's and

2   1  <- Place values
-   -
1   0  =  1*2 + 0*1  =  2 + 0  =  2 (decimal)
1   1  =  1*2 + 1*1  =  2 + 1  =  3 (decimal)

Now I've exhausted all combinations of 2 digits, so I have to go to 3
digits. My next place value will be 4 (since 3 was the largest number
I could count to using 2 digits.) So I'll have:

4   2   1  <- Place values
-   -   -
1   0   0  =  1*4 + 0*2 + 0*1  =  4 + 0 + 0  =  4 (decimal)
1   0   1  =  1*4 + 0*2 + 1*1  =  4 + 0 + 1  =  5 (decimal)
1   1   0  =  1*4 + 1*2 + 0*1  =  4 + 2 + 0  =  6 (decimal)
1   1   1  =  1*4 + 1*2 + 1*1  =  4 + 2 + 1  =  7 (decimal)

My next place value will need to be 8, and I could continue.

Let's look at the place values for a moment. In decimal, our place
values are:

1,000    100     10      1

which is the same as:

10^3   10^2   10^1   10^0

They are all powers of 10. Why? Because we're in base 10 and we have
10 digits (0 through 9) to represent numbers. In binary, our place
values are:

8     4     2     1

which is the same as:

2^3   2^2   2^1   2^0

They are all powers of 2. Why? Because we're in base 2 and we only
have 2 digits (0 and 1) to represent numbers.

Using this system, we can develop rules for adding, subtracting,
multiplying, dividing, representing fractions, etc. that parallel
what we do in decimal.

Number Bases at:

http://mathforum.org/dr.math/faq/faq.bases.html

Computers use millions of transistors to represent numbers in binary
and to do operations such as addition and subtraction. These
transistors are usually arranged in groups of 8, 16, 32 or 64 (and
sometimes 40 or 80) for convenience.

on/off is easy. It's easy to make a circuit that is either on or off,
and to make circuits that detect whether another circuit is on or off.
It is much more difficult to make circuits that can be in one of ten
different states, and to make circuits that can detect which of those
states another circuit is in. Think of an on/off light switch as
opposed to those three-way switches. Designing a switch with ten
different positions is even more complicated. Now imagine trying to
detect which of the ten "brightnesses" the light bulb is at. So even
though binary requires more digits (called "bits"), it is easier to
work with on a circuit design level.

I hope this helps. If you have any more questions, or want more
specific information, write back.

- Doctor TWE, The Math Forum
http://mathforum.org/dr.math/

Associated Topics:
High School Number Theory

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search