Binary Addition

From ComputingForScientists

Jump to: navigation, search

Contents

  1. Adding Decimal Numbers
  2. Adding Binary Numbers
  3. Problems
    1. Running Out of Digits
    2. Running Out of Digits
    3. Carry Operations
    4. Binary Addition
    5. Binary Addition
    6. Binary Addition
    7. Binary Addition
    8. Base 16 Addition
  4. Activities
    1. Extending the Addition Algorithm
    2. Base 2 Multiplication
    3. Base 3 Addition
    4. Base 4 Addition
    5. Base 16 Addition
  5. Resources

1. Adding Decimal Numbers

The rules for adding binary numbers are similar to the rules for adding decimal numbers. When adding two decimal numbers such as

  2 3 6 5 8
+ 4 1 2 4 8
  _________

a series of rules are followed. First, a table of all possible two-digit sums of two decimal numbers must be known:

    0
  + 0
  ____
    0
    0
  + 1
  ____
    1
    0
  + 2
  ____
    2
    0
  + 3
  ____
    3
 ...
    9
  + 9
  ____
   18

The algorithm is:

  • Add the numbers in the right-most column using the table of all possible sums.
    • If the sum is one digit, write the sum at the bottom of the first column.
    • If the sum is two digits, write down the right-most digit of the sum at the bottom of the first column and put the left-most digit of the sum on the top of the column to the left of the first column. If there is no column to the left, write down this number to the left of the last number written down.
  • Repeat the above process for the next column.

For example,

        1  
  2 3 6 5 8
+ 4 1 2 4 8
  _________
          6
  • Add the numbers in the first column: 8 + 8 = 16.
    • Is the sum one digit? No.
    • Is the sum two digits? Yes. Place the right digit on the bottom of the first column and the left digit in the next column to the left of the first column.

2. Adding Binary Numbers

As with decimal numbers, we need a list of all possible sums of two binary numbers to refer to. They are

   
    0
 +  0
  ____
    0
  
    0
 +  1
  ____
    1
 
    1
 +  0
  ____
    1
  1
    1
 +  1
  ____
  1 0


Note that we arrived at the result

    1
  + 1
  ____
  1 0 

in binary by using the same rule that we use when we when we run out of symbols when counting in decimal. The last possible decimal symbol is 9, and to represent the next larger number, we place a zero in the right-most column and a one in the column to the left:

  1 
    1
 +  9
  ___
  1 0

In the case of binary numbers, to get the next value after the last possible binary symbol (1), we place a zero in the first column and a one in the second column: 1 0. (Another way of arriving at this result is to note that the binary representation of the decimal number 2 is 10.)

This algorithm can be applied to the addition of numbers in any base. For example, in base 3, the possible symbols are 0, 1, and 2. Using this rule, we arrive at 2+1 = 10 in base 3.

Example

Perform the following addition in binary:

  1 0 1 1 1
+ 0 0 1 0 1
  _________

The numbers in the first column are added (1+1 = 10 in binary) and the carry-over part is placed at the top of the next column:

        1  
  1 0 1 1 1
+ 0 0 1 0 1
  _________
          0

The same is done for the second column:

      1 1  
  1 0 1 1 1
+ 0 0 1 0 1
  _________
        0 0

The recipe given earlier only mentions adding two numbers, not three. To determine the sum of three 1s in binary, break the sum of three numbers into a sum of two numbers:

   1
   1        1 0 (result of adding the top two 1s)
 + 1  =>  + 0 1 (bottom 1 with a leading zero added for clarity)
  __        _____
            1 1

The final answer is

  1 0 1 1 0
+ 0 0 1 1 1
  _________
  1 1 1 0 1

To check your answer, convert the binary numbers to decimal numbers and do the addition in decimal.

  • The top row 10110 equals 22 in decimal (determined using the table method covered in the Binary Representation of Numbers).
  • The second row 00111 equals 7 in decimal (determined using the table method).
  • 22 + 7 = 29
  • The binary answer of 11101 equals 29 in decimal (determined using the table method).
  1 0 1 1 0  (22 in decimal)
+ 0 0 1 1 1  (7 in decimal)
  _________
  1 1 1 0 1  (29 in decimal)

3. Problems

3.1. Running Out of Digits

  1. What is the binary representation of the number that follows the binary number 111?
  2. What is the decimal representation of the number that follows the decimal number 999?

3.2. Running Out of Digits

The hexadecimal number system uses the 16 symbols 0, ..., 9, A, ..., F, where A-F correspond to the decimal numbers 10-15.

  • What is the hexadecimal representation of the number that follows F?
  • What is the hexadecimal representation of the number that follows the number given for your answer to the previous problem?

3.3. Carry Operations

  Y 1 1
  1 0 1 1 0
+ 0 0 1 1 1
  _________
    X 1 0 1

What are X and Y?

3.4. Binary Addition

Perform the following binary addition. Show your work.

   1 0 0 0 1 1 0 1 1 0 1
 + 1 1 1 0 0 1 1 0 1 1 1
   _____________________


3.5. Binary Addition

Perform the following binary addition. Show your work.

     0 1 1 0 1
  +  1 0 0 1 1
    ___________

3.6. Binary Addition

Perform the following binary addition. Show your work.

      1
      1
   +  1
    ___________

3.7. Binary Addition

Perform the following binary addition. Show your work.

    1 0 1 1 1 1 0 1 1 0 0
    0 0 1 0 1 1 0 1 1 0 1
  + 1 1 1 0 0 1 1 0 1 1 1
    _____________________

For a hint, look at the following activity:

3.8. Base 16 Addition

  1. Write out the table of all possible sums of the symbols 0, ..., 9, A, ..., F.
  2. Use the table to complete the following base-16 addition.
   0 B 3
 + 0 2 F
 ________

4. Activities

4.1. Extending the Addition Algorithm

Compute the following and write down any additional steps that you needed to add to the steps covered previously. Check your answer using the method covered previously.

   1 1
   1 1
   1 1
 + 1 1
  ____

4.2. Base 2 Multiplication

  1. Create a table of all possible products of the symbols 0 and 1.
  2. Use the table to complete the base-2 multiplication:
   1  1
 x 1  1
   ____

4.3. Base 3 Addition

  1. Write out the table of all possible sums of the symbols 0, 1, and 2.
  2. Use the table to complete the base-3 addition:
   0 1 2
 + 0 2 0
 ________

4.4. Base 4 Addition

  1. Write out the table of all possible sums of the symbols 0, 1, 2, and 3.
  2. Use the table to complete the base-4 addition:
   0 3 3
 + 0 2 0
 ________

4.5. Base 16 Addition

  1. Write out the table of all possible sums of the symbols 0, ..., 9, A, ..., F.
  2. Use the table to complete the base-16 addition:
   0 A F
 + 0 2 F
 ________

5. Resources

  • "A study of mathematical concepts for the elementary education major using tactile models and appropriate technology" [3]
  • Using a template-like method to determine if a credit card number is valid [4].
Personal tools