SOLUTION: evaluate the following in base (2) arithmetic (a) 1010+11011+111011 (b) 1100110-100111

Algebra ->  Finance -> SOLUTION: evaluate the following in base (2) arithmetic (a) 1010+11011+111011 (b) 1100110-100111      Log On


   



Question 1172437: evaluate the following in base (2) arithmetic
(a) 1010+11011+111011
(b) 1100110-100111

Found 3 solutions by greenestamps, Edwin McCravy, mccravyedwin:
Answer by greenestamps(13209) About Me  (Show Source):
You can put this solution on YOUR website!


There are many different ways to perform operations like these in base 2. I will demonstrate a couple of different options for each problem.

a) 1010+11011+111011

(1) One option is to add two of the numbers in base 2 and then add the third number to that sum. This is a good option for adding three numbers in base 2, because adding two numbers in base 2 is a fairly simple process. You wouldn't want to use this method if you were adding 10 or 100 numbers in base 2.

The addition table for base 2:

0 1
+-------
0 | 0 1
1 | 1 10
Adding the first two numbers in base 2:
1 1 <-- the "carry"s
1 0 1 0
1 1 0 1 1
----------
1 0 0 1 0 1
In detail....
last (rightmost) column: 0+1 = 1
2nd column: 1+1 = 10; write the 0 and carry the 1
3rd column: 1+0+0 = 1
4th column: 1+1 = 10; write the 0 and carry the 1
5th column: 1+1 = 10; write the 0 and carry the 1
done
Then adding the third number to that sum:
1 1 1 1 1 1 <-- the "carry"s
1 0 0 1 0 1 <-- sum of first two base 2 numbers
1 1 1 0 1 1 <-- third number
------------
1 1 0 0 0 0 0
In detail....
last (rightmost) column: 1+1 = 10; write the 0 and carry the 1
2nd column: 1+1 = 10; write the 0 and carry the 1
3rd column: 1+1 = 10; write the 0 and carry the 1
4th column: 1+1 = 10; write the 0 and carry the 1
5th column: 1+1 = 10; write the 0 and carry the 1
6th column: 1+1+1 = 11; write the 1 and carry the 1
done
ANSWER: 1010+11011+111011 = 1100000 (base 2)
(2) Another option is to add all the numbers at the same time using base 10 arithmetic, obtaining column sums in base 10, then convert those base 10 digits to base 2.
1 0 1 0
1 1 0 1 1
1 1 1 0 1 1
------------
1 2 3 0 3 2
Now, starting from the rightmost column again, convert the base 10 digits to base 2.
2 (base 10) = 10 (base 2): 1 2 3 0 3 2 --> 1 2 3 0 3 0
+ 1 0
-----------
1 2 3 0 4 0
4 (base 10) = 100 (base 2): 1 2 3 0 4 0 -->
1 2 3 0 0 0
+ 1 0 0 0
-----------
1 2 4 0 0 0
4 (base 10) = 100 (base 2): 1 2 4 0 0 0 -->
1 2 0 0 0 0
+ 1 0 0 0 0 0
------------
2 2 0 0 0 0
2 (base 10) = 10 (base 2): 2 2 0 0 0 0 -->
2 0 0 0 0 0
+ 1 0 0 0 0 0
-----------
3 0 0 0 0 0
3 (base 10) = 11 (base 2): 3 0 0 0 0 0 --> 1 1 0 0 0 0 0
And again the answer is 1010+11011+111011 = 1100000 (base 2)

(b) 1100110-100111
(1) One option is to use the same process as in base 10, but doing all the arithmetic in base 2.
Let's look first at a subtraction problem in base 10, where "borrowing" is required. We will modify the process a bit from what is usually taught in schools.
4 3 6
- 2 5 7
--------
Borrowing is required. We take 1 from the 3, making it a 2 and changing the 6 to 16. Then we have to borrow in the next column also, so we take 1 from the 4, making that a 3 and making the 2 a 12. Then we have a subtraction where no borrowing is required:
3 12 16
- 2 5 7
--------
1 7 9
Now let's do the same thing for our base 2 subtraction problem.
1 1 0 0 1 1 0
- 1 0 0 1 1 1
--------------
last (rightmost) column: we need to borrow; make the 1 in the column to the left 0 and change the 0 to a 2:
1 1 0 0 1 0 2
- 1 0 0 1 1 1
--------------
next column: we need to borrow again; make the 1 in the column to the left 0 and change the 0 to a 2:
1 1 0 0 0 2 2
- 1 0 0 1 1 1
--------------
third column: we need to borrow again; now we need to go several places to the left to find where we can do the borrowing. Change the "1 0 0 0" to "0 1 1 2":
1 0 1 1 2 2 2
- 1 0 0 1 1 1
--------------
And now at the left we need to borrow one last time; change the leading "1 0" to "0 2":
0 2 1 1 2 2 2
- 1 0 0 1 1 1
--------------
And now we can do the subtraction without borrowing:
0 2 1 1 2 2 2
- 1 0 0 1 1 1
--------------
1 1 1 1 1 1
ANSWER: 1100110-100111 = 111111 (base 2)
(2) In base 2, as in base 10, it is sometimes easier to do a subtraction by changing one of the numbers first and then correcting the result accordingly.
For example, in base 10, you might do the subtraction 1000-736 by first doing 999-736 = 263 and then adding 1 to the result. Or you might so the subtraction 39527-19528 by first doing 39528-19528 = 20000 and then subtracting 1 from the result.
In this base 2 subtraction problem, the final digits of the two numbers differ by 1, so this strategy can be useful.
So instead of doing 1100110-100111, we can do 1100111-100111 and then subtract 1 from our result.
1 1 0 0 1 1 1
- 1 0 0 1 1 1
--------------
1 0 0 0 0 0 0
Then subtracting 1 from this result we get the previous result:
1 0 0 0 0 0 0
- 1
--------------
1 1 1 1 1 1
And here too we see this result agrees with the one we got previously.
Note that last subtraction in base 2, where details of the subtraction process are not shown, is similar to 1000000-1 = 999999 in base 10.

