Skip to main content
Engineering LibreTexts

1.1: Binary Numbers

  • Page ID
    27015
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    1.1.1 Values for Binary Numbers

    Many students will have had a class covering logic or Boolean algebra, where the binary values are generally true(T) and false(F), and use special symbols such as "^" for AND and "˅" for OR. This might be fine for mathematics and logic, but is hopelessly inadequate for the engineering task of creating computer machines and languages.

    To begin, the physical implementation of a binary value in a Central Processing Unit's (CPU) hardware, called a bit, is implemented as a circuit called a flip-flop or latch. A flip-flop has a voltage of either 0 volts or a positive voltage (most computers use +5 volts, but many modern computers use +3.3 volts, and any positive voltage is valid). If a flip-flop has a positive voltage it is called high or on (true), and if it has 0 volts it is low or off (false). In addition hardware is made up of gates that which can either be open (true) or closed (false). Finally the goal of a computer is to be able to work with data that a person can understand. These numbers are always large, and hard to represent as a series of true or false values. When the values become large, people work best with numbers, so the binary number 0 is called false, and 1 is called true. Thus while computers work with binary, there are a number of ways we can talk about that binary. If the discussion is about memory, the value is high, on, or 1. When the purpose is to describe a gate, it is open/closed. If there is a logical operations values can be true/false. The following table summarizes the binary value naming conventions.

    Table 1-1: Various names for binary values

    T/F

    Number

    Switch

    Voltage

    Gate

    F

    0

    Off

    Low

    Closed

    T

    1

    On

    High

    Open

    In addition to the various names, engineers are more comfortable with real operators. This book will follow the convention that "+" is an OR operator, "*" is an AND operator, and "!" (pronounced bang) is a not operator.

    Some students are uncomfortable with the ambiguity in the names for true and false. They often feel that the way the binary values were presented in their mathematics classes (as true/false) is the "correct" way to represent them. But keep in mind that this class is about implementing a computer in hardware. There is no correct, or even more correct, way to discuss binary values. How they will be referred to will depend on the way in which the value is being used. Understanding a computer requires the individual to be adaptable to all of these ways of referring to binary values. They will all be used in this text, though most of the time the binary values of 0 and 1 will be used.

    1.1.2 Binary Whole Numbers

    The numbering system that everyone learns in school is called decimal or base 10. This numbering system is called decimal because it has 10 digits, [0..9]. Thus quantities up to 9 can be easily referenced in this system by a single number.

    Computers use switches that can be either on (1) or off(0), and so computers use the binary, or base 2, numbering system. In binary, there are only two digits, 0 and 1. So values up to 1 can be easily represented by a single digit. Having only the ability to represent 0 or 1 items is too limiting to be useful. But then so are the 10 values which can be used in the decimal system. The question is how does the decimal handle the problem of numbers greater than 9, and can binary use the same idea?

    In decimal when 1 is added to 9 the number 10 is created. The number 10 means that there is 1 group of ten numbers, and 0 one number. The number 11 is 1 group of 10 and 1 group of one.

    When 99 is reached, we have 100, which is 1 group of hundred, 0 tens, and 0 ones. So the number 1,245 would be:

    1,245 = 1*103 + 2*102 + 4*101+ 5*100

    Base 2 can be handled in the same manner. The number 102 (base 2) is 1 group of two and 0 ones, or just 210 (base 10).1 Counting in base 2 is the same. To count in base 2, the numbers are 02, 12, 102, 112, 1002, 1012, 1102 1112, etc. Any number in base 2 can be converted to base 10 using this principal. Consider 1010112, which is:

    1*25 + 0*24 + 1*23 + 0 *22 + 1*21 + 1*20 = 32 + 8 + 2 + 1 = 4310

    In order to work with base 2 number, it is necessary to know the value of the powers of 2. The following table gives the powers of 2 for the first 16 numbers (to 215). It is highly recommended that students memorize at least the first 11 values of this table (to 210), as these will be used frequently.

    Table 1-2: Values of 2n for n = 0...15
    n n2 n n2 n n2 n n2

    0

    1

    4

    16

    8

    256

    12

    4096

    1

    2

    5

    32

    9

    512

    13

    8192

    2

    4

    6

    64

    10

    1024

    14

    16348

    3

    8

    7

    126

    11

    2048

    15

    32768

    The first 11 powers of 2 are the most important because the values of 2n are named when n is a decimal number evenly dividable by 10. For example 210 is 1 Kilo, 220 is 1 Meg, etc. The names for these value of 2n are given in the following table. Using these names and the values of 2n from 0-9, it is possible to name all of the binary numbers easily as illustrated below. To find the value of 216 , we would write:

    216 = 210*26= 1K * 64 = 64K

    Older programmers will recognize this as the limit to the segment size on older PC's which could only address 16 bits. Younger students will recognize the value of 232, which is:

    232 = 230 * 22 = 1G * 4 = 4G

    4M was the limit of memory available on more recent PC's with 32 bit addressing, though that limit has been moved with the advent of 64 bit computers. The names for the various values of 2n are given in the following table.

    210

    Kilo

    230

    Giga

    250

    Penta

    220

    Mega

    240

    Tera

    260

    Exa


    1 The old joke is that there are 10 types of people in the world, those who know binary and those who do not.


    This page titled 1.1: Binary Numbers is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by Charles W. Kann III.

    • Was this article helpful?