# Sorting fractions

Given two integers we can determine easily which is bigger. This relation of order can be defined also between fractions.

Let's consider the fractions $$\displaystyle \frac{a}{b}$$ and $$\displaystyle \frac{c}{d}$$ with $$b$$ and $$d$$ positives. The fraction $$\displaystyle \frac{a}{b}$$ is bigger than the fraction $$\displaystyle \frac{c}{d}$$ if $$a\cdot d >c \cdot b$$$. This relation is natural because $$\displaystyle \frac{a}{b}=\frac{a\cdot d}{b \cdot d}$$ and $$\displaystyle \frac{c}{d}=\frac{c\cdot b}{d\cdot b}$$, and, as they have the same denominator, we can just focus on the numerator. Let's see some example where we are going to sort the numbers $$\displaystyle \frac{1}{3}, \frac{2}{5}$$ and $$\displaystyle \frac{1}{4}$$. We write them with a common denominator, $$\displaystyle \frac{1}{3}=\frac{1\cdot5\cdot4}{3\cdot5\cdot4}=\frac{20}{60}$$$ $$\displaystyle \frac{2}{5}=\frac{2\cdot3\cdot4}{5\cdot3\cdot4}=\frac{24}{60}$$$$$\displaystyle \frac{1}{4}=\frac{1\cdot3\cdot5}{4\cdot3\cdot5}=\frac{15}{60}$$$

We have $$15 < 20 < 24$$ and therefore $$\dfrac{1}{4} < \dfrac{1}{3} < \dfrac{2}{5}$$