How do I do long multiplication?
Type two numbers. The product is exact, and the working shows the long multiplication you would write on paper.
- Product
- 5535
123 × 45 = 5535.
- Long multiplication
- 123 × 5 = 615; 123 × 40 = 4920; Add the partial products: 615 + 4920 = 5535
- Problem
- 123 × 45
Product: 5535. 123 × 45 = 5535.
The long multiplication
How to calculate
Multiplies two numbers exactly, whole numbers or decimals of any length, and shows the long multiplication: each partial product, their sum, and the decimal point.
Example with the default inputs (First number 123, Second number 45): 123 × 45 = 5535.
Method: Multiply without the decimal points: one partial product per non-zero digit of the second number (the first number times that digit and its place value), then add them; the product has as many decimal places as both numbers together.
- Each number is read exactly as typed, with any number of digits; the product is exact.
- A digit 0 in the second number gives no partial product.
- The product is negative when exactly one number is negative.
Worked examples
Each example is checked against the calculator on every build.
- First number 123, Second number 45 gives Product 5535, Long multiplication 123 × 5 = 615; 123 × 40 = 4920; Add the partial products: 615 + 4920 = 5535.Source: Method from OpenStax Prealgebra 2e, section 1.4: https://openstax.org/books/prealgebra-2e/pages/1-4-multiply-whole-numbers
- First number 12.3, Second number 4.5 gives Product 55.35, Long multiplication Set the decimal points aside: 123 × 45; 123 × 5 = 615; 123 × 40 = 4920; Add the partial products: 615 + 4920 = 5535; 1 + 1 = 2 decimal places: 55.35.
- First number -2.5, Second number 0.4 gives Product -1, Long multiplication Set the decimal points aside: 25 × 4; 25 × 4 = 100; 1 + 1 = 2 decimal places: 1.00; One number is negative, so the product is negative: -1.
- First number 987654321, Second number 123456789 gives Product 121932631112635269.
- First number 2,048, Second number 305 gives Product 624640, Long multiplication 2048 × 5 = 10240; 2048 × 300 = 614400; Add the partial products: 10240 + 614400 = 624640.
How it works
Each number is read exactly as typed: a sign, digits (commas are allowed only between groups of three digits before the point), and an optional decimal point with digits (.5 is 0.5 and 5. is 5). Exponent notation such as 2.5e-3 is not accepted; type 0.0025. A number with d decimal places is a whole number N over 10^d: 12.3 is 123 ÷ 10. All arithmetic is exact with whole numbers of any size.
For a = N₁ ÷ 10^d₁ and b = N₂ ÷ 10^d₂, the product is a × b = (N₁ × N₂) ÷ 10^(d₁ + d₂). Let x = |N₁| and y = |N₂|. Long multiplication finds x × y as a sum of partial products: for each digit of y that is not 0, x times that digit times its place value (1, 10, 100, …), starting with the ones digit.
The calculator shows:
- Product: the exact product, with a minus sign (a plain hyphen) when exactly one number is negative and the product is not 0, no thousands separators, and no trailing zeros after the decimal point (0.100 is written 0.1, and 1.00 is written 1).
- Problem: both numbers written the same way,
a × b, with a negative second number in brackets:-2.5 × 0.4,3 × (-2). - Long multiplication (steps joined by a semicolon and a space, whole numbers written without points or commas):
- When d₁ + d₂ is more than 0:
Set the decimal points aside: x × y. - One line per non-zero digit of y, from the ones digit up:
x × m = <x × m>, where m is the digit times its place value (123 × 40 = 4920). - When there are two or more partial products:
Add the partial products: p₁ + p₂ + … = <x × y>. When y is 0 there are no partial products, and the line isx × 0 = 0. - When d₁ + d₂ is more than 0:
d₁ + d₂ = <d₁ + d₂> decimal places: <x × y with that many decimal places, trailing zeros kept>("1 decimal place" is singular). - When exactly one number is negative and the product is not 0:
One number is negative, so the product is negative: <product>.
- When d₁ + d₂ is more than 0:
Assumptions
- The numbers are exact decimals of up to 40 characters; there is no rounding.
Worked examples by hand
123 × 45. The ones digit of 45 is 5: 123 × 5 = 615. The tens digit is 4: 123 × 40 = 4920. Add: 615 + 4920 = 5535.
12.3 × 4.5. Set the points aside: 123 × 45 = 5535, as above. 12.3 has 1 decimal place and 4.5 has 1, so the product has 2: 55.35.
−2.5 × 0.4. 25 × 4 = 100, with 1 + 1 = 2 decimal places: 1.00. One number is negative, so the product is −1.
987654321 × 123456789. Nine partial products (987654321 × 9, × 80, × 700, …) add up to 121932631112635269.
2,048 × 305. 2048 × 5 = 10240; the 0 in the tens place gives nothing; 2048 × 300 = 614400. Add: 10240 + 614400 = 624640.
Other questions people ask
How does long multiplication work?
Multiply the top number by each digit of the bottom number, one at a time, shifting one place left for each digit (a partial product), then add the partial products. 123 × 45: 123 × 5 = 615 and 123 × 40 = 4920, and 615 + 4920 = 5535.
How do I multiply decimals?
Multiply as if there were no decimal points, then count the decimal places in both numbers together and give the product that many. 12.3 × 4.5: 123 × 45 = 5535, and 1 + 1 = 2 places gives 55.35.
What happens with a zero in the second number?
A 0 digit gives a partial product of 0, so you can skip it, as long as the next partial product still moves to the right place. 2,048 × 305 = 2048 × 5 + 2048 × 300 = 10240 + 614400 = 624640.
What is the sign of the product?
A positive times a positive, or a negative times a negative, is positive. When exactly one number is negative, the product is negative: −2.5 × 0.4 = −1.
Can I multiply very large numbers?
Yes. The calculator works with every digit you type (up to 40 characters per number), so 987654321 × 123456789 gives the exact product 121932631112635269, with no rounding.
Does the order of the numbers matter?
Not for the answer: a × b = b × a. The working takes its partial products from the digits of the second number, so putting the number with fewer non-zero digits second gives shorter working.