Rational Numbers

TODO

Rational Numbers Introduction

TODO

Definition of Rational Numbers

TODO

Embedding integer numbers

TODO

Orderdness

\[\frac{n_1}{d_1} \leq \frac{n_2}{d_2} :\Leftrightarrow n_1\cdot d_2\leq n_2\cdot d_1\]

Operators of Rational Numbers

TODO

Rational Addition

\[+:\mathbb{Q}\times\mathbb{Q}\mapsto\mathbb{Q}\]

\[\begin{array}{rl} q_1 + q_2 :=& \frac{n_1}{d_1} + \frac{n_2}{d_2}\\ =& \frac{d_2n_1}{d_2d_1} + \frac{d_1n_2}{d_1d_2}\\ =& \frac{n_1d_2+d_1n_2}{d_1d_2}\\ \end{array}\]

Rational Negation

\[-:\mathbb{Q}\mapsto\mathbb{Q}\]

\[\begin{array}{rl} - q :=& -\frac{n}{d} \end{array}\]

Rational Subtraction

\[-:\mathbb{Q}\times\mathbb{Q}\mapsto\mathbb{Q}\]

\[\begin{array}{rl} q_1 - q_2 :=& \frac{n_1}{d_1} + (- \frac{n_2}{d_2})\\ =& \frac{d_2n_1}{d_2d_1} - \frac{d_1n_2}{d_1d_2}\\ =& \frac{n_1d_2-d_1n_2}{d_1d_2}\\ \end{array}\]

Rational Multiplication

\[\cdot:\mathbb{Q}\times\mathbb{Q}\mapsto\mathbb{Q}\]

\[\begin{array}{rl} q_1 \cdot q_2 :=& \frac{n_1}{d_1} \cdot \frac{n_2}{d_2}\\ =& \frac{n_1n_2}{d_1d_2} \end{array}\]

Rational Scalar Multiplication

\[\cdot:\mathbb{R}\times\mathbb{Q}\mapsto\mathbb{Q}\]

Rational Multiplicative Inverse

\[\begin{array}{rl} q^{-1} :=& \left(\frac{n}{d}\right)^{-1}\\ =& \frac{\frac{n}{|n|}\cdot d}{|n|}\;\;\; (\forall n\neq 0) \end{array}\]

Rational Division

\[/:\mathbb{Q}\times\mathbb{Q}\mapsto\mathbb{Q}\]

\[\begin{array}{rl} q_1 / q_2 :=& \frac{n_1}{d_1} \cdot \left(\frac{n_2}{d_2}\right)^{-1}\\ =& \frac{n_1}{d_1} \cdot \frac{d_2}{n_2}\\ =& \frac{n_1d_2}{d_1n_2} \end{array}\]

Rational Power

\[\hat{} :\mathbb{Q}\times\mathbb{Z}\mapsto\mathbb{Q}\]

\[\begin{array}{rl} q^a :=& \left(\frac{n}{d}\right)^a\\ =& \frac{n^a}{d^a} \end{array}\]

Rational Root

\[\hat{} :\mathbb{Q}\times\mathbb{Q}\mapsto\mathbb{Q}\]

For the general case, we can either work on prime factors of the numerator and denominator and cancel out the prime factors. Alternatively, we approximate the solution with Newton’s method:

\[\begin{array}{rrl} &x &= \left(\frac{a}{b}\right)^{c/d}\\ \Leftrightarrow &x^d &= \left(\frac{a}{b}\right)^c\\ \Leftrightarrow &x^d-\left(\frac{a}{b}\right)^c &= 0\\ \end{array}\]

So the function is \(f(x) = x^d-\left(\frac{a}{b}\right)^c\) and its derivative \(f'(x) = dx^{d-1}\). Now with newtons method, we can

\[ \begin{array}{rl} x_{n+1} &=x_{n}-{\frac {f(x_{n})}{f'(x_{n})}}\\ &=x_{n}-{\frac {x_n^d-\left(\frac{a}{b}\right)^c}{dx_n^{d-1}}}\\ \end{array} \]

Rational Modulo

\[\bmod :\mathbb{Q}\times\mathbb{Q}\mapsto\mathbb{Q}\]

\[\begin{array}{rrl} &q_1 =& aq_2 + b\\ \Leftrightarrow&\frac{n_1}{d_1} =& a\frac{n_2}{d_2} + b\\ \Leftrightarrow&n_1 d_2 =& a d_1 n_2 + bd_1d_2\\ \Leftrightarrow&{q_1}\bmod{q_2}:=&\frac{(n_1 d_2)\bmod(d_1 n_2)}{d_1d_2}\\ \end{array}\]

Greatest Common Divisor of Rational Numbers

\[gcd:\mathbb{Q}\times\mathbb{Q}\mapsto\mathbb{Q}\]

We can write a rational number \(q=\frac{a}{b}\) as a product of it’s numerator and denominaotors primes with positive and negative powers in a unque way:

\[\frac{a}{b} = p_1^{a_{p_1} - b_{p_1}}\cdot p_2^{a_{p_1}-b_{p_2}}\cdot\dots\]

Having two such numbers in the prime representation reveals that we want the smallest positive exponent of each prime for the numerator (that is the GCD of the numerators) as the rational GCD and the greatest negative exponent for the denominator (that is the LCM of the denominators). From this idea follows directly the definition of the GCD for rational numbers:

\[\begin{array}{rl} gcd(q_1, q_2) :=& gcd\left(\frac{n_1}{d_1}, \frac{n_2}{d_2}\right)\\ =& \frac{gcd(n_1, n_2)}{lcm(d_1, d_2)}\\ =& \frac{gcd(n_1, n_2)\cdot gcd(d_1, d_2)}{|d_1\cdot d_2|}\\ =& \frac{gcd(n_1, n_2)\cdot gcd(d_1, d_2)}{d_1\cdot d_2}\\ \end{array}\]

Least Common multiple of Rational Numbers

\[lcm:\mathbb{Q}\times\mathbb{Q}\mapsto\mathbb{Q}\]

\[\begin{array}{rl} lcm(q_1, q_2) :=& lcm\left(\frac{n_1}{d_1}, \frac{n_2}{d_2}\right)\\ =& \frac{lcm(n_1, n_2)}{gcd(d_1, d_2)}\\ =& \frac{|n_1\cdot n_2|}{gcd(n_1, n_2)\cdot gcd(d_1, d_2)}\\ \end{array}\]

Absolute value of a Rational Number

\[|\cdot|:\mathbb{Q}\times\mathbb{Q}\mapsto\mathbb{Q}\]

\[\begin{array}{rl} |q| :=& \left|\frac{n}{d}\right|\\ =& \frac{|n|}{d} \end{array}\]

Continues Fraction

« Back to Book Overview