Understanding the fraction calculator — concept and principle
This calculator adds, subtracts, multiplies or divides two fractions a/b and c/d and returns the answer in lowest terms together with its decimal value. It is used for homework, recipe and woodworking measurements, and any calculation where exact fractional answers are better than rounded decimals.
How it is calculated
- Addition: a/b + c/d = (a·d + b·c) / (b·d)
- Subtraction: a/b − c/d = (a·d − b·c) / (b·d)
- Multiplication: a/b × c/d = (a·c) / (b·d)
- Division: a/b ÷ c/d = (a·d) / (b·c), i.e. multiply by the reciprocal of c/d.
The result N/D is then divided by GCD(N, D) to put it in lowest terms, and if the denominator comes out negative the sign is moved to the numerator. The decimal shown is N ÷ D.
The principle
Fractions can only be added or subtracted when they refer to pieces of the same size, so both are first rewritten over a common denominator. Multiplying a/b by d/d and c/d by b/b gives the common denominator b·d without changing either value. Multiplication works directly because taking c/d of a/b means splitting the a/b part into d pieces and taking c of them. Division asks how many times c/d fits into a/b, which equals multiplying by d/c. The product b·d is always a common denominator, though not always the smallest, which is why the last step reduces the answer.
Worked example
- Inputs: 1/3 + 1/4 (a = 1, b = 3, c = 1, d = 4).
- Numerator: a·d + b·c = 1·4 + 3·1 = 7.
- Denominator: b·d = 3·4 = 12.
- GCD(7, 12) = 1, so the fraction is already reduced: 7/12.
- Decimal: 7 ÷ 12 = 0.58333…, shown as 0.5833333333.
How to read the result
The fraction is exact; the decimal is rounded for display. A result whose numerator is larger than its denominator is an improper fraction and can be rewritten as a mixed number. A negative result means the second value was larger in a subtraction, or exactly one of the inputs was negative.
Common mistakes
- Adding tops and bottoms separately: 1/3 + 1/4 is not 2/7.
- Forgetting to flip the second fraction in division, or flipping the first one instead.
- Cancelling across a plus sign.
- Leaving a zero denominator; also, dividing by a fraction whose numerator c is 0 is undefined.
Frequently asked questions
Why not always use the least common denominator?
The LCD keeps numbers smaller, which matters by hand. The product b·d always works, and reducing at the end gives the same final answer.
How do I add mixed numbers like 2 1/3 + 1 1/4?
Convert to improper fractions first (7/3 + 5/4 = 43/12), then convert back if you want: 3 7/12.
How do I calculate with three or more fractions?
Apply the operation two at a time, following the usual order of operations: multiplication and division before addition and subtraction.
Sources: D. E. Knuth, The Art of Computer Programming, Vol. 2: Seminumerical Algorithms, Section 4.5.1 (fractions)