# Subtraction when second number is bigger than first number

I'm a bit new to this. I'm trying to figure out how subtraction works pen and paper wise.

I have a bit of a program where I can't seem to find any answers online. What I want to do is use the borrowing method of subtraction. I have a:

1) I'm trying subtract:

   6526
-  8437


All websites I test and calculator says the answer is 1911 but I'm getting -2089. I'm using the borrowing method, but shouldn't the number be negative?

Thanks so much.

• The answer should be negative. Note that it can not be $-2089$ since $8437+ (-2000)= 6437 < 6526$. Since $-2089 < -2000$ we would be getting further away from our goal of $6525$.
– Eoin
May 7 '15 at 2:19
• You are doing something wrong with the calculator if you ar getting a positive number. It's possible that some calculators would be that broken, but it seems nearly impossible to believe that any reputable calculator would get this that wrong. May 7 '15 at 2:47
• Apr 7 '17 at 20:28

Here is why you got the wrong answer. Part way through the calculation you will have \eqalign{6526&\cr -\ 8437&\cr -\!\!\!-\!\!\!-\!\!\!-\!\!\!-\!\!\!-&\cr ?089&\cr} The next subtraction will give you $-2$ in place of the question mark. But note that the "places" in your answer are all positive. That is, the $9$ represents $9\times1$, the $8$ represents $8\times10$ and the $0$ represents $0\times100$. So the $089$ represents $89$.

In the same way, your $-2$ will represent $-2000$. So the final answer will be $$-2000+89=-1911\ ,$$ which is correct.

However you cannot write this number as $-2089$, because that would mean that not only the $2$ but all the other digits count as negative. In other words, $-2089$ is the number $-2000-89$, not $-2000+89$.

• Excellent answer! If it's one thing I've found about math, it's that you're never too brilliant to go back to the fundamentals and examine why something others glance over is the way it is, like the number system, etc. Sometimes the most brilliant and mind-bending mathematics and philosophy isn't a tough analysis problem, it's just the set of real numbers or integers. May 7 '15 at 2:29
• @David: but how do you know that -2000 + 89 is -1911? You again have to subtract a larger number from a smaller one, using the borrowing method again will give the OP the same "problem" he has had in the first place.
– Curd
May 8 '15 at 16:30
• @Curd I'm explaining why there is a problem, see other answers for how to solve it. May 8 '15 at 23:15
• @David, Curd has a point. Instead of 6526−8437, what if the question was instead 89−2000? How do you solve 89−2000 then? Apr 7 '17 at 20:01

$6526-8437=-1911$. You can type it into google to check.

What I do when I have to solve this sort of problem is swap the order of the numbers so the big number is on top.

So I calculate $8437-6526=1911$. Then I multiply it by minus one to get $6526-8437$, which is what I wanted.

This works because $-(a-b)=b-a$.

• Perfect answer, the switching around and multiplying by -1 works! May 7 '15 at 2:25
• I agree, I like that you added the bit about $-\left(a-b\right)=b-a$. That is probably what they needed. Swapping the order of the larger and smaller numbers is probably what they needed to think about May 7 '15 at 2:28
• And this is part of a bigger pattern--if you're doing arithmetic without a calculator, especially if you're doing it in your head, it is often a good idea to rearrange the problem to make it easier. May 8 '15 at 0:52
• @Jorge, But what about really big numbers where it could take hours to determine whether number A is greater than number B or viceversa? For addition, we can start "straightaway" reading only one digit at a time from the back, without even having read the entire number. Is there a way to do this for subtraction? Apr 7 '17 at 17:54
• @Pacerier I guess, although the "complexity" of the algorithm doesn't change, figuring out which one is larger is just as fast as the addition. So substraction has the same asymptotic runtime ans adding. Oct 3 '17 at 22:11

Your result of $-2089$ looks like you're subtracting digit by digit, but putting a negative digit two in the thousands position at the end where you subtract 8 from 6.

However, this doesn't work, because when you write $-2089$, the minus sign applies to all of the digit positions, so the 8 tens and 9 ones suddenly get flipped to negative tens and negative ones, which has no justification.

Note that $(-2000)+89$ does equal the true result $-1911$.

If you want to start by subtracting 6 from 7 and borrowing, what you should to at the left edge of the subtraction is to keep borrowing from the "empty" ten-thousands, hundred-thousands and so forth:

 ...0006526
-...0008437
-----------
=...9998089


This leads to a representation known as 10's complement, where a negative number is represented as starting with an infinite-to-the-left sequence of nines. This works in the sense that $...9998089$ does represent the number usually written as $-1911$: Namely, if we add 1911 to it, it becomes 0:

 ...9998089
+      1911
----------
=...0000000


with an infinity of carries disappearing out to the left and leaving every digit of the result as 0.

10's complement is not much used in practice, but the equivalent idea in base 2 (2's complement) is widely used to represent arithmetic on negative integers inside computers.

• I found this answer while searching how to solve a problem I'm dealing with implementing signed arbitrary precision integer addition. Is there a way to correct the representation without first determining which operand is largest? Each "digit" is between 0 and 9999999 in my library, since (10^7)^2 is the largest (10^n)^2 that is less than 2^53, which is the largest integer guaranteed to maintain integer precision in double floating precision. Jul 12 '16 at 4:07
• @PatrickRoberts: It's not clear to me what you mean by "correct the representation" here. Jul 12 '16 at 8:32
• What I mean is when doing long subtraction naively, I end up with the 10's complement form when the subtrahend is larger than the minuend rather than the correct form. I can't find the exact algorithm to get the correct output (i.e. non-10's complement, human-readable negative number). Jul 12 '16 at 9:20
• @PatrickRoberts: I think just comparing the sizes in advance is both the easiest and simplest solution and the most efficient. In cases where the comparison does not complete immediately, it will also tell you that a certain initial sequence of digits is the same between the two numbers, and you can then ignore those shared digits afterwards when you perform the actual subtraction -- in the right direction from the beginning. Jul 12 '16 at 20:23
• Thanks for the advice! I'll try that out when I get a chance Jul 12 '16 at 20:24

Subtracting this way will give you a negative number, the easiest way to solve a problem like this is to just switch the two numbers around, so that the big number is on top, then subtract, and add a negative sign in front of the result, or like some people suggested, multiply by -1. It is the same answer either way.