From d0ccaf5b5d8b347e87579aed79a3832634fa233a Mon Sep 17 00:00:00 2001 From: thomasabishop Date: Sat, 1 Apr 2023 08:30:36 +0100 Subject: [PATCH] Autosave: 2023-04-01 08:30:36 --- .../Binary/Binary_addition.md | 82 +++++++++++++++++++ .../Binary/Binary_arithmetic.md | 69 +--------------- 2 files changed, 84 insertions(+), 67 deletions(-) create mode 100644 Electronics_and_Hardware/Binary/Binary_addition.md diff --git a/Electronics_and_Hardware/Binary/Binary_addition.md b/Electronics_and_Hardware/Binary/Binary_addition.md new file mode 100644 index 0000000..c3e1a02 --- /dev/null +++ b/Electronics_and_Hardware/Binary/Binary_addition.md @@ -0,0 +1,82 @@ +--- +categories: + - Mathematics + - Computer Architecture +tags: [binary, binary-arithmetic] +--- + +# Binary addition + +- We add binary values in columns just like we would with denary addition. +- Each column is classified on the basis of place-value. In denary this is 10, in binary it is 2. +- When we conduct a binary addition, we add the binary values as if they were normal integers but we represent the sums as binary. + - For example: $1 + 1 = 2$ for the calculation but the sum is $10$ + +## Examples + +### Example one + +$$ +1010 + 0111 = 10001 +$$ + +$$ +10 + 7 = 17 +$$ + +In the first column: $1 + 0 = 1$, so we simply put the binary value for $1$: + +``` +1010 +0111 +____ + 1 +``` + +In the second column: $1 + 1 = 2$. In binary this is represented as $10$. So we put $0$ beneath the bar and carry the $1$: + +``` + 1 +1010 +0111 +____ + 01 +``` + +In the third column, we repeat the previous process. We are presented with $1 + 0 + 1$ which is $2$. As $2$ is $10$ in binary, we put the zero beneath the line and carry the $1$: + +``` +11 +1010 +0111 +____ + 001 +``` + +In the final column, we again have $1+1$ giving us $2$ or $10$ but at this point we cannot carry any more because we have reached the final column. So instead of carrying the $1$ we just put both digits beneath the line $10$. + +``` + 11 + 1010 + 0111 +_____ +10001 +``` + +### Example two + +$$ +1001 + 0111 = 10000 +$$ + +$$ +9 + 7 = 16 +$$ + +``` + 111 + 1001 + 0111 +_____ +10000 +``` diff --git a/Electronics_and_Hardware/Binary/Binary_arithmetic.md b/Electronics_and_Hardware/Binary/Binary_arithmetic.md index 6ed6fa1..df00dd6 100644 --- a/Electronics_and_Hardware/Binary/Binary_arithmetic.md +++ b/Electronics_and_Hardware/Binary/Binary_arithmetic.md @@ -2,72 +2,7 @@ categories: - Mathematics - Computer Architecture -tags: [binary] +tags: [binary, binary-arithemetic] --- -# Binary arithmetic -## Binary addition - -When we add two binary numbers we use place value and carrying as we do in the denary number system. The only difference is that when we reach two in one column (`10`) we put a zero and carry the `1` to the next column. - -For example: - -```` -1101 + 0111 // 13 + 7 ---------------------- - -1 1 0 1 -0 1 1 1 -_______ -101 0 0 - 1 1 1 -```` - -Let's break down each column from the right: - -* `1` and `1` is two. As two is `10` in binary, we place a zero and carry the 1 -* In the next column we have `1` and `0` which is one but because we have carried the the previous `1` we have two again so we put a `0` and again carry a `1` -* Now we have `1` and `1` which is two but we also have the carried `1` which makes three. In binary three is `11` so we put a `1` and carry the extra `1` -* This gives us two in the final column `10` but we have no room left to carry so we put `10` itself in the final place making -* In total we have `10100` which makes twenty - -### More examples to practise with - -![](../_img/../../_img/Pasted_image_20220319174839.png) - -## Binary multiplication - -Let's remind ourselves of how we do long multiplication within the denary number system: - -$$ 36 * 12 $$ - -So we multiply the bottom unit by the top unit and the top ten and then repeat the process with the bottom ten and sum the results. - -```` -36 -12 -__ - -2 * 6 = 12 -2 * 30 = 60 -10 * 6 = 60 -10 * 30 = 300 -_____________ - -432 - -```` - -It is the same in binary multiplication but is actually easier because we are only ever multiplying by ones and zeros. - -When we multiply binary numbers in columns we multiply each of the top numbers by the bottom in sequence and then sum the results as in denary. - -An important difference is that when we move along the bottom row from the $2^0$, to $2^2$, to $2^4$ etc we must put a zero in the preceding column as a place holder. The sequence is shown below: - -![](/_img/multiplication_01.gif) - -![](/_img/multiplication_02.gif) - -![](/_img/multiplication_03.gif) - -![](/_img/multiplication_04.gif) +# Binary multiplication