All information that computers use is stored as a series of on and off. Using 0 to represent off and 1 to represent on is common, but most people equate "10" with the base-10 value that is equal to the number of fingers most people have. While in binary, "10" represents the number of hands most people have.
Instead of numbers we are going to use colors and widths to avoid preconceived notions of what digits represent. Going forward, any digit or number will be standard base-10. When dealing with binary representations, gray will represent off while any of red, blue, or purple will represent on.
You should be try to perform all of the operations without thinking about binary numbers, but to convert from colors to binary numbers is very simple.
How wide is the following block?
We could use base-10 and say it is 173 units, but how can a computer store that information using only on and off?
We can use a set of smaller blocks that will uniquely define the width by stating whether each block is required or not.
Each block is twice the size of the next smaller block, so no matter how wide the block is we can communicate its width in terms of yes or no regarding the set of smaller blocks.
Addition is an important operation. If we place two blocks next to each other, how wide will the resulting block be? One way is to place them next to each other and see the total width.
In base-10 we could say it is 96 units. However, if we want to convey that width to a computer we need to use the set of smaller blocks again. One way to perform addition is to get the width of the combined block using the same idea of checking which smaller blocks are required to match the width.
Any definition of addition should match the result that is generated by measuring the combined widths, but we want to automate the process so that a computer can use on and off.
If you add one of the smallest blocks to nothing then the result will be one of the smallest blocks. So red + gray = red. In fact, gray is the additive identity. No matter what we add to gray, the result does not change.
What is red + red? Remember we are only allowed to use each small block at most one time. So combining two blocks of the same size requires the use of the a larger block. In the case of red + red, the next sized block is exactly twice the size so red + red = redgray.
We could just keep computing additions and tell the computer all of the answers, but there are way too many possibilities. So we should come up with an algorithm.
Using widths of blocks, it should be clear that rearranging the blocks will not change the total width. Instead of using the entire red block and the entire blue block we will arrange them by size.
So redgray + blueblue becomes blueredblue. We will work left to right. We need one small purple block to match the one small blue block. Then to match the larger red and blue blocks we use one purple block of the larger size.
Treat red and blue blocks of the same size as a pair that should be worked together. If there are two of the same size, add a purple block of the next size.
If there is one of a size, then check if there is already a purple block of that size. If so, turn that purple block into a larger purple block. If not, add a purple block of that size.
When you are finished, you will have exactly matched the total width without reusing any of the small blocks. And then convert that to binary.
A computer can use circuits and a similar type of algorithm to add any two binary numbers very quickly. Multiplication is more difficult, but can be achieved by repeated addition.
What about decimals? Not every block will have width that is an exact multiple of the smallest block in our set. If we try to determine the width of such a block then we will reach a point where every block in the set is wider than the remaining width.
In order to exactly match the width, we start adding smaller blocks to our set. Each new block will be half the width of the previous block. We keep adding the largest possible block that fits and recording it after the decimal point. If we get tired of adding new blocks we can stop and use the representation as an approximation.
Since we are still using the same of idea of blocks of increasing size, addition is the same but we need to keep the decimals aligned to ensure that we are comparing blocks of the same size.