Skip to content

Commit fed03d5

Browse files
committed
address review: remove left/right
1 parent 2d375ad commit fed03d5

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

‎InternalDocs/fractions.md‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ Consider fractions $a/b$ and $c/d$.
376376

377377
Let $g = \gcd(b, d)$. Then\
378378
$$\frac{a}{b} \pm \frac{c}{d} = \frac{a d \pm b c}{b d}
379-
=\frac{a \left(d/g\right) \pm c \left(b/g\right)}{\left(b d\right)/g}
379+
=\frac{a (d/g) \pm c (b/g)}{(b d)/g}
380380
=\frac{p}{q}$$
381381

382382
Now, if $g > 1$, we're working with smaller integers. Also,
@@ -386,24 +386,24 @@ Indeed, $b/g$ and $d/g$ share no common factors (they were
386386
removed) and $b$ is coprime with $a$ (since input fractions are
387387
in lowest terms), hence $b/g$ and $a$ are coprime. By symmetry,
388388
$d/g$ and $c$ are coprime too. Then\
389-
$$\gcd\left(p, b/g\right)
390-
=\gcd\left(a \left(d/g\right) \pm c \left(b/g\right), b/g\right)
391-
=\gcd\left(a \left(d/g\right), b/g\right) = 1$$
389+
$$\gcd(p, b/g)
390+
=\gcd(a (d/g) \pm c (b/g), b/g)
391+
=\gcd(a (d/g), b/g) = 1$$
392392

393393
and similarly\
394-
$$\gcd\left(p, d/g\right) = \gcd\left(c\left(b/g\right), d/g\right) = 1$$
394+
$$\gcd(p, d/g) = \gcd(c(b/g), d/g) = 1$$
395395

396396
The above allows us to optimize reduction of the result to lowest
397397
terms. Indeed,\
398-
$$h = \gcd\left(p, q\right)
399-
=\gcd\left(p, \left(b/g\right)\left(d/g\right) g\right)
400-
=\gcd\left(p, g\right)$$
398+
$$h = \gcd(p, q)
399+
=\gcd(p, (b/g)(d/g) g)
400+
=\gcd(p, g)$$
401401

402402
and\
403403
$$\frac{a}{b}\pm\frac{c}{d}
404-
=\frac{p/h}{\left(b/g\right)\left(d/g\right)\left(g/h\right)}
405-
=\frac{\left(a \left(d/g\right) \pm c \left(b/g\right) \right)/h}
406-
{\left(b/g\right)\left(d/h\right)}$$
404+
=\frac{p/h}{(b/g)(d/g)(g/h)}
405+
=\frac{(a (d/g) \pm c (b/g) )/h}
406+
{(b/g)(d/h)}$$
407407

408408
is a normalized fraction. This is useful because the unnormalized
409409
denominator $q$ could be much larger than $g$.
@@ -415,10 +415,10 @@ $g$ is a power of 2 and the unnormalized numerator $p$ is an odd integer.
415415

416416
## Multiplication
417417

418-
Let $g = \gcd(a, d)$ and $h = \gcd\left(b, c\right)$, then\
418+
Let $g = \gcd(a, d)$ and $h = \gcd(b, c)$, then\
419419
$$\frac{a}{b}\times\frac{c}{d}
420-
=\frac{\left(a/g\right)\left(c/h\right)}
421-
{\left(d/g\right)\left(b/h\right)}$$
420+
=\frac{(a/g)(c/h)}
421+
{(d/g)(b/h)}$$
422422

423423
Note that after divisions we're multiplying smaller integers.
424424

@@ -428,7 +428,7 @@ in the denominator.
428428

429429
Indeed, pick $a/g$. It's coprime with $b/h$, because input
430430
fractions are in lowest terms. It's also coprime with $d/g$,
431-
because common factors are removed by $g = \gcd\left(a, d\right)$.
431+
because common factors are removed by $g = \gcd(a, d)$.
432432
By symmetry, $c/h$ is also coprime with both factors in the denominator.
433433

434434
As for addition/subtraction, we should special-case $g = 1$

0 commit comments

Comments
 (0)