Understanding the integer calculator — concept and principle
This calculator adds, subtracts, multiplies and divides integers, including negative numbers, and explains the sign rule it used. It rewrites subtraction as adding the opposite, shows the absolute values, and gives a decimal or whole-number quotient and remainder for division. Use it for pre-algebra practice and checking homework with negative numbers.
How it is calculated
- Adding, same signs: add the absolute values and keep the sign.
- Adding, different signs: subtract the smaller absolute value from the larger and keep the sign of the number with the larger absolute value.
- Subtracting: a − b = a + (−b).
- Multiplying and dividing: same signs give a positive result, different signs a negative one.
The principle
Integers extend the counting numbers with their opposites, like positions on a number line with zero in the middle. Adding a positive number moves right; adding a negative moves left. Subtracting a number is the same as adding its opposite, so taking away a debt (subtracting a negative) increases your balance. The sign rules for multiplication follow from keeping the distributive law true: since −1 × (1 + (−1)) = 0, the product (−1)(−1) must be +1.
Worked example
Default inputs: a = −12, subtract, b = −5.
- Problem: −12 − (−5) = −7.
- Rewritten: −12 + 5 (adding the opposite).
- Absolute values: 12, 5.
- Sign rule used: different signs: subtract the absolute values and keep the sign of the larger one: 12 − 5 = 7, sign of −12, so −7.
| First integer a | Result |
|---|---|
| -3 | 2 |
| -6 | −1 |
| -9 | −4 |
| -12 | −7 |
| -15 | −10 |
| -18 | −13 |
| -24 | −19 |
How to read the result
On a number line, start at −12 and move 5 to the right: you land on −7. A quick sense check: subtracting a negative number always makes the result larger than the first number, and here −7 > −12, as expected.
Common mistakes
- Treating "minus a negative" as subtraction instead of addition.
- Keeping the sign of the first number instead of the one with the larger absolute value.
- Saying two negatives always make a positive, which is true for multiplication but not for addition.
- Dropping brackets around negative numbers and confusing signs.
Frequently asked questions
What is −12 − (−5)?
−7, because subtracting −5 is the same as adding 5.
Why is a negative times a negative positive?
It keeps the distributive law consistent for all numbers.
What is −12 + (−5)?
−17: same signs, so add 12 + 5 and keep the minus sign.
Sources: OpenStax, Prealgebra 2e (2020), Chapter 3 Integers