Answer by Edwin McCravy(20064) About Me  (Show Source):
You can put this solution on YOUR website!
Here is an alternate approach.  It, of course amounts to the same thing,
but it's more like ordinary addition that you learned in early grades.

Learn to count in base (2) this way: 1,10,11,100,101,110,111,1000,...
Write the numbers to add in a column the same way you do ordinary base (10)
numbers, but leave room between them because you often need to carry more than
one digit:

         1  0  1  0
      1  1  0  1  1
   1  1  1  0  1  1
-------------------
                
Add the right most column, 0+1+1=10, put down the 0 and carry the 1. I'll
put all the "carry"-numbers in red, and the digits in the answer in blue: 

               1
         1  0  1  0
      1  1  0  1  1
   1  1  1  0  1  1
-------------------
                  0  

Add the 2nd column from the right, 1+1+1+1=100, put down the 0 and carry 10

           10  1
         1  0  1  0
      1  1  0  1  1
   1  1  1  0  1  1
-------------------
               0  0  

Add the 3rd column from the right, 10+0+0+0=10, put down 0, and carry 1:

         1 10  1
         1  0  1  0
      1  1  0  1  1
   1  1  1  0  1  1
-------------------
            0  0  0 

Add the 4th column from the right, 1+1+1+1=100, put down 0 and carry 10:

     10  1 10  1
         1  0  1  0
      1  1  0  1  1
   1  1  1  0  1  1
--------------------
         0  0  0  0 



Add the 5th column from the right, 10+1+1=100, put down 0 and carry 10:


  10 10  1 10  1
         1  0  1  0
      1  1  0  1  1
   1  1  1  0  1  1
--------------------
      0  0  0  0  0 

Add the 6th column from the right, 10+1=11, put down 1 and carry 1 to a new
column on the far left, there is nothing to add, so bring down the 1:


 1 10 10  1 10  1
          1  0  1  0
       1  1  0  1  1
    1  1  1  0  1  1
--------------------
 1  1  0  0  0  0  0

So the answer is 1100000.

Edwin

Answer by mccravyedwin(409) About Me  (Show Source):
You can put this solution on YOUR website!
   1   1   0   0   1   1   0
-      1   0   0   1   1   1
----------------------------

We can do subtracting by borrowing, but it's easier to do backwards addition.
So put it down like this, with a row of question marks at the top:

   ?   ?   ?   ?   ?   ?   ?
+      1   0   0   1   1   1
   -------------------------
   1   1   0   0   1   1   0

We know that ?+1=10.  Since 1+1=10, the last "?" on the right end has to be a 1.  There is a 0 at the bottom and we carry 1:

                       1 
   ?   ?   ?   ?   ?   ?   1
+      1   0   0   1   1   1
   -------------------------
   1   1   0   0   1   1   0

We know that 1+?+1=11.  Since 1+1+1=11, the last "?" on the right end has to be a 1, and there is a 1 at the bottom and we carry 1:

                   1   1 
   ?   ?   ?   ?   ?   1   1
+      1   0   0   1   1   1
   -------------------------
   1   1   0   0   1   1   0

Same thing again. We know that 1+?+1=11, the last "?" on the right has to be a 1, and there is a 1 at the bottom and we carry 1:

               1   1   1 
   ?   ?   ?   ?   1   1   1
+      1   0   0   1   1   1
   -------------------------
   1   1   0   0   1   1   0

We know that 1+?+0=10, the last "?" on the right has to be a 1, and there is a 0 at the bottom and we carry 1:

           1   1   1   1 
   ?   ?   ?   1   1   1   1
+      1   0   0   1   1   1
   -------------------------
   1   1   0   0   1   1   0

As before, we know that 1+?+0=10, the last "?" has to be a 1, and there is a 0 at the bottom and we carry 1:

       1   1   1   1   1 
   ?   ?   1   1   1   1   1
+      1   0   0   1   1   1
   -------------------------
   1   1   0   0   1   1   0

We know that 1+?+1=11.  Since 1+1+1=11, the last "?" has to be a 1, and there is a 1 at the bottom and we carry 1:

   1   1   1   1   1   1 
   ?   1   1   1   1   1   1
+      1   0   0   1   1   1
   -------------------------
   1   1   0   0   1   1   0

We don't need to put anything where the remining "?" is because the carried 1
just comes down, so we just erase it.  Since we did this by adding backwards, the answer is where the row of "?"'s were: 

   1   1   1   1   1   1 
       1   1   1   1   1   1   <--answer
+      1   0   0   1   1   1
   -------------------------
   1   1   0   0   1   1   0

Answer = 111111

Edwin