3
$\begingroup$

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.

  • 0
    @ChrisEagle I'm not an english speaker, so I'm not very experienced with english mathematical terms.2012-12-06

3 Answers 3

7

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.

  • 0
    Yes, but $80-(-70)$ would by my algorithm be interpreted as $80+70$ since, as I see it, this method cannot be applied without running a else/elseif for these four conditions: +A+B, +A-B (|A|>|B|?), -A+B, -A-B.2012-12-07
2

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.

  • 0
    I agree with you on the multiplication/division, but not on the addition/subtraction.2012-12-06
0

$\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$