Subtraction Calculator
Result
Difference
- Borrowings
- 1, 1, 1, 0
A long subtraction calculator takes one whole number away from another the way it is written down, one column at a time, and prints the borrow that moves left at every step. It shows its work: the difference comes back with the digit written at each place and a borrow chain with one entry per column. The default takes 567 from 1234 to get 667, borrowing at each column that cannot cover the digit below. Only whole numbers are accepted, and the two may be the other way round — the working still runs the larger minus the smaller.
1234 − 567 worked one column at a time
| Column | Digits | Borrow in | Raw | Digit written | Borrow out |
|---|---|---|---|---|---|
| 0 | 4 - 7 | 0 | -3 | 7 | 1 |
| 1 | 3 - 6 | 1 | -4 | 6 | 1 |
| 2 | 2 - 5 | 1 | -4 | 6 | 1 |
| 3 | 1 - 0 | 1 | 0 | 0 | 0 |
One row per column, read from the ones column upwards, which is the direction the work actually runs. The Digits column shows what is subtracted from what, and because the working always runs the larger number minus the smaller, it shows the two digits the way they end up rather than the way they were typed — 3 − 5 appears here as 5 − 3. Raw is the column's own subtraction before anything is borrowed in from the left, so it can be negative; Borrow out is 1 exactly when it is, and the digit written is that raw value padded with ten. Borrow in of the top row is zero because nothing is to its right, and borrow out of the bottom row is zero because nothing is to its left. Column numbers are whole numbers and the digit strings are notation, so the table is identical in all ten languages the site serves.
Formula
column k: raw = digit_k(minuend) − borrow_in − digit_k(subtrahend) borrow out = 1 if raw < 0, otherwise 0 written digit = raw + 10 × borrow out
- minuend
- The minuend: the number being taken from, a whole number no larger than one trillion. It sits on the top line of the working, and every column is read against its digits — including the columns where it has no digit left, which count as zero.
- subtrahend
- The subtrahend: the number taken away, written underneath and lined up on the ones column. It may be the larger of the two, in which case the working is done the other way round and the difference is given a minus sign.
- column k
- The k-th place from the right, counting the ones column as zero. A column can only be settled once the one to its right has been, because the borrow travels leftwards — which is why the ones column decides everything above it.
- borrow
- The 1 taken from the next column left when the digit on top is smaller than the digit below it. It is worth ten in the column that receives it, so 4 − 7 becomes 14 − 7, and the column it came from loses one.
- difference
- The answer, and also the number the borrow chain is measured against: the chain has one entry per column of the larger number, so its last entry is always 0. Leading zeros are never written, so 099 is the answer 99.
Use this to subtract one whole number from another when the working has to be shown rather than just answered: teaching borrowing at the point where a column cannot cover the digit below it, or checking a difference that was worked by hand. The check that goes with it is addition — add the difference back to the subtrahend and the minuend should return.
Worked examples
1234 − 567
- Ones column: 4 − 7 does not go, so borrow 1 from the tens and read it as 14 − 7 = 7
- Tens column: 3 has already lost one to that borrow, so 2 − 6 does not go either — borrow again and read 12 − 6 = 6
- Hundreds column: 2 lost one as well, so 1 − 5 does not go — borrow and read 11 − 5 = 6
- Thousands column: 1 lost one, leaving 0 − 0 = 0
- The digits written, from the highest column down, are 0, 6, 6, 7
- The difference is 667 and the borrow chain is 1, 1, 1, 0
The default case, and the one that shows why the working is written down: each column that borrows leaves the column above it one smaller, so the borrow arrives before that column's own digits are read. The last entry is 0 because the top column has nothing above it to borrow from — that zero is the borrow chain stopping, not a missing step.
1000 − 1, borrowing across the zeros
- Ones column: 0 − 1 does not go, so borrow from the tens column
- The tens column holds a 0 and cannot lend, so it borrows from the hundreds first
- The hundreds column holds a 0 too, so it borrows from the thousands, which turns 1000 into 990 with ten in the hundreds
- Lending one of those tens to the tens column leaves 9 there and ten in the ones column
- Ones column: 10 − 1 = 9. Tens column: 9 − 0 = 9. Hundreds column: 9 − 0 = 9
- The difference is 999 and the borrow chain is 1, 1, 1, 0
The chain is the same four entries as the default example, which is the point: the borrow travels the whole width of the number and the answer is the nine's complement. A zero in the middle is not a place that can lend — it has to borrow from the left first, and on paper that is the struck-through chain teachers write above the sum.
3 − 5, where the answer goes negative
- The number on top is smaller than the one below it, so the subtraction is worked the other way round: 5 − 3
- Ones column: 5 − 3 = 2, with nothing to borrow
- The digits written are just 2
- Because the two numbers were swapped, the answer carries a minus sign
- The difference is −2 and the borrow chain is 0
The working is always the larger number minus the smaller one, so the digits column in the table below never shows a negative line — the minus sign lives on the answer and nowhere else. That is what makes the borrow chain readable at all: it has one entry per column of the larger number, which would not be a fixed length if the columns could run the other way.
Limitations
Only whole numbers are accepted. Decimals can be subtracted in columns too, but only after being aligned on the decimal point and padded with zeros, and that changes what a column means — so decimals are refused rather than quietly treated as whole numbers. Negative inputs are refused for the same kind of reason: a sign is not a digit and would need a column and a rule of its own. Exactly two numbers are taken; a chain of subtractions is several of these sums one after another. Each number is capped at one trillion, because the digits are read one place at a time and beyond that the written digits stop matching the answer. When the second number is the larger one the answer is negative, but the digits shown in the working are those of the larger minus the smaller, so the table is not read off the numbers as typed.
Frequently asked questions
- What is long subtraction?
- Subtracting numbers the way they are written down: line the digits up by place, work from the ones column leftwards, and borrow ten from the next column whenever the digit on top is too small. It gives the same answer a calculator does, with the intermediate steps kept instead of discarded.
- What does borrowing mean?
- Taking one from the column on the left and spending it here as ten. 4 − 7 does not go, so one ten is moved across and the column reads 14 − 7 = 7. The column it came from is now one smaller, which is why each borrow affects two columns and not one.
- Is borrowing the same as regrouping?
- Yes — regrouping, renaming and exchanging are the same move under different names, and which word a classroom uses is a matter of fashion. A borrow always trades one unit of the next place left for ten units of this one, so nothing is created or destroyed.
- Why does the borrow chain end in zero?
- Because the top column never borrows. A borrow happens only when a column cannot cover the digit below it, and the highest column of the larger number is always bigger than the whole of the smaller one, so the chain stops there. The final zero is that stopping, and the chain is one entry longer than the borrows you actually see.
- How do I check the answer?
- Add the difference back to the subtrahend and see whether you get the minuend. 1234 − 567 = 667, and 667 + 567 = 1234. That check is exact and costs one column addition, which is why subtraction and addition are taught as one procedure with the signs changed.
- Can I subtract a bigger number from a smaller one?
- Yes, and the answer comes back negative. The working is still done the larger minus the smaller, because a column-by-column procedure needs the top digits to be the bigger ones somewhere; only the sign of the difference changes. 3 − 5 is worked as 5 − 3 = 2 and reported as −2.
References
- Subtraction — the operation itself, and the fact that a difference can be checked by adding it back — Wolfram MathWorld (United States)
- Base — how a digit's worth comes from the column it sits in, which is why a borrow is worth exactly ten — Wolfram MathWorld (United States)
- Subtraction with regrouping — the column-by-column procedure taught in schools, and the names it goes by — SplashLearn (United States)