Math and Computers
Christina Sng for Maths@Singapore
Math opened up an incredible world for computing. By having a computer help us count, we can make calculations of very large numbers.
How does a computer help us accomplish this?
Binary
Computers convert every number into a binary and express it in base 10. For example:
Every 10 ones = 1 ten
Every 10 tens = 1 hundred
With a binary, you go up a unit every 2 numbers:
2 ones = 1 two
2 twos = 1 four
This means the number 9 is 1001 in binary:
1 one, 0 twos, 0 fours, and 1 eight
or
1 + 8 =9
Computers use binaries because it is easier to build circuits with values of 1 or 0 than circuits with 10 separate values.
Addition
Adding in binaries to addition on a computer is straightforward:
If you have 2 numbers with a 1 value, you store a 0 and move carry 1. If not, you keep the bigger of the two numbers in that slot.
In an example:
5 + 4 = 0101 + 0100
In the first slot, you have a 1 + 0, therefore you record the bigger number, 1.
The second slot contains two 0s, so you record 0 (since both numbers are the same.
In the third slot with two 1s, you record a 0 and carry a 1.
What remains is 1001, or 9.
Multiplication
Computers use long multiplication in binary. So if a computer multiplies a number by 1, it returns a 1, a much simpler system than base 10 despite requiring more steps.
As illustrated in this example:
In base 10, 8 x 9 is easy to solve with no long multiplication.
In binary, each number is 4 digits long, resulting in a solution 7 digits long.
Subtraction
In computing, subtraction is a little more complicated. It is conducted in two steps:
A binary computer adds its compliment, a number with ones where the original has zeros, and zeros where the original has ones.
Here’s an example to help:
4 = 0100 in binary
-4 = 1011
Therefore, 7 – 4 = 0111 + 1011 = 10010.
The leftmost number is subsequently moved to the right, resulting in 0011 = 3.
Excited to find out more? Visit https://sciencing.com/convert-between-base-number-systems-8442032.html
Thanks to Clément Hélardot @clemhlrdt for making this photo available freely on Unsplash