Fractions#
Fractions are a way of expressing ratios and are synonymous to division. They are written in the form:
The expression on the top of the fraction, \(A\), is called the numerator.
The expression on the bottom, \(B\), is known as the denominator.
Simplifying Fractions#
Plenty of fractions can be reduced to simpler forms, for example \(\frac{2}{4}\) is the same as \(\frac{1}{2}\). The best way of simplifying is to find a number that is a factor of the numerator and the denominator, so that it cancels.
Example
Simply \(\frac{350}{1000}\) into its simplest form.
Solution: We first notice that a factor of 10 can be taken out of both the numerator and denominator, leaving us with:
the only remaining factors of 35 are 7 and 5. 5 is also a factor of 100, so we can take it out as a factor as well:
We cannot simplify any further because the numerator and denominator share no more factors.
We could check this with Python, as the following would return true.
350 / 1000 == 7 / 20
True
Example
Simpify \(\frac{2x + 6xy}{4x^2 + 10x^3}\).
Solution: We note first all the terms are even, this means we can take a factor of 2 out. Also all terms have an \(x\) in them, meaning we can take a factor of \(x\) out.
Since we now have a factor of \(2x\) on both numerator and denominator, it will cancel, leaving us with a fraction that can’t be simplified any more. The following steps are illustrated below.
Python is capable of helping us to simplify these symbolic fractions.
from sympy import symbols, simplify
x, y = symbols('x y')
numerator = 2 * x + 6 * x * y
denominator = 4 * x ** 2 + 10 * x ** 3
simplify(numerator / denominator)
Fractions in Water
What fraction of water’s mass is hydrogen?
Recall the relative atomic mass of oxygen and hydrogen are 16 and 1 respectively. Remember also that the molecular formula for water is H2O.
Solution: So the molecular mass of water is equal to \((1 \times 2) + 16 = 18\). The mass of the hydrogen in water is 2, so out of 18 amu (atomic mass units) 2 are hydrogen. Expressed as a fraction this is \(\frac{2}{18}\) which simplifies to \(\frac{1}{9}\). You can check this with some simple Python code.
Multiplying Fractions#
Multiplying two fractions together is a simple process, the numerator is the product of the numerators and the denominator is the product of the denominators.
Generally, when we multiply many fractions together, the numerator is the product of all the numerators and similarly with the denominators. Using the Π notation, we can generalise this as:
Example
Find:
Solution: We find this as:
1/2 * 2/3 * 4/5 * 5/7
0.19047619047619047
Example
Now find:
Solution: As highlighted in the note:
import numpy as np
5 * np.sqrt(2) * 3 / 10
2.121320343559643
Moles of Water
A chemist prepares a solution containing \(\frac{1}{50}\) mole of propanol in 1000 ml of water. How many moles of propanol are there in a 250 ml aliquot of this solution?
Solution: To calculate this, we need to know what fraction 250 ml is to 1000 ml. That will be \(\frac{250}{1000}\), which simplifies to \(\frac{1}{4}\).
The number of moles taken out is then the product of two fractions:
This can be easily computed in Python as:
ratio = 1 / 50 #mol
reduction = 250 / 1000
ratio * reduction
0.005
Dividing Fractions#
The inverse of the fraction is where the numerator and denominator switch, e.g., fraction \(\frac{a}{b}\) has an inverse of \(\frac{b}{a}\).
Division is the inverse of multiplication, so when we divide a fraction, we are essentially multiplying by the inverse of that fraction. So a general example of division of fractions would look like:
Example
Find the following:
Solution: This can be found as:
To get the order of operations right in Python, some brackets are necessary.
(9 / 16) / (3 / 4)
0.75
Adding and Subtracting Fractions#
To be able to add and subtract two fractions, they both need to have the same denominator, called a common demoninator. Take \(\frac{1}{4} + \frac{1}{5}\), for example. We need a new denominator for both in order to add them. The easiest denominator to pick is almost always the product of the two, so in this case \(4\times 5 = 20\).
Subtracting fractions works exactly the same way, the denominators need to be the same, but you then subtract at the end.
Example
Find \(\frac{1}{3} + \frac{1}{6}\). Express your answer as a simplified fraction.
Solution: The first thing is to check whether the denominators are the same and if not, what can we do to fix that. Notice that in this case, we don’t need to change the second fraction, because 3 is a factor of 6. What we would do instead is change the first fraction to have 6 as the denominator by multiplying by \(\frac{2}{3}\).
From here, we can see that the fraction can be simplied further. A factor of 3 can be taken out of the top and bottom leaving us with:
This can be a single line of Python.
(1 / 3) + (1 / 6)
0.5
Example
Express the following as a single fraction:
Solution: To do this, we will multiply the denominators to get \((x + 1)(x-1)\) as the new denominator.
Again, we can use the sympy
package to help with this.
x = symbols('x')
simplify(1 / (x + 1) - 1 / (x - 1))