# binary number system

### Numbers versus numeration

It is imperative to understand that the type of numeration system used to represent numbers has no impact upon the outcome of any arithmetical function (addition, subtraction, multiplication, division, roots, powers, or logarithms). A number is a number is a number; one plus one will always equal two (so long as we’re dealing with *real* numbers), no matter how you symbolize one, one, and two. A prime number in decimal form is still prime if its shown in binary form, or octal, or hexadecimal. π is still the ratio between the circumference and diameter of acircle, no matter what symbol(s) you use to denote its value. The essential functions and interrelations of mathematics are unaffected by the particular system of symbols we might choose to represent quantities. This distinction between *numbers* and *systems of numeration* is critical to understand.

The essential distinction between the two is much like that between an object and the spoken word(s) we associate with it. A house is still a house regardless of whether we call it by its English name *house* or its Spanish name *casa*. The first is the actual thing, while the second is merely the symbol for the thing.

That being said, performing a simple arithmetic operation such as addition (longhand) in binary form can be confusing to a person accustomed to working with decimal numeration only. In this lesson, we’ll explore the techniques used to perform simple arithmetic functions on binary numbers, since these techniques will be employed in the design of electronic circuits to do the same. You might take longhand addition and subtraction for granted, having used a calculator for so long, but deep inside that calculator’s circuitry all those operations are performed “longhand,” using binary numeration. To understand how that’s accomplished, we need to review to the basics of arithmetic.

## Binary addition

Adding binary numbers is a very simple task, and very similar to the longhand addition of decimal numbers. As with decimal numbers, you start by adding the bits (digits) one column, or place weight, at a time, from right to left. Unlike decimal addition, there is little to memorize in the way of rules for the addition of binary bits:

0 + 0 = 0

1 + 0 = 1

0 + 1 = 1

1 + 1 = 10

1 + 1 + 1 = 11

Just as with decimal addition, when the sum in one column is a two-bit (two-digit) number, the least significant figure is written as part of the total sum and the most significant figure is “carried” to the next left column. Consider the following examples:

. 11 1 < --- Carry bits -----> 11

. 1001101 1001001 1000111

. + 0010010 + 0011001 + 0010110

. ——— ——— ———

. 1011111 1100010 1011101

The addition problem on the left did not require any bits to be carried, since the sum of bits in each column was either 1 or 0, not 10 or 11. In the other two problems, there definitely were bits to be carried, but the process of addition is still quite simple.

As we’ll see later, there are ways that electronic circuits can be built to perform this very task of addition, by representing each bit of each binary number as a voltage signal (either “high,” for a 1; or “low” for a 0). This is the very foundation of all the arithmetic which modern digital computers perform.

## Negative binary numbers

With addition being easily accomplished, we can perform the operation of subtraction with the same technique simply by making one of the numbers negative. For example, the subtraction problem of 7 – 5 is essentially the same as the addition problem 7 + (-5). Since we already know how to represent positive numbers in binary, all we need to know now is how to represent their negative counterparts and we’ll be able to subtract.

Usually we represent a negative decimal number by placing a minus sign directly to the left of the most significant digit, just as in the example above, with -5. However, the whole purpose of using binary notation is for constructing on/off circuits that can represent bit values in terms of voltage (2 alternative values: either “high” or “low”). In this context, we don’t have the luxury of a third symbol such as a “minus” sign, since these circuits can only be on or off (two possible states). One solution is to reserve a bit (circuit) that does nothing but represent th mathematical sign:

. 101_{2} = 5_{10} (positive)

.

. Extra bit, representing sign (0=positive, 1=negative)

. |

. 0101_{2} = 5_{10} (positive)

.

. Extra bit, representing sign (0=positive, 1=negative)

. |

. 1101_{2} = -5_{10} (negative)

As you can see, we have to be careful when we start using bits for any purpose other than standard place-weighted values. Otherwise, 1101_{2} could be misinterpreted as the number thirteen when in fact we mean to represent negative five. To keep things straight here, we must first decide how many bits are going to be needed to represent the largest numbers we’ll be dealing with, and then be sure not to exceed that bit field length in our arithmetic operations. For the above example, I’ve limited myself to the representation of numbers from negative seven (1111_{2}) to positive seven (0111_{2}), and no more, by making the fourth bit the “sign” bit. Only by first establishing these limits can I avoid confusion of a negative number with a larger, positive number.

