How do I add multiple binary numbers without using a partial sum?

13.2k Views Asked by At

I know how to add binary numbers but what I normally do is add the first 2 binary numbers and then add the 3rd one to their sum. It is really slow. $$ 111_2 + 111_2 + 111_2 + 111_2 $$

Here is what I do.

Step 1: Add the first digits, sum is 4 in decimal then since its binary carry 4

Step 2: add the digits again then add the carry (so 8 in total) it still wont fit so carry again

Step 3: the same as before and add the carry so its 12 it still wont fit

Now my answer is already wrong. Im confused when it comes to the carrying.

4

There are 4 best solutions below

0
On BEST ANSWER

Your carries are wrong.

When adding the first digit you get indeed $4$, but then it must scales to a carry of two, since in the next step you're adding $2$'s, and then $4$'s, and so on...here what you do is like, when adding $19+19$ in decimal, say at first step you get 8 and a carry of 10. Actually you end up with a carry of one, because you need to divide by the basis $b$, since in the next step you will handle digits representing $b$ times more. Here, you need to divide your carry by $2$ at each step.

(1) you get $4$, put a $0$, carry $\frac{4}{2}=2$

(2) you get $4+2=6$, put a $0$, carry $\frac{6}{2}=3$

(3) you get $4+3=7$, so put a $1$, carry $\frac{7-1}{2}=3$

(4) you have $3$, put a $1$, and carry $\frac{3-1}{2}=1$

(5) put the last $1$, end the algorithm

You finally get the correct answer $11100_2$ (or 28 in decimal, and you add four $111_2$, which are 7)

0
On

Adding the first digits gives you $100_2$ meaning that you write down $0$ and you carry the $100_2$ which becomes $10$ when you are looking at the two-s place. You then add the four ones at the two-s place and the $10$ you got from before to give you $110$, of which you write down $0$ and carry the $11$.

Summing up the last four ones and adding the $11$ leaves you with $1+1+1+1+11=100+11=111$ meaning the result is $$11100$$

0
On

Same way as you add up more than two decimal numbers, just note that the "carry forward" goes 1, 10, 11, 100... rather than 1, 2,3,4,5,6,7,8,9,10,11.... For example, to addd:

1101

1011

0101

__

Add rightmost column = 1 carry 1

Add next column = 0 carry 1

Add next column = 1 carry 1

Add leftmost column = 1 carry 1.

Answer = 11101

Your confusion arises from mixing binary and decimal: if you are working in decimal you wouldn't try to use binary for the intermediate results and caries. When you are working in binary keep everything in binary. Re-working your example:

111

111

111

111

Add rightmost = 0 carry 10

Add next = 0 carry 10

Add next = 1 carry 10

Add left = 1 carry 10

Answer = 11100. To make it easier write down the carries as you go along.

0
On

We can employ an abstract symbolic processing logic algorithm to add binary numbers.

Example 1: For the OP's specific question:

>0 | >111 111 111 111 | : ->
0 >1 | 11 >111 111 111 | : ->
0 1 >10 | 11 11 >111 111 | : ->
0 1 10 >11 | 11 11 11 >111 | : ->
0 1 10 11 >100 | 11 11 11 11 | : ->
>0 1 10 11 100 | >11 11 11 11 10 | :0 -> 
0 >1 10 11 100 | 1 >11 11 11 10 | :0 ->
0 1 >10 11 100 | 1 1 >11 11 10 | :0 ->
0 1 10 >11 100 | 1 1 1 >11 10 | :0 ->
0 1 10 11 >100 | 1 1 1 1 >10 | :0 ->
0 1 10 11 >100 | 1 1 1 1 1 | :0 ->
>0 1 10 11 100 | >1 1 1 1 1 10 | :00 ->
0 >1 10 11 100 | >1 1 1 1 10 | :00 ->
0 1 >10 11 100 | >1 1 1 10 | :00 ->
0 1 10 >11 100 | >1 1 10 | :00 ->
0 1 10 11 >100 | >1 10 | :00 ->
0 1 10 11 100 >101 | >10 | :00 ->
0 1 10 11 100 >101 | 1 | :00 ->
>0 1 10 11 100 101 | >1 10| :100 ->
0 >1 10 11 100 101 | >10| :100 ->
0 >1 10 11 100 101 | 1 | :100 ->
>0 1 10 11 100 101 | >1 | :1100 ->
0 >1 10 11 100 101 |  | :1100 ->
0 1 10 11 100 101 |  | :11100 ANSWER