TExcelTAD
Home › Basic Math & Pre-Algebra › What a Fraction Is

What a Fraction Is

A fraction describes a part of a whole, or more generally one whole number divided by another. This lesson explains the numerator and the denominator, shows fractions on the number line, and introduces Python's Fraction type, which does exact fraction arithmetic for you.

Parts of a whole

Cut a pizza into 8 equal slices and eat 3 of them. You ate 38\frac{3}{8} of the pizza.

text
  3   ← numerator: how many parts you have
 ───
  8   ← denominator: how many equal parts make one whole
  • The denominator (bottom) says what size the parts are: eighths, here.
  • The numerator (top) counts how many of those parts you have.
  • The line between them means "divided by": 38\frac{3}{8} is the same number as 3÷83 \div 8.

The parts must be equal. Three slices of a pizza cut into uneven pieces is not 38\frac{3}{8} of anything.

Fraction Read as Meaning
12\frac{1}{2} one half 1 of 2 equal parts
23\frac{2}{3} two thirds 2 of 3 equal parts
54\frac{5}{4} five quarters more than one whole: 1 whole and 14\frac{1}{4}
44\frac{4}{4} four quarters exactly 1
07\frac{0}{7} zero sevenths 0

Proper and improper fractions

  • A proper fraction has a numerator smaller than its denominator (38\frac{3}{8}, 23\frac{2}{3}). Its value is between 0 and 1.
  • An improper fraction has a numerator equal to or larger than its denominator (54\frac{5}{4}, 99\frac{9}{9}). Its value is 1 or more. You can also write it as a mixed number, such as 1141\frac{1}{4}.

There is nothing wrong with improper fractions. In calculations they are usually easier to work with than mixed numbers.

Note: The denominator can never be 0. "Split a whole into 0 equal parts" has no meaning, just like division by zero.

Fractions on the number line

Every fraction is a point on the number line. To place 34\frac{3}{4}, split the stretch from 0 to 1 into 4 equal steps and walk 3 of them:

text
0        1/4       2/4       3/4        1        5/4
|---------|---------|---------|---------|---------|
                              ▲

Fractions fill in the gaps between the whole numbers. Between any two fractions there is always another one (their average, for example), so the gaps never run out.

Fractions in Python

Python's / operator gives a float, which is a binary approximation. The fractions module gives an exact rational number instead:

python · try it yourself
from fractions import Fraction

eaten = Fraction(3, 8)
print("eaten:", eaten)
print("numerator:", eaten.numerator, " denominator:", eaten.denominator)
print("as a float:", float(eaten))
print("3 / 8 with plain division:", 3 / 8)

print(Fraction(5, 4) > 1)    # improper: more than one whole
print(Fraction(4, 4))        # exactly one, printed as 1
print(Fraction("2/3"))       # can be built from a string too
eaten: 3/8
numerator: 3  denominator: 8
as a float: 0.375
3 / 8 with plain division: 0.375
True
1
2/3

Fraction(0, 5) is fine, but Fraction(1, 0) raises ZeroDivisionError, which is exactly the rule from above.

Fraction of a group

A fraction can describe part of a collection as well as part of one object. If 12 of the 30 players in a match are on the red team, the red team is 1230\frac{12}{30} of the players:

python · try it yourself
from fractions import Fraction

players = ["red"] * 12 + ["blue"] * 18
red_share = Fraction(players.count("red"), len(players))
print("red share:", red_share)            # Python simplifies 12/30 for you
print("blue share:", 1 - red_share)
print("check:", red_share + (1 - red_share))
red share: 2/5
blue share: 3/5
check: 1

Python stored 1230\frac{12}{30} as 25\frac{2}{5} straight away. That is called simplifying, and it is the topic of the next lesson.

In software

  • Progress bars and loading screens show "loaded/total\text{loaded} / \text{total}" as a fraction of the bar's width.
  • Audio and video describe frame rates as fractions: NTSC video runs at 300001001\frac{30000}{1001} frames per second (about 29.97), and FFmpeg stores it exactly as that fraction to avoid drift over long recordings.
  • Music software stores note lengths as fractions of a bar: 14\frac{1}{4} for a quarter note, 38\frac{3}{8} for a dotted quarter.
  • Layouts: CSS grid's fr unit splits leftover space into fractions (1fr 2fr gives 13\frac{1}{3} and 23\frac{2}{3}).

Tip: Whenever you need an exact ratio of two integers, for example a game's tick rate or an aspect ratio, Fraction keeps it exact. A float only approximates values like 13\frac{1}{3}.

