# Rational Numbers

TODO

TODO

TODO

TODO

## Operators of Rational Numbers

TODO

$+:\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{1}{\frac{d}{n}}\\=& \frac{d}{n}\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 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}$

$\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