# Is there one method of adding and subtracting without a calculator?

One can on a sheet of paper, without a calculator, add two numbers or subtract two numbers, each with it's own method. This is second grade maths.

However, is it possible to solve both these with a third and universal method? It can be more complex, but it works no matter what.

-
What on earth does this have to do with simplices? – Chris Eagle Dec 6 '12 at 15:17
@ChrisEagle I'm not an english speaker, so I'm not very experienced with english mathematical terms. – Friend of Kim Dec 6 '12 at 15:22

## 3 Answers

You can subtract using the addition algorithm if you represent negative numbers is "10's complement".

Suppose we want to compute $5678-2780$. This is the same as $5678+(-2780)$, so if only we had a way to express $-2780$ in an addition-friendly way, we'd be set. It turns out we can do that. First extend the number we want to negate with infinitely many zeroes on the left:

...00002780


Then replace each of its digit $n$ by $9-n$:

        ...00002780
becomes ...99997219


Now there are infinitely many nines to the left. Then add 1, and keep carrying as long as there is a carry:

 ...9997219
+         1
------------
...9997220


The result, ${\ldots}9997220$ is the 10's complement representation of $-2780$.

Now we can add $5678$ to ${\ldots}9997220$ using the ordinary addition algorithm:

        5678
+ ...9997220
------------
...0002898


And we end up with infinite 0's to the left again because the carry from 5+7 keeps propagating to kill all the 9's. Lo and behold, $5678-2780$ really is $2898$.

This is a rather silly procedure to carry out on paper in base 10, but computers calculate with negative integers in exactly this way, only in base 2.

Two ways to understand why this works: First, the initial conversion to 10's complement can be understood as subtracting 2780 from 1000...000 with a very large but finite number of zeroes. In other words, we're adding 1000...000 to the initial negative number, which makes it positive. Then after doing the addition, we subtract the 1000...000 simply by ignore all but "sufficiently many" last digits of the result -- we know there'll be an initial "1" out there somewhere and don't need to physically carry the one through a billion nines in order to verify it.

Second, it is possible to convince oneself that the strange initial manipulation of the $-2780$ actually makes the digit-for-digit subtraction algorithm into a digit-for-digit addition algorithm, if "don't carry" is taken to mean "borrow one" and "carry one" means "no borrow". In this view, the "add 1" step functions as a "artificial" carry into the ones digit position, which corresponds to the fact that there is no borrow from the ones position in the subtraction algorithm.

-
Thanks for your response! Actually, I'm asking this question because I'm making a computer method that is simply going to add, subtract, multiply and divide numbers. I need it because the language I'm writing in thinks any number greater than $9007199254740992$ is infinite. Great answer! – Friend of Kim Dec 6 '12 at 15:32
@FriendofKim: It is probably worth looking into whether someone has already made a bignum library for your target language. It is possible to write one oneself, but division in particular can be a tooth-puller. – Henning Makholm Dec 6 '12 at 15:42
Yes, that is true. I've searched the internet, but I haven't found anything that isn't compiled, obfuscated and embedded in much other code so I can't extract it. + It is copyrighted.. – Friend of Kim Dec 6 '12 at 16:11
This method is just fantastically smart and yet not logically difficult, at least not how you explained it! – Friend of Kim Dec 7 '12 at 13:20
Hmm... I've been calculating on a paper for a while now. As I see it, one can make a few rules. If you always do A-B. Given A-B where |A|>|B|. One can calculate with as many digits as the number with the most digits, and then neglect all the 1's in the answer to get the right answer. – Friend of Kim Dec 7 '12 at 14:03

Subtracting $b$ from $a$ is nothing more than adding $-b$ to $a$:

$a - b = a + -b$. In this case, $-b$ is the additive inverse of $b$.

So addition covers both addition and subtraction. In whatever context, you can think of substraction of a number as the addition of its additive inverse (e.g., computes use only addition, where "negative" numbers are in two's complement form, etc.)

Similarly, dividing $a$ by $b$ is nothing more than multiplying $a$ and $\dfrac1b$, since $\dfrac1b$ is the multiplicative inverse of $b$:

$\dfrac ab = a\cdot \dfrac 1b$

So multiplication covers both multiplication and division.

-
On the other hand, the usual way to add a negative number is to subtract its inverse... so it is not clear that this gets us anywhere. – Henning Makholm Dec 6 '12 at 15:13
@HenningMakholm Exactly! I've already thought about this solution, but it again brings us back to start as you Henning stated. – Friend of Kim Dec 6 '12 at 15:20
I agree with you on the multiplication/division, but not on the addition/subtraction. – Friend of Kim Dec 6 '12 at 15:24

$\rm {\bf Hint}\ \ note\rm\,\ 43-21\, =\, 43+79\!-\!100\, =\, 43+79,\:$ dropping final carry. Expressed modularly

$\rm\ mod\,\ 100\!:\ 43-21 \,\equiv\, 43+79\, \equiv\, 22$

-