How the fraction calculator works
A fraction is a division that has not been carried out: 3/4 is 3 divided by 4. Working with fractions means keeping that division exact instead of rounding to a decimal, and every rule below exists to keep the value unchanged while the form changes. This calculator does the arithmetic with exact integer math, so results like 1/3 + 1/6 come out as 1/2 rather than 0.49999.
| Operation | Rule | Example |
|---|---|---|
| Add | a/b + c/d = (a x d + c x b) / (b x d) | 1/2 + 1/3 = (3 + 2) / 6 = 5/6 |
| Subtract | a/b - c/d = (a x d - c x b) / (b x d) | 3/4 - 5/6 = (18 - 20) / 24 = -2/24 = -1/12 |
| Multiply | a/b x c/d = (a x c) / (b x d) | 2/3 x 3/4 = 6/12 = 1/2 |
| Divide | a/b / c/d = a/b x d/c | 1/2 / 3/4 = 1/2 x 4/3 = 4/6 = 2/3 |
| Simplify | divide top and bottom by gcd(a, b) | 18/24: gcd is 6, so 3/4 |
| Mixed to improper | w n/d = (w x d + n) / d | 2 1/2 = 5/2 |
Worked example: 2 1/2 + 1 3/4
The defaults add two mixed numbers. First each becomes an improper fraction, then the fractions are put over a common denominator by cross multiplication, and finally the result is simplified and written as a mixed number.
2 1/2 = (2 x 2 + 1) / 2 = 5/2 1 3/4 = (1 x 4 + 3) / 4 = 7/4 common denominator 2 x 4 = 8: (5 x 4 + 7 x 2) / (2 x 4) = (20 + 14) / 8 = 34/8 greatest common factor of 34 and 8 is 2, so 34/8 = 17/4 17/4 = 4 remainder 1, so 17/4 = 4 1/4 = 4.25
Cross multiplying gives a common denominator of 8, which here also happens to be the least common denominator. When it is not (1/6 + 1/4 cross multiplies to 24 while the least common denominator is 12), the answer is still right; the simplify step just has more to remove. Using the least common denominator saves work by hand, but the result is identical.
Common denominators
Fractions can only be added or subtracted when they count the same size of piece. 1/2 and 1/3 cannot be added directly because halves and thirds are different pieces; rewriting them as 3/6 and 2/6 makes both count sixths, and then 3 + 2 = 5 sixths. Multiplying the denominators always produces a common denominator, and multiplying each numerator by the other fraction's denominator keeps each value unchanged, which is all cross multiplication is.
Simplifying and lowest terms
A fraction is in lowest terms when its numerator and denominator share no factor larger than 1. To get there, divide both by their greatest common factor. The calculator finds it with Euclid's algorithm: gcd(24, 18) = gcd(18, 6) = gcd(6, 0) = 6. Simplifying never changes the value; 18/24 and 3/4 are the same number, the second is just the standard way to write it. Negative fractions carry the sign on the numerator, so -2/24 simplifies to -1/12.
Mixed numbers, improper fractions, and decimals
An improper fraction has a numerator at least as large as its denominator, like 17/4. Dividing gives the mixed form: 17 divided by 4 is 4 with remainder 1, so 17/4 = 4 1/4. Both forms are correct; mixed numbers are easier to read, improper fractions are easier to calculate with. The decimal is the numerator divided by the denominator, 17 / 4 = 4.25, and it is exact only when the simplified denominator has no prime factors other than 2 and 5. 1/3 = 0.333... repeats forever, which is why the fraction form is kept.
| Fraction | Decimal | Percent |
|---|---|---|
| 1/8 | 0.125 | 12.5% |
| 1/4 | 0.25 | 25% |
| 1/3 | 0.3333... | 33.33% |
| 3/8 | 0.375 | 37.5% |
| 1/2 | 0.5 | 50% |
| 5/8 | 0.625 | 62.5% |
| 2/3 | 0.6667 | 66.67% |
| 3/4 | 0.75 | 75% |
| 7/8 | 0.875 | 87.5% |
Decimal to fraction
Any terminating decimal is a fraction whose denominator is a power of ten: count the digits after the point, write the number over 10 to that power, and simplify. 0.375 has three digits after the point, so it is 375/1000, and the greatest common factor 125 reduces it to 3/8. 2.5 becomes 25/10 = 5/2 = 2 1/2. The decimal mode shows exactly these steps.