Day 2 — Fractions & rationals
Day 2 — Fractions & rationals
Stage I · concept day
Goal: Define \(\mathbb{Q}\) as a field of fractions; prove equality via \(ad=bc\); reduce by gcd; master mixed numbers, complex fractions, rates/proportions; sketch density of \(\mathbb{Q}\); see one Egyptian fraction decomposition.
Why this matters
Rationals are the language of slopes, probabilities (ratios of counts), normalized quantities, unit conversions, and fixed-point thinking. If fraction arithmetic is shaky, every later manipulation of \(\frac{p(x)}{q(x)}\) will feel harder than it is. Division algorithms, sampling rates, and “\(k\) of \(n\) succeed” all live in \(\mathbb{Q}\).
Theory
Rational numbers as a field
A rational number is a quotient of integers with nonzero denominator:
\[\mathbb{Q} = \Bigl\{\frac{p}{q} : p\in\mathbb{Z},\; q\in\mathbb{Z}\setminus\{0\}\Bigr\}.\]
The same rational has many names: \(\frac{1}{2}=\frac{2}{4}=\frac{-3}{-6}\).
\(\mathbb{Q}\) with \(+\) and \(\times\) is a field: closed under the four arithmetic operations (except divide-by-zero), associative and commutative as appropriate, distributive, with identities \(0,1\) and additive inverses, and every nonzero element has a multiplicative inverse.
Multiplicative inverse: if \(\frac{a}{b}\neq 0\) (so \(a\neq 0\)), then \(\bigl(\frac{a}{b}\bigr)^{-1}=\frac{b}{a}\).
Equality (cross-multiplication test)
For \(b,d\neq 0\),
\[\frac{a}{b}=\frac{c}{d}\quad\Longleftrightarrow\quad ad=bc.\]
Proof. \[ \frac{a}{b}-\frac{c}{d}=\frac{ad-bc}{bd}. \] This difference is \(0\) if and only if the numerator is \(0\) (since \(bd\neq 0\)). So \(\frac{a}{b}=\frac{c}{d}\) iff \(ad-bc=0\) iff \(ad=bc\). \(\square\)
Corollary. \(\frac{a}{b}=\frac{ka}{kb}\) for any integer \(k\neq 0\) (cancel common factors / scale).
Lowest terms and gcd
A fraction \(\frac{p}{q}\) with \(q>0\) is in lowest terms (canonical form) when \(\gcd(|p|,q)=1\).
Any nonzero rational has a unique such representation with positive denominator (unique \(p\in\mathbb{Z}\), \(q\in\mathbb{Z}_{>0}\)).
To reduce: compute \(d=\gcd(|p|,|q|)\), divide numerator and denominator by \(d\), then fix the sign so the denominator is positive.
Example of uniqueness idea: if \(\frac{p}{q}=\frac{r}{s}\) with \(\gcd(|p|,q)=\gcd(|r|,s)=1\) and \(q,s>0\), then \(ps=qr\). Since \(p\) and \(q\) share no common prime factors, \(q\) divides \(s\), and similarly \(s\) divides \(q\), so \(q=s\) and \(p=r\).
Field operations (formulas)
For \(b,d\neq 0\) (and \(c\neq 0\) when dividing by \(\frac{c}{d}\)):
\[ \begin{align*} \frac{a}{b}+\frac{c}{d}&=\frac{ad+bc}{bd},\\ \frac{a}{b}-\frac{c}{d}&=\frac{ad-bc}{bd},\\ \frac{a}{b}\cdot\frac{c}{d}&=\frac{ac}{bd},\\ \frac{a}{b}\div\frac{c}{d}&=\frac{a}{b}\cdot\frac{d}{c}=\frac{ad}{bc}. \end{align*} \]
Strategy: reduce intermediate fractions when possible; for addition, use least common multiple of denominators for smaller intermediates: \[\frac{a}{b}+\frac{c}{d}=\frac{a(d/\gcd)+c(b/\gcd)}{\operatorname{lcm}(b,d)}\] when \(b,d>0\) (using \(\operatorname{lcm}(b,d)=bd/\gcd(b,d)\) — Day 4).
Mixed numbers
A mixed number \(n\frac{a}{b}\) (with \(n\in\mathbb{Z}_{\ge 0}\), \(0\le a<b\)) means \(n+\frac{a}{b}=\frac{nb+a}{b}\).
Convert mixed \(\to\) improper: \(3\frac{2}{5}=\frac{17}{5}\).
Convert improper \(\to\) mixed: \(\frac{17}{5}=3+\frac{2}{5}=3\frac{2}{5}\).
In algebra and CS, prefer improper fractions for calculation; mixed form is for human display.
Complex fractions
A complex fraction has a fraction in numerator, denominator, or both:
\[\frac{\frac{a}{b}}{\frac{c}{d}}=\frac{a}{b}\div\frac{c}{d}=\frac{ad}{bc},\qquad \frac{a+\frac{b}{c}}{d}=\frac{\frac{ac+b}{c}}{d}=\frac{ac+b}{cd}.\]
Clear by multiplying top and bottom by a common denominator of all “inner” denominators.
Rates and proportions
A ratio \(a:b\) is the rational \(\frac{a}{b}\) (when \(b\neq 0\)).
A proportion is an equality of ratios: \(\frac{a}{b}=\frac{c}{d}\).
Cross-multiply to solve: if \(\frac{x}{12}=\frac{5}{8}\), then \(8x=60\), \(x=\frac{15}{2}\).
Rate: quantity per unit (speed \(= \frac{\text{distance}}{\text{time}}\)). Unit analysis is fraction cancellation of units.
Density of \(\mathbb{Q}\) (sketch)
Theorem (density of rationals in reals — sketch). Between any two reals \(x<y\) there exists a rational \(q\) with \(x<q<y\).
Idea. Choose integer \(n\) large enough that \(\frac{1}{n}<y-x\). Among the multiples of \(\frac{1}{n}\), some \(\frac{m}{n}\) lands in \((x,y)\). (Full real-analysis construction uses Archimedean property.)
Consequence for CS intuition: finite decimals and floats are a discrete grid; true \(\mathbb{Q}\) is dense — there is always a rational between two values, so “next rational” is meaningless without a fixed denominator.
Egyptian fractions (lite)
An Egyptian fraction representation writes a positive rational as a sum of distinct unit fractions \(\frac{1}{n_i}\).
Example. \(\frac{3}{4}=\frac{1}{2}+\frac{1}{4}\).
Greedy idea (Fibonacci–Sylvester): for \(\frac{a}{b}\) in \((0,1)\), take \(\frac{1}{\lceil b/a\rceil}\), subtract, repeat.
One step: \(\frac{3}{7}\): \(\lceil 7/3\rceil=3\), so \(\frac{1}{3}\); remainder \(\frac{3}{7}-\frac{1}{3}=\frac{2}{21}\); then \(\lceil 21/2\rceil=11\), etc. You need only one full worked example today, not a complete algorithm proof.
Ordering rationals
\(\frac{a}{b}<\frac{c}{d}\) (with \(b,d>0\)) iff \(ad<bc\). Signs and negative denominators require care: always reduce to positive denominators first.
Worked examples
Example 1 — Equality test
Is \(\frac{14}{21}=\frac{10}{15}\)? Cross: \(14\cdot 15=210\), \(21\cdot 10=210\). Yes. Both reduce to \(\frac{2}{3}\).
Example 2 — Reduce
Reduce \(\frac{84}{126}\). \(\gcd(84,126)=42\), so \(\frac{84/42}{126/42}=\frac{2}{3}\).
Example 3 — Add with LCD
\(\frac{2}{15}+\frac{4}{9}\). \(\operatorname{lcm}(15,9)=45\).
\(\frac{2\cdot 3}{45}+\frac{4\cdot 5}{45}=\frac{6+20}{45}=\frac{26}{45}\).
Example 4 — Subtract negatives
\(\frac{-3}{4}-\frac{5}{6}=\frac{-9-10}{12}=\frac{-19}{12}\).
Example 5 — Multiply and divide
\(\frac{6}{35}\cdot\frac{14}{9}=\frac{6\cdot 14}{35\cdot 9}\). Cancel \(7\): \(\frac{6\cdot 2}{5\cdot 9}=\frac{12}{45}=\frac{4}{15}\).
\(\frac{6}{35}\div\frac{9}{14}=\frac{6}{35}\cdot\frac{14}{9}=\frac{6\cdot 14}{35\cdot 9}=\frac{4}{15}\) after canceling.
Example 6 — Mixed numbers
\(2\frac{1}{3}+1\frac{3}{4}=\frac{7}{3}+\frac{7}{4}=\frac{28+21}{12}=\frac{49}{12}=4\frac{1}{12}\).
Example 7 — Complex fraction
Simplify \(\dfrac{1+\frac{1}{2}}{1-\frac{1}{3}}\).
Numerator \(\frac{3}{2}\), denominator \(\frac{2}{3}\), quotient \(\frac{3}{2}\cdot\frac{3}{2}=\frac{9}{4}\).
Alternatively multiply top and bottom by \(6\): \(\frac{6+3}{6-2}=\frac{9}{4}\).
Example 8 — Nested complex
\(\dfrac{\frac{2}{3}-\frac{1}{4}}{\frac{5}{6}}=\frac{\frac{8-3}{12}}{\frac{5}{6}}=\frac{\frac{5}{12}}{\frac{5}{6}}=\frac{5}{12}\cdot\frac{6}{5}=\frac{1}{2}\).
Example 9 — Proportion
If \(3\) of \(8\) packets fail and the failure rate stays proportional, about how many of \(120\) fail? \(\frac{x}{120}=\frac{3}{8}\Rightarrow x=45\).
Example 10 — Rate
A link transfers \(150\) MB in \(40\) seconds. Rate \(= \frac{150}{40}=\frac{15}{4}\) MB/s \(=3.75\) MB/s. Time for \(90\) MB: \(90\div\frac{15}{4}=90\cdot\frac{4}{15}=24\) s.
Example 11 — Density sketch
Between \(0.1\) and \(0.11\), the rational \(\frac{1}{10}+\frac{1}{200}=\frac{21}{200}=0.105\) works. Or \(\frac{105}{1000}=\frac{21}{200}\).
Example 12 — Egyptian fraction
\(\frac{3}{4}=\frac{1}{2}+\frac{1}{4}\). Check: \(\frac{2+1}{4}=\frac{3}{4}\).
Greedy for \(\frac{4}{13}\): \(\lceil 13/4\rceil=4\), take \(\frac{1}{4}\); remainder \(\frac{4}{13}-\frac{1}{4}=\frac{3}{52}\); continue if desired.
Example 13 — Order
Compare \(\frac{5}{7}\) and \(\frac{7}{10}\): \(5\cdot 10=50\), \(7\cdot 7=49\), so \(\frac{5}{7}>\frac{7}{10}\).
Example 14 — Inverse and field
Multiplicative inverse of \(-\frac{3}{8}\) is \(-\frac{8}{3}\). Product: \(\bigl(-\frac{3}{8}\bigr)\bigl(-\frac{8}{3}\bigr)=1\).
Exercises
Easy
- Test equality: \(\frac{15}{25}\) vs \(\frac{9}{15}\); reduce both.
- Compute \(\frac{2}{3}+\frac{5}{6}\) and reduce.
- Compute \(\frac{7}{8}\cdot\frac{4}{21}\).
- Convert \(5\frac{2}{7}\) to improper; convert \(\frac{47}{6}\) to mixed.
- Compute \(\frac{5}{9}\div\frac{10}{3}\).
Medium
- Prove carefully that \(\frac{a}{b}=\frac{c}{d}\) iff \(ad=bc\) for \(b,d\neq 0\).
- Simplify \(\dfrac{\frac{3}{4}+\frac{1}{6}}{\frac{5}{12}-\frac{1}{8}}\).
- Evaluate \(\frac{-2}{15}-\frac{4}{9}+\frac{1}{5}\); reduce.
- Solve the proportion \(\frac{x-1}{6}=\frac{2x+1}{15}\).
- A job takes \(12\) person-hours. What fraction of the job do \(5\) people do in \(2\) hours (assuming equal constant rate)?
- Show \(\frac{a}{b}+\frac{c}{d}=\frac{ad+bc}{bd}\) by using a common denominator.
- Reduce \(\frac{360}{504}\) by prime factors or Euclidean gcd steps.
- Write \(\frac{5}{6}\) as an Egyptian sum of distinct unit fractions (not necessarily greedy).
Hard
- Prove: if \(\frac{p}{q}\) is in lowest terms and \(q>0\), and \(\frac{p}{q}=\frac{r}{s}\) with \(s>0\) and \(\gcd(|r|,s)=1\), then \(p=r\) and \(q=s\).
- Between \(\frac{1}{3}\) and \(\frac{1}{2}\), find three distinct rationals. Explain a general method using midpoints repeatedly.
- Prove that if \(b,d>0\), then \(\frac{a}{b}<\frac{c}{d}\) iff \(ad<bc\).
- Simplify \(\dfrac{1}{1+\dfrac{1}{1+\dfrac{1}{2}}}\) to a single fraction.
- Rate: \(A\) finishes a task in \(6\) hours, \(B\) in \(4\) hours. Working together at constant rates, what fraction per hour, and how long for one task?
- Show that the sum of two rationals is rational; the product of two rationals is rational (closure proofs with formulas).
- Disprove: “between two rationals there are only finitely many rationals.”
Challenge / CS-flavored
- A progress bar shows \(\frac{7}{32}\) complete. What percent (exact fraction then decimal)? How many of \(256\) equal parts?
- Fixed-point: values stored as integer thousandths. What rational is the integer \(137\) representing? Add “\(0.25\)” in this system.
- Why is \(\frac{1}{2}+\frac{1}{3}+\frac{1}{6}=1\) useful for splitting a whole into unit fractions? Connect to Egyptian style.
- Prove \(\frac{a}{b}-\frac{c}{d}=\frac{ad-bc}{bd}\).
- If a hash table load factor is \(\alpha=\frac{n}{m}=\frac{5}{8}\), and \(m=1024\), find \(n\). If \(n\) grows by \(10\%\), what is new \(\alpha\) as a fraction in lowest terms?
Additional identities and techniques
Negatives. \(\frac{-a}{b}=\frac{a}{-b}=-\frac{a}{b}\). Prefer a single minus in the numerator with \(b>0\).
Multiplicative cancellation. If \(k\neq 0\), then \(\frac{ka}{kb}=\frac{a}{b}\). Never cancel addends: \(\frac{a+c}{b+c}\neq\frac{a}{b}\) in general.
Mediant (optional curiosity). The mediant of \(\frac{a}{b}\) and \(\frac{c}{d}\) (positive denominators) is \(\frac{a+c}{b+d}\), which lies between them. Used in Farey sequences and continued-fraction intuition—not a field operation.
Continued fraction lite. \(1+\frac{1}{2+\frac{1}{2}}=\frac{7}{5}\). Nested unit structure connects to Egyptian/greedy ideas and Diophantine approximation (advanced).
More worked reasoning (patterns)
Pattern A — clear complex fraction by LCD.
\(\dfrac{\frac{a}{b}+\frac{c}{d}}{\frac{e}{f}}\): multiply top and bottom by \(bdf\) in one stroke when all letters nonzero.
Pattern B — proportion cross.
\(\frac{a}{b}=\frac{c}{d}\Rightarrow ad=bc\) even when solving for a letter inside \(a\) or \(c\).
Pattern C — rate composition.
If \(A\) does a job in \(p\) hours and \(B\) in \(q\) hours, together rate \(\frac{1}{p}+\frac{1}{q}=\frac{p+q}{pq}\) jobs per hour; time \(\frac{pq}{p+q}\).
Pattern D — density construction.
Given \(x<y\) rationals, midpoint \(\frac{x+y}{2}\) is rational and strictly between them; iterate for infinitely many.
Pattern E — Egyptian non-uniqueness.
\(\frac{3}{4}=\frac{1}{2}+\frac{1}{4}=\frac{1}{3}+\frac{1}{4}+\frac{1}{6}\) (check). Representations need not be unique.
Mini-proofs to internalize
- Closure under \(+\). \(\frac{a}{b}+\frac{c}{d}=\frac{ad+bc}{bd}\) with \(bd\neq 0\) is a ratio of integers.
- Closure under \(\times\). \(\frac{ac}{bd}\) likewise.
- Inverse. Nonzero \(\frac{a}{b}\) has inverse \(\frac{b}{a}\) because product is \(1\).
- Cross-equality. Already proved via difference formula.
Extra exercises (for volume practice)
- Prove \(\frac{a}{b}-\frac{c}{d}=\frac{ad-bc}{bd}\) from the addition formula.
- Simplify \(\dfrac{1-\frac{1}{n}}{1+\frac{1}{n}}\) for integer \(n>1\).
- A tank fills at \(\frac{1}{6}\) per hour and leaks at \(\frac{1}{8}\) per hour; net rate and hours to fill from empty.
- Show that \(\frac{p}{q}\) in lowest terms is an integer iff \(q=1\).
- Between \(\frac{22}{7}\) and \(\frac{333}{106}\), find one rational (midpoint OK).
CS connection
Fractions appear as load factors, sampling rates, aspect ratios, time quanta, and rational slopes in graphics. Exact rational arithmetic (big integers for numerator/denominator) avoids floating-point drift when it matters (geometry predicates, some financial ledgers). Proportions solve “scale this recipe” problems in resource allocation. Density of \(\mathbb{Q}\) reminds you that “the next number after \(x\)” only makes sense on a discrete type (integers, fixed-precision floats), not on true rationals.
Common pitfalls
| Pitfall | What to do instead |
|---|---|
| Adding denominators: \(\frac{1}{2}+\frac{1}{3}=\frac{2}{5}\) | Common denominator: \(\frac{3+2}{6}=\frac{5}{6}\) |
| Canceling terms across \(+\) | Only cancel factors of whole numerator/denominator |
| Forgetting signs when reducing | Put the minus in the numerator; keep \(q>0\) |
| Mixed number \(2\frac{1}{3}\) as \(2\cdot\frac{1}{3}\) | It means \(2+\frac{1}{3}\) |
| Complex fraction paralysis | Multiply top and bottom by LCD of inner denominators |
| Cross-multiplying inequalities with negatives | Flip inequality if multiplying by negative quantity |
| Assuming “unique next rational” | Density: infinitely many between any two |
End-of-day synthesis problems
S1. Prove \(\frac{a}{b}=\frac{c}{d}\Leftrightarrow ad=bc\) carefully; apply to \(\frac{21}{28}\) vs \(\frac{15}{20}\).
S2. Compute \(\frac{5}{6}-\frac{7}{15}+\frac{1}{10}\) reduced.
S3. Complex fraction \(\dfrac{\frac{3}{4}-\frac{1}{6}}{1+\frac{1}{2}}\) simplified.
S4. Work rates: \(A\) alone \(8\) h, \(B\) alone \(12\) h; hours together.
S5. Midpoint method: three rationals between \(\frac{1}{5}\) and \(\frac{1}{4}\).
S6. Egyptian: write \(\frac{5}{6}\) as sum of distinct unit fractions two different ways if possible.
S7. Invert \(-\frac{14}{9}\); verify product \(1\).
S8. Load factor \(\frac{n}{m}=\frac{3}{5}\) with \(m=512\); find \(n\).
Checkpoint
- Define \(\mathbb{Q}\) and state what “field” means at a practical level
- Prove equality \(\Leftrightarrow ad=bc\)
- Add, multiply, divide fractions and reduce by gcd
- Convert mixed \(\leftrightarrow\) improper
- Simplify a complex fraction
- Solve a proportion / rate problem
- Sketch why rationals are dense
- Write one Egyptian decomposition
- S1–S3 exam-ready
Write two takeaways in your own words.
Deep dive — more worked reasoning
D1 — Clear a nested complex fraction in one LCD.
Simplify \(\dfrac{\dfrac{1}{2}+\dfrac{1}{3}}{\dfrac{1}{4}-\dfrac{1}{6}}\).
Inner numerator \(\frac{3+2}{6}=\frac{5}{6}\); denominator \(\frac{3-2}{12}=\frac{1}{12}\); quotient \(\frac{5}{6}\cdot 12=\frac{5}{6}\cdot\frac{12}{1}=10\).
One stroke: multiply top and bottom by \(12\): \(\dfrac{6+4}{3-2}=\dfrac{10}{1}=10\).
D2 — Proportion with a linear expression.
\(\frac{2x+1}{5}=\frac{x-3}{2}\). Cross-multiply: \(2(2x+1)=5(x-3)\), \(4x+2=5x-15\), \(17=x\). Check: \(\frac{35}{5}=7\), \(\frac{14}{2}=7\).
D3 — Work rates three agents (optional stretch).
\(A\) alone \(6\) h, \(B\) alone \(8\) h, \(C\) alone \(24\) h. Together rate \(\frac{1}{6}+\frac{1}{8}+\frac{1}{24}=\frac{4+3+1}{24}=\frac{8}{24}=\frac{1}{3}\) job/h → \(3\) hours for one job.
D4 — Ordering with negatives.
Compare \(-\frac{5}{6}\) and \(-\frac{4}{5}\) with positive denominators: \(-\frac{5}{6}<-\frac{4}{5}\) because \(\frac{5}{6}>\frac{4}{5}\) (cross: \(25>24\)). Taking negatives reverses order.
Extra practice set (post-checkpoint)
- Simplify \(\dfrac{\frac{2}{5}-\frac{1}{10}}{\frac{3}{4}}\) and reduce.
- Solve \(\frac{3x-1}{4}=\frac{x+5}{6}\).
- Prove closure of \(\mathbb{Q}\) under division by a nonzero rational.
- Between \(\frac{2}{5}\) and \(\frac{3}{7}\), produce two distinct rationals (midpoint and mediant both OK).
- A pipeline delivers \(\frac{2}{3}\) of capacity for \(3\) hours and \(\frac{1}{2}\) for \(2\) hours; total “capacity-hours” as a single fraction.
Tomorrow
Day 3 — Decimals, percent, scientific notation. Terminating vs repeating decimals, fraction\(\leftrightarrow\)decimal, percent change, compound percent, scientific notation operations, order of magnitude, significant figures.