# Fractions Calculator

Fractions calculator: addition, subtraction, multiplication, and division of fractions.

## Components of a fraction

a/b is a fraction where a and b are 2 integers,
a is called the numerator of the fraction, b is called the denominator of the fraction.
Example:
Fraction 8/5 is composed of a numerator (8) and a denominator (5).

Two cases can be distinguished depending on whether the two fractions have the same denominator or not.
Case 1: Both fractions have the same denominator.

Example: 8/3+2/3

In this case, the addition is simple: just add the numerator of both fractions. The denominator of the result will be the common denominator for both fractions.

8/3+2/3 = (8+2) /3 = 10/3

Simplification step: 10/3 is irreducible. For more details, see Simplify fraction 10/3.
The final result is: 10/3

Case 2: The 2 fractions do not have the same denominator.
Example: 7/3+2/5

There are 2 methods to make the calculation. Either we apply the formula,
a/b+c/d = (a*d+c*b)/(b*d) , that we apply to our example,

7/3+2/5 = (7*5+2*3)/(3*5) = 41/15

In the second method, we find the smallest common denominator for both fractions.
The common denominator is equal to the LCM (Least Common multiple) of the two denominators. For more details, see LCM(3,5) =15.

We rewrite the two fractions with the common denominator.
7/3+2/5 = (7*5)/(3*5) + (2*3)/(5*3) = 35/15+6/15

35/15+6/15 = (35+6) /15 = 41/15

Simplification step: fraction 41/15 is irreducible. For more details, see Simplify fraction 41/15.
The final result :
7/3+2/5 = 41/15

## How to subtract fractions ?

The subtraction method is similar to the addition method. Just replace the symbol + with - in the methods explained above. Thus,
Case 1: Both fractions have the same denominator.
8/3-2/3 = (8-2) /3 = 6/3 = 2

Case 2: Fractions do not have the same denominator.
Method 1:
We apply the formula,
a/b-c/d = (a*d-c*b)/(b*d)

7/3-2/5 = (7*5 - 2*3)/(3*5) = (35-6) /15 = 29/15

Method 2:
The LCM (Least Common Multiple) of 3 and 5 is 15.
7/3-2/5 = (7*5)/(3*5) - (2*3)/(5*3) = 35/15-6/15 = 29/15

## How to multiply fractions?

Multiply the two numerators and the two denominators ! For example,
12/7*5/8 = (12*5)/(7*8)

Simplification step: Before calculating the products, we always try to simplify the fraction. 12 and 8 have common divisors.
12/7*5/8 = (4*3*5)/(7*2*4)

We simplify and get,
12/7*5/8 = (3*5)/(7*2) = 15/14

## How to divide fractions?

Dividing a fraction by a fraction is equivalent to multiplying the first fraction by the second fraction inverse !
The formula is as follows:

a/b\div c/d = a/b*d/c

Example,

14/3\div 2/5 = 14/3*5/2

We then apply the method explained above How to multiply two fractions.

14/3\div 5/2 = (14*5)/(3*2)

14/3\div 5/2 = (2*7*5)/(3*2) = (7*5) /3 = 35/3