TExcelTAD
Home › Basic Math & Pre-Algebra › Mixed Numbers

Mixed Numbers

A mixed number combines a whole number and a proper fraction, like 2342\frac{3}{4} ("two and three quarters"). This lesson converts between mixed numbers and improper fractions, connects the conversion to division with remainder, and shows how to do it in Python with divmod.

What a mixed number means

The mixed number 2342\frac{3}{4} means 2 wholes plus 34\frac{3}{4} more:

234=2+342\frac{3}{4} = 2 + \frac{3}{4}

Recipes, tape measures and timetables use mixed numbers because they are easy to picture: "1121\frac{1}{2} cups of flour" is clearer than "32\frac{3}{2} cups". For calculations, though, improper fractions are easier, so you will convert back and forth a lot.

Mixed number → improper fraction

Multiply the whole part by the denominator, add the numerator, and keep the denominator:

234→2×4+34=114513→5×3+13=163178→1×8+78=158\begin{aligned} 2\frac{3}{4} &\to \frac{2 \times 4 + 3}{4} = \frac{11}{4} \\ 5\frac{1}{3} &\to \frac{5 \times 3 + 1}{3} = \frac{16}{3} \\ 1\frac{7}{8} &\to \frac{1 \times 8 + 7}{8} = \frac{15}{8} \end{aligned}

Why: 2 wholes are 2×4=82 \times 4 = 8 quarters, plus 3 quarters makes 11 quarters.

Improper fraction → mixed number

Divide the numerator by the denominator. The quotient is the whole part, the remainder is the new numerator:

175:17÷5=3 remainder 2→325227:22÷7=3 remainder 1→317124:12÷4=3 remainder 0→3 (a whole number)\begin{aligned} \frac{17}{5}{:}&\quad 17 \div 5 = 3 \text{ remainder } 2 && \to 3\frac{2}{5} \\ \frac{22}{7}{:}&\quad 22 \div 7 = 3 \text{ remainder } 1 && \to 3\frac{1}{7} \\ \frac{12}{4}{:}&\quad 12 \div 4 = 3 \text{ remainder } 0 && \to 3 \text{ (a whole number)} \end{aligned}

That is division with remainder, and Python's divmod gives you both parts at once:

python · try it yourself
def to_mixed(top, bottom):
    whole, rest = divmod(top, bottom)
    if rest == 0:
        return f"{whole}"
    return f"{whole} {rest}/{bottom}" if whole else f"{rest}/{bottom}"

def to_improper(whole, top, bottom):
    return whole * bottom + top, bottom

for top, bottom in [(17, 5), (22, 7), (12, 4), (3, 8)]:
    print(f"{top}/{bottom} = {to_mixed(top, bottom)}")

print("2 3/4 =", "%d/%d" % to_improper(2, 3, 4))
print("5 1/3 =", "%d/%d" % to_improper(5, 1, 3))
17/5 = 3 2/5
22/7 = 3 1/7
12/4 = 3
3/8 = 3/8
2 3/4 = 11/4
5 1/3 = 16/3

Tip: Simplify the fraction part when you can: 144=324=312\frac{14}{4} = 3\frac{2}{4} = 3\frac{1}{2}. Simplifying first (144=72\frac{14}{4} = \frac{7}{2}) gives the same 3123\frac{1}{2}.

Negative mixed numbers

A negative mixed number like −214-2\frac{1}{4} means −(2+14)=−94-(2 + \frac{1}{4}) = -\frac{9}{4}. The minus sign applies to the whole thing, not only to the 2. This is a classic trap when converting by hand, and also in code: Python's divmod rounds toward minus infinity, so divmod(-9, 4) gives (-3, 3), which means −3+34-3 + \frac{3}{4}. That is the same number, but not the form people write.

python · try it yourself
from fractions import Fraction

def mixed(fr):
    sign = "-" if fr < 0 else ""
    whole, rest = divmod(abs(fr.numerator), fr.denominator)
    return f"{sign}{whole} {rest}/{fr.denominator}"

x = Fraction(-9, 4)
print("divmod(-9, 4) =", divmod(-9, 4))
print("human form:", mixed(x))
print("check:", -(2 + Fraction(1, 4)) == x)
divmod(-9, 4) = (-3, 3)
human form: -2 1/4
check: True

Working with the absolute value and putting the sign back at the end gives the usual written form.

Mixed numbers in measurements

US customary measurements are full of mixed numbers. A carpentry helper might turn a decimal length in inches into the nearest sixteenth:

python · try it yourself
from fractions import Fraction

