BINARY NUMBER SYSTEM
Introduction
The number system that you are familiar with, that you use every day,
is the decimal number system, also commonly referred to as the base-10
system. When you perform computations such as 3 + 2 = 5, or 21 – 7 = 14,
you are using the decimal number system. This system, which you likely
learned in first or second grade, is ingrained into your subconscious; it’s the
natural way that you think about numbers. Evidence exists that Egyptians were
using a decimal number system five thousand years ago. The Roman numeral
system, predominant for hundreds of years, was also a decimal number system
(though organized differently from the Arabic base-10 number system that we
are most familiar with). Indeed, base-10 systems, in one form or another, have
been the most widely used number systems ever since civilization started
counting.
In dealing with the inner workings of a computer, though, you are going
to have to learn to think in a different number system, the binary number
system, also referred to as the base-2 system.
Consider a child counting a pile of pennies. He would begin: “One, two,
three, …, eight, nine.” Upon reaching nine, the next penny counted makes the
total one single group of ten pennies. He then keeps counting: “One group of
ten pennies… two groups of ten pennies… three groups of ten pennies … eight
groups of ten pennies … nine groups of ten pennies…” Upon reaching nine
groups of ten pennies plus nine additional pennies, the next penny counted
makes the total thus far: one single group of one hundred pennies. Upon
completing the task, the child might find that he has three groups of one
hundred pennies, five groups of ten pennies, and two pennies left over: 352
pennies.
More formally, the base-10 system is a positional system, where the
rightmost digit is the ones position (the number of ones), the next digit to the
left is the tens position (the number of groups of 10), the next digit to the left
is the hundreds position (the number of groups of 100), and so forth. The base-
10 number system has 10 distinct symbols, or digits (0, 1, 2, 3,…8, 9). In
decimal notation, we write a number as a string of symbols, where each
symbol is one of these ten digits, and to interpret a decimal number, we
multiply each digit by the power of 10 associated with that digit’s position.
www.BrainKart.com
,For example, consider the decimal number: 6349. This number is:
Consider: Computers are built from transistors, and an individual transistor
can only be ON or OFF (two options). Similarly, data storage devices can be
optical or magnetic. Optical storage devices store data in a specific location by
controlling whether light is reflected off that location or is not reflected off that
location (two options). Likewise, magnetic storage devices store data in a specific
location by magnetizing the particles in that location with a specific orientation.
We can have the north magnetic pole pointing in one direction, or the opposite
direction (two options).
Computers can most readily use two symbols, and therefore a base-2
system, or binary number system, is most appropriate. The base-10 number
system has 10 distinct symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. The base-2 system
has exactly two symbols: 0 and 1. The base-10 symbols are termed digits. The
base-2 symbols are termed binary digits, or bits for short. All base-10 numbers
are built as strings of digits (such as 6349). All binary numbers are built as strings
of bits (such as 1101). Just as we would say that the decimal number 12890 has
five digits, we would say that the binary number 11001 is a five-bit number.
2 The Binary Number System
Consider again the example of a child counting a pile of pennies, but this
time in binary.
He would begin with the first penny: “1.” The next penny counted makes the total
one single group of two pennies. What number is this?
When the base-10 child reached nine (the highest symbol in his scheme),
the next penny gave him “one group of ten”, denoted as 10, where the “1”
indicated one collection of ten.
Similarly, when the base-2 child reaches one (the highest symbol in his scheme),
the next penny gives him “one group of two”, denoted as 10, where the “1”
indicates one collection of two.
www.BrainKart.com
, Back to the base-2 child: The next penny makes one group of two pennies
and one additional penny: “11.” The next penny added makes two groups of two,
which is one group of 4: “100.” The “1” here indicates a collection of two groups
of two, just as the “1” in the base-10 number 100 indicates ten groups of ten.
Upon completing the counting task, base -2 child might find that he has
one group of four pennies, no groups of two pennies, and one penny left over:
101 pennies. The child counting the same pile of pennies in base-10 would
conclude that there were 5 pennies. So, 5 in base-10 is equivalent to101 in base-
2. To avoid confusion when the base in use if not clear from the context, or when
using multiple bases in a single expression, we append a subscript to the number
to indicate the base, and write:
510 =1012
Just as with decimal notation, we write a binary number as a string of
symbols, but now each symbol is a 0 or a 1. To interpret a binary number, we
multiply each digit by the power of 2 associated with that digit’s position.
For example, consider the binary number 1101. This number is:
Since binary numbers can only contain the two symbols 0 and 1, numbers
such as 25 and 1114000 cannot be binary numbers.
We say that all data in a computer is stored in binary—that is, as 1’s and
0’s. It is important to keep in mind that values of 0 and 1 are logical values, not
the values of a physical quantity, such as a voltage. The actual physical binary
values used to store data internally within a computer might be, for instance, 5
volts and 0 volts, or perhaps 3.3 volts and 0.3 volts or perhaps reflection and no
reflection. The two values that are used to physically store data can differ within
different portions of the same computer. All that really matters is that there are
two different symbols, so we will always refer to them as 0 and 1.
www.BrainKart.com
, A string of eight bits (such as 11000110) is termed a byte. A collection of
four bits (such as 1011) is smaller than a byte, and is hence termed a nibble. (This
is the sort of nerd-humor for which engineers are famous.)
The idea of describing numbers using a positional system, as we have illustrated
for base-10 and base-2, can be extended to any base. For example, the base-4
number 231 is:
3 Converting Between Binary Numbers and Decimal
Numbers
We humans about numbers using the decimal number system, whereas computers
use the binary number system. We need to be able to readily shift between the
binary and decimal number representations.
Converting a Binary Number to a Decimal Number
To convert a binary number to a decimal number, we simply write the binary
number as a sum of powers of 2. For example, to convert the binary
number 1011 to a decimal number, we note that the rightmost position is the
ones position and the bit value in this position is a 1. So, this rightmost bit has
the decimal value of 1⋅20 . The next position to the left is the twos position, and
the bit value in this position is also a 1. So, this next bit has the decimal value of
1⋅ 21 . The next position to the left is the fours position, and the bit value in this
position is a 0. The leftmost position is the eights position, and the bit value in
this position is a 1. So, this leftmost bit has the decimal value of 1⋅23 . Thus:
1. The binary number 110110 as a decimal number. Solution:
For example, to convert the binary number 10101 to decimal, we annotate
the position values below the bit values:
www.BrainKart.com
Introduction
The number system that you are familiar with, that you use every day,
is the decimal number system, also commonly referred to as the base-10
system. When you perform computations such as 3 + 2 = 5, or 21 – 7 = 14,
you are using the decimal number system. This system, which you likely
learned in first or second grade, is ingrained into your subconscious; it’s the
natural way that you think about numbers. Evidence exists that Egyptians were
using a decimal number system five thousand years ago. The Roman numeral
system, predominant for hundreds of years, was also a decimal number system
(though organized differently from the Arabic base-10 number system that we
are most familiar with). Indeed, base-10 systems, in one form or another, have
been the most widely used number systems ever since civilization started
counting.
In dealing with the inner workings of a computer, though, you are going
to have to learn to think in a different number system, the binary number
system, also referred to as the base-2 system.
Consider a child counting a pile of pennies. He would begin: “One, two,
three, …, eight, nine.” Upon reaching nine, the next penny counted makes the
total one single group of ten pennies. He then keeps counting: “One group of
ten pennies… two groups of ten pennies… three groups of ten pennies … eight
groups of ten pennies … nine groups of ten pennies…” Upon reaching nine
groups of ten pennies plus nine additional pennies, the next penny counted
makes the total thus far: one single group of one hundred pennies. Upon
completing the task, the child might find that he has three groups of one
hundred pennies, five groups of ten pennies, and two pennies left over: 352
pennies.
More formally, the base-10 system is a positional system, where the
rightmost digit is the ones position (the number of ones), the next digit to the
left is the tens position (the number of groups of 10), the next digit to the left
is the hundreds position (the number of groups of 100), and so forth. The base-
10 number system has 10 distinct symbols, or digits (0, 1, 2, 3,…8, 9). In
decimal notation, we write a number as a string of symbols, where each
symbol is one of these ten digits, and to interpret a decimal number, we
multiply each digit by the power of 10 associated with that digit’s position.
www.BrainKart.com
,For example, consider the decimal number: 6349. This number is:
Consider: Computers are built from transistors, and an individual transistor
can only be ON or OFF (two options). Similarly, data storage devices can be
optical or magnetic. Optical storage devices store data in a specific location by
controlling whether light is reflected off that location or is not reflected off that
location (two options). Likewise, magnetic storage devices store data in a specific
location by magnetizing the particles in that location with a specific orientation.
We can have the north magnetic pole pointing in one direction, or the opposite
direction (two options).
Computers can most readily use two symbols, and therefore a base-2
system, or binary number system, is most appropriate. The base-10 number
system has 10 distinct symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. The base-2 system
has exactly two symbols: 0 and 1. The base-10 symbols are termed digits. The
base-2 symbols are termed binary digits, or bits for short. All base-10 numbers
are built as strings of digits (such as 6349). All binary numbers are built as strings
of bits (such as 1101). Just as we would say that the decimal number 12890 has
five digits, we would say that the binary number 11001 is a five-bit number.
2 The Binary Number System
Consider again the example of a child counting a pile of pennies, but this
time in binary.
He would begin with the first penny: “1.” The next penny counted makes the total
one single group of two pennies. What number is this?
When the base-10 child reached nine (the highest symbol in his scheme),
the next penny gave him “one group of ten”, denoted as 10, where the “1”
indicated one collection of ten.
Similarly, when the base-2 child reaches one (the highest symbol in his scheme),
the next penny gives him “one group of two”, denoted as 10, where the “1”
indicates one collection of two.
www.BrainKart.com
, Back to the base-2 child: The next penny makes one group of two pennies
and one additional penny: “11.” The next penny added makes two groups of two,
which is one group of 4: “100.” The “1” here indicates a collection of two groups
of two, just as the “1” in the base-10 number 100 indicates ten groups of ten.
Upon completing the counting task, base -2 child might find that he has
one group of four pennies, no groups of two pennies, and one penny left over:
101 pennies. The child counting the same pile of pennies in base-10 would
conclude that there were 5 pennies. So, 5 in base-10 is equivalent to101 in base-
2. To avoid confusion when the base in use if not clear from the context, or when
using multiple bases in a single expression, we append a subscript to the number
to indicate the base, and write:
510 =1012
Just as with decimal notation, we write a binary number as a string of
symbols, but now each symbol is a 0 or a 1. To interpret a binary number, we
multiply each digit by the power of 2 associated with that digit’s position.
For example, consider the binary number 1101. This number is:
Since binary numbers can only contain the two symbols 0 and 1, numbers
such as 25 and 1114000 cannot be binary numbers.
We say that all data in a computer is stored in binary—that is, as 1’s and
0’s. It is important to keep in mind that values of 0 and 1 are logical values, not
the values of a physical quantity, such as a voltage. The actual physical binary
values used to store data internally within a computer might be, for instance, 5
volts and 0 volts, or perhaps 3.3 volts and 0.3 volts or perhaps reflection and no
reflection. The two values that are used to physically store data can differ within
different portions of the same computer. All that really matters is that there are
two different symbols, so we will always refer to them as 0 and 1.
www.BrainKart.com
, A string of eight bits (such as 11000110) is termed a byte. A collection of
four bits (such as 1011) is smaller than a byte, and is hence termed a nibble. (This
is the sort of nerd-humor for which engineers are famous.)
The idea of describing numbers using a positional system, as we have illustrated
for base-10 and base-2, can be extended to any base. For example, the base-4
number 231 is:
3 Converting Between Binary Numbers and Decimal
Numbers
We humans about numbers using the decimal number system, whereas computers
use the binary number system. We need to be able to readily shift between the
binary and decimal number representations.
Converting a Binary Number to a Decimal Number
To convert a binary number to a decimal number, we simply write the binary
number as a sum of powers of 2. For example, to convert the binary
number 1011 to a decimal number, we note that the rightmost position is the
ones position and the bit value in this position is a 1. So, this rightmost bit has
the decimal value of 1⋅20 . The next position to the left is the twos position, and
the bit value in this position is also a 1. So, this next bit has the decimal value of
1⋅ 21 . The next position to the left is the fours position, and the bit value in this
position is a 0. The leftmost position is the eights position, and the bit value in
this position is a 1. So, this leftmost bit has the decimal value of 1⋅23 . Thus:
1. The binary number 110110 as a decimal number. Solution:
For example, to convert the binary number 10101 to decimal, we annotate
the position values below the bit values:
www.BrainKart.com