Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions docs/binary-algebra/addition.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,41 @@ has_children: false
Binary addition is similar to Decimal addition. As this addition is binary, it implies that you cannot have a number greater than 1 i.e., when you do '1+1' it gives 0 with carry 1 i.e, 10.

```yaml
Examples :

Rules:
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 1
1 + 1 = 10 (0 with carry 1)

| A | B | Carry Out | Sum | Result |
|---|---|-----------|-----|--------|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 0 | 10 |

1 1 (3)
+ 1 0 (2)
-----
1 0 1 (5)
-----
Example 1:
1 1 (3)
+ 1 0 (2)
-----
1 0 1 (5)
-----
```

In the above example, for units place gives 1 as the submission of 1 and 0, whereas, when addition occurs at the ten's place where 1 and 1 are added, it gives 10 not 2 because this is binary addition which results in carry of 1 and 0 as a result of the submission. The example below gives 110 because it results in 1~~1~~1 at the tens place which is 11 in binary. As two 1's gives 10, further if you add 1 it will give 11.
In the example above, the units column adds 1 + 0 to get 1. In the next column, 1 + 1 equals 10 (binary for 2). We write down the 0 and carry the 1 to the next position, just like in decimal addition

```yaml
1 1 (3)
+ 1 1 (3)
-----
1 1 0 (6)
-----
Example 2:
1 1 0 (6)
+ 1 0 1 (5)
-------
1 0 1 1 (11)
-------
```

In the example above, we add the numbers from right to left. First, 0 + 1 = 1, so we write 1 in the rightmost column. Next, 1 + 0 = 1, so we write 1 in the next column. Then, 1 + 1 = 10, so we write 0 and carry 1 to the next column. Finally, we bring down the carried 1, giving the result 1011. Therefore, 110₂ + 101₂ = 1011₂, which is equal to 6 + 5 = 11 in decimal.


{:.quiz}
1. What is the answer to `1100` + `0011`= ?
Expand Down
Loading