def to_sixteenths(inches):
    f = Fraction(round(inches * 16), 16)      # nearest 1/16 inch
    whole, rest = divmod(f.numerator, f.denominator)
    part = Fraction(rest, f.denominator)
    return f"{whole} {part}\"" if part else f"{whole}\""

for length in [2.75, 5.3125, 7.9, 3.0]:
    print(length, "->", to_sixteenths(length))
2.75 -> 2 3/4"
5.3125 -> 5 5/16"
7.9 -> 7 7/8"
3.0 -> 3"

7.9×16=126.47.9 \times 16 = 126.4, which rounds to 126 sixteenths=71416=778126 \text{ sixteenths} = 7\frac{14}{16} = 7\frac{7}{8} inches. Fraction simplified 1416\frac{14}{16} for us.

In software

  • Time is the everyday mixed number: 135 minutes is divmod(135, 60) = (2, 15), so 2 h 15 min. The same pattern formats durations, file sizes ("3 GB 512 MB") and pagination (item 47 with 10 per page is on page 4, position 7).
  • Recipe and DIY apps display mixed numbers ("1121\frac{1}{2} cups") but compute with improper fractions internally.

Exercises

Exercise 1: To improper

Write 3563\frac{5}{6} and 7297\frac{2}{9} as improper fractions.

Answer

236\frac{23}{6} and 659\frac{65}{9}.

Solution
356=3×6+56=18+56=236729=7×9+29=63+29=659\begin{aligned} 3\frac{5}{6} &= \frac{3 \times 6 + 5}{6} = \frac{18 + 5}{6} = \frac{23}{6} \\ 7\frac{2}{9} &= \frac{7 \times 9 + 2}{9} = \frac{63 + 2}{9} = \frac{65}{9} \end{aligned}

Exercise 2: To mixed

Write 478\frac{47}{8} and 3012\frac{30}{12} as mixed numbers in lowest terms.

Answer

5785\frac{7}{8} and 2122\frac{1}{2}.

Solution
47÷8=5 remainder 7→57830÷12=2 remainder 6→2612→212(612 simplifies)\begin{aligned} &47 \div 8 = 5 \text{ remainder } 7 && \to 5\frac{7}{8} \\ &30 \div 12 = 2 \text{ remainder } 6 \to 2\frac{6}{12} && \to 2\frac{1}{2} \quad (\tfrac{6}{12} \text{ simplifies}) \end{aligned}

Exercise 3: Minutes to hours

A film lasts 167 minutes. Write its length as a mixed number of hours in lowest terms, and as "h min".

Answer

247602\frac{47}{60} hours, which is 2 h 47 min.

Solution

167÷60=2167 \div 60 = 2 remainder 47, so 16760 h=24760 h\frac{167}{60}\ \text{h} = 2\frac{47}{60}\ \text{h}. 47 and 60 share no factor (47 is prime), so it is in lowest terms. The remainder is the minutes: 2 h 47 min.

python · try it yourself
h, m = divmod(167, 60)
print(f"{h} {m}/60 hours = {h} h {m} min")
2 47/60 hours = 2 h 47 min

Exercise 4: A mixed-number formatter

Write fmt(fr) that turns any Fraction into a human mixed number: Fraction(-17, 6) → -2 5/6, Fraction(8, 4) → 2, Fraction(3, 7) → 3/7.

Answer

-2 5/6, 2, 3/7.

Solution

Work on the absolute value so divmod behaves, drop the zero parts, then put the sign back.

python · try it yourself
from fractions import Fraction

def fmt(fr):
    sign = "-" if fr < 0 else ""
    whole, rest = divmod(abs(fr.numerator), fr.denominator)
    if rest == 0:
        return f"{sign}{whole}"
    if whole == 0:
        return f"{sign}{rest}/{fr.denominator}"
    return f"{sign}{whole} {rest}/{fr.denominator}"

for f in [Fraction(-17, 6), Fraction(8, 4), Fraction(3, 7), Fraction(-1, 2)]:
    print(fmt(f))
-2 5/6
2
3/7
-1/2

Test yourself

What is 4234\frac{2}{3} as an improper fraction?

  1. 83\frac{8}{3}
  2. 143\frac{14}{3}
  3. 423\frac{42}{3}
  4. 63\frac{6}{3}

What is 296\frac{29}{6} as a mixed number?

  1. 4564\frac{5}{6}
  2. 5165\frac{1}{6}
  3. 4164\frac{1}{6}
  4. 291629\frac{1}{6}

Which improper fraction equals −135-1\frac{3}{5}?

  1. −25-\frac{2}{5}
  2. 25\frac{2}{5}
  3. −85-\frac{8}{5}
  4. 85\frac{8}{5}