# Definition:Basis Expansion

## Definition

### Positive Real Numbers

Let $x \in \R$ be a real number such that $x \ge 0$.

Let $b \in \N: b \ge 2$.

Let us define the recursive sequence:

$\forall n \in \N: n \ge 1: \left \langle {f_n}\right \rangle = \begin{cases} b \left({x - \left \lfloor {x} \right \rfloor}\right) & : n = 1 \\ b \left({f_{n-1} - \left \lfloor {f_{n-1}} \right \rfloor}\right) & : n > 1 \end{cases}$

Then we define:

$\forall n \in \N: n \ge 1: \left \langle {d_n}\right \rangle = \left \lfloor {f_n} \right \rfloor$

It follows from the method of construction and the definition of the floor function that:

$\forall n: 0 \le f_n < b$ and hence $\forall n: 0 \le d_n \le b - 1$
$\forall n: f_n = 0 \implies f_{n + 1} = 0$ and hence $d_{n + 1} = 0$.

Hence we can express $x = \left \lfloor {x} \right \rfloor + \displaystyle \sum_{j \mathop \ge 1} \frac {d_j} {b^j}$ as:

$\left[{s \cdotp d_1 d_2 d_3 \ldots}\right]_b$

where:

$s = \left \lfloor {x} \right \rfloor$
it is not the case that there exists $m \in \N$ such that $d_M = b - 1$ for all $M \ge m$.

(That is, the sequence of digits does not end with an infinite sequence of $b - 1$.)

This is called the expansion of $x$ in base $b$.

The generic term for such an expansion is a basis expansion.

It follows from the Division Theorem that for a given $b$ and $x$ this expansion is unique.

If it is the case, for a given $x$ and $b$, that $\exists m \in \N: d_m = 0$ then the expansion is said to terminate.

Note that it is far from guaranteed that the sequence $\left \langle {d_n}\right \rangle$ will actually terminate.

### Negative Real Numbers

Let $x \in \R: x < 0$.

We take the absolute value $y$ of $x$, i.e. $y = \left|{x}\right|$.

Then we take the expansion of $y$ in base $b$:

$\left[{s . d_1 d_2 d_3 \ldots}\right]_b$

where $s = \left \lfloor {y} \right \rfloor$.

Finally, the expansion of $x$ in base $b$ is defined as:

$-\left[{s . d_1 d_2 d_3 \ldots}\right]_b$