Representing negative five as 1101_{2} is an example of the *sign-magnitude* system of negative binary numeration. By using the leftmost bit as a sign indicator and not a place-weighted value, I am sacrificing the “pure” form of binary notation for something that gives me a practical advantage: the representation of negative numbers. The leftmost bit is read as the sign, either positive or negative, and the remaining bits are interpreted according to the standard binary notation: left to right, place weights in multiples of two.

As simple as the sign-magnitude approach is, it is not very practical for arithmetic purposes. For instance, how do I add a negative five (1101_{2}) to any other number, using the standard technique for binary addition? I’d have to invent a new way of doing addition in order for it to work, and if I do that, I might as well just do the job with longhand subtraction; there’s no arithmetical advantage to using negative numbers to perform subtraction through addition if we have to do it with sign-magnitude numeration, and that was our goal!

There’s another method for representing negative numbers which works with our familiar technique of longhand addition, and also happens to make more sense from a place-weighted numeration point of view, called *complementation*. With this strategy, we assign the leftmost bit to serve a special purpose, just as we did with the sign-magnitude approach, defining our number limits just as before. However, this time, the leftmost bit is more than just a sign bit; rather, it possesses a negative place-weight value. For example, a value of negative five would be represented as such:

Extra bit, place weight = negative eight

. |

. 1011_{2} = 5_{10} (negative)

.

. (1 x -8_{10}) + (0 x 4_{10}) + (1 x 2_{10}) + (1 x 1_{10}) = -5_{10}

With the right three bits being able to represent a magnitude from zero through seven, and the leftmost bit representing either zero or negative eight, we can successfully represent any integer number from negative seven (1001_{2} = -8_{10} + 1_{10} = -1_{10}) to positive seven (0111_{2} = 0_{10} + 7_{10} = 7_{10}).

Representing positive numbers in this scheme (with the fourth bit designated as the negative weight) is no different from that of ordinary binary notation. However, representing negative numbers is not quite as straightforward:

zero 0000

positive one 0001 negative one 1111

positive two 0010 negative two 1110

positive three 0011 negative three 1101

positive fou 0100 negative four 1100

positive five 0101 negative five 1011

positive six 0110 negative six 1010

positive seven 0111 negative seven 1001

. negative eight 1000

Note that the negative binary numbers in the right column, being the sum of the right three bits’ total plus the negative eight of the leftmost bit, don’t “count” in the same progression as the positive binary numbers in the left column. Rather, the right three bits have to be set at the proper value to equal the desired (negative) total when summed with the negative eight place value of the leftmost bit.

Those right three bits are referred to as the *two’s complement* of the corresponding positive number. Consider the following comparison:

positive number two’s complement

————— —————-

001 111

010 110

011 101

100 100

101 011

110 010

111 001

In this case, with the negative weight bit being the fourth bit (place value of negative eight), the two’s complement for any positive number will be whatever value is needed to add to negative eight to make that positive value’s negative equivalent. Thankfully, there’s an easy way to figure out the two’s complement for any binary number: simply invert all the bits of that number, changing all 1’s to 0’s and vice versa (to arrive at what is called the *one’s complement*) and then add one! For example, to obtain the two’s complement of five (101_{2}), we would first invert all the bits to obtain 010_{2} (the “one’s complement”), then add one to obtain 011_{2}, or -5_{10} in three-bit, two’s complement form.

Interestingly enough, generating the two’s complement of a binary number works the same if you manipulate *all* the bits, including the leftmost (sign) bit at the same time as the magnitude bits. Let’s try this with the former example, converting a positive five to a negative five, but performing the complementation process on all four bits. We must be sure to include the 0 (positive) sign bit on the original number, five (0101_{2}). First, inverting all bits to obtain the one’s complement: 1010_{2}. Then, adding one, we obtain the final answer: 1011_{2}, or -5_{10} expressed in four-bit, two’s complement form.

It is critically important to remember that the place of the negative-weight bit must be already determined before any two’s complement conversions can be done. If our binary numeration field were such that the eighth bit was designated as the negative-weight bit (10000000_{2}), we’d have to determine the two’s complement based on all seven of the other bits. Here, the two’s complement of five (0000101_{2}) would be 1111011_{2}. A positive five in this system would be represented as 00000101_{2}, and a negative five as 11111011_{2}.

COMMENTsongsThanks for writing the article which has defined Binary Number System in a clear and easy-to-understand way. Those interested to know more about the topic could access the link http://www.engpaper.com and click Learning Tools.

Richard