Exercises

Exercise 1: Name the fraction

A chocolate bar has 12 equal squares. You eat 5 of them. What fraction did you eat, and what fraction is left?

Answer

You ate 512\frac{5}{12}; 712\frac{7}{12} is left.

Solution

The whole is split into 12 equal squares, so the denominator is 12. You have 5 of them, so you ate 512\frac{5}{12}. The rest is 12−5=712 - 5 = 7 squares, which is 712\frac{7}{12}. Check: 512+712=1212=1\frac{5}{12} + \frac{7}{12} = \frac{12}{12} = 1 whole bar.

Exercise 2: Proper or improper?

Sort these into proper and improper fractions: 49\frac{4}{9}, 94\frac{9}{4}, 66\frac{6}{6}, 1100\frac{1}{100}, 1312\frac{13}{12}.

Answer

Proper: 49\frac{4}{9}, 1100\frac{1}{100}. Improper: 94\frac{9}{4}, 66\frac{6}{6}, 1312\frac{13}{12}.

Solution

A fraction is proper when numerator<denominator\text{numerator} < \text{denominator} (value below 1), improper when numerator≥denominator\text{numerator} \ge \text{denominator}.

494<9proper949≥4improper (214)666≥6improper (exactly 1)11001<100proper131213≥12improper (1112)\begin{aligned} &\frac{4}{9} && 4 < 9 && \text{proper} \\ &\frac{9}{4} && 9 \ge 4 && \text{improper } (2\tfrac{1}{4}) \\ &\frac{6}{6} && 6 \ge 6 && \text{improper (exactly 1)} \\ &\frac{1}{100} && 1 < 100 && \text{proper} \\ &\frac{13}{12} && 13 \ge 12 && \text{improper } (1\tfrac{1}{12}) \end{aligned}

Exercise 3: Between 0 and 1

On a number line from 0 to 1 split into fifths, which tick mark is 35\frac{3}{5}? Name a fraction that lies between 35\frac{3}{5} and 45\frac{4}{5}.

Answer

The third tick after 0. For example 710\frac{7}{10} lies between them.

Solution

Fifths split 0 to 1 into 5 equal steps; 35\frac{3}{5} is three steps from 0. The average of 35\frac{3}{5} and 45\frac{4}{5} lies halfway between them: (35+45)÷2=(75)÷2=710(\frac{3}{5} + \frac{4}{5}) \div 2 = (\frac{7}{5}) \div 2 = \frac{7}{10}. In tenths, 35=610\frac{3}{5} = \frac{6}{10} and 45=810\frac{4}{5} = \frac{8}{10}, so 710\frac{7}{10} sits in the middle.

python · try it yourself
from fractions import Fraction as F
mid = (F(3, 5) + F(4, 5)) / 2
print(mid, F(3, 5) < mid < F(4, 5))
7/10 True

Exercise 4: Team shares in code

A server has 40 players: 14 on red, 16 on blue, the rest spectating. Write Python that prints each group's share as a Fraction and checks that the shares add up to 1.

Answer

red 720\frac{7}{20}, blue 25\frac{2}{5}, spectators 14\frac{1}{4}, total 1.

Solution

Spectators: 40−14−16=1040 - 14 - 16 = 10. Each share is count40\frac{\text{count}}{40}, which Fraction simplifies: 1440=720\frac{14}{40} = \frac{7}{20}, 1640=25\frac{16}{40} = \frac{2}{5}, 1040=14\frac{10}{40} = \frac{1}{4}.

python · try it yourself
from fractions import Fraction

total = 40
groups = {"red": 14, "blue": 16}
groups["spectators"] = total - sum(groups.values())
shares = {name: Fraction(n, total) for name, n in groups.items()}
for name, share in shares.items():
    print(name, share)
print("total", sum(shares.values()))
red 7/20
blue 2/5
spectators 1/4
total 1

Test yourself

In the fraction 59\frac{5}{9}, what does the 9 tell you?

  1. How many parts you have
  2. How many equal parts make one whole
  3. How many wholes there are
  4. The answer of 5×95 \times 9

Which of these is an improper fraction?

  1. 37\frac{3}{7}
  2. 12\frac{1}{2}
  3. 04\frac{0}{4}
  4. 76\frac{7}{6}

What does print(Fraction(10, 4)) show?

  1. 10/4
  2. 2.5
  3. 5/2
  4. Fraction(10, 4)