# How do I represent the set of all finite bit strings?

At first I thought I could just represent them with the set of natural numbers, because each bit string represents some natural number. However doing this would mean the strings '010' and '00010' are the same, which they are not.

• What do you mean by represent? Do you mean, find some well-known or understandably constructed set that is bijective with the set of finite-length binary strings? – Isky Mathews May 5 '18 at 19:58
• If so, how does $2^\omega$ work for you? – Isky Mathews May 5 '18 at 19:58
• Perhaps an extension to a subset of $\Bbb Q$, something like $\frac n{(n+1)^k}$ for a number $n$ with $k$ leading zeroes? – abiessu May 5 '18 at 19:59
• A notation for it is $\{0,1\}^*,$ where the star means Klein star. Which is $$\bigcup _{i = 0}^{\infty}\{0,1\}^i,$$ and $\{0,1\}^i$ are i ordered tuples of elements from $\{0,1\}$ – Phicar May 5 '18 at 19:59
• @IskyMathews "$2^\omega$" denotes the set of infinite binary strings. – Noah Schweber May 5 '18 at 20:06

## 1 Answer

Here's one easy way to biject the finite binary strings to the natural numbers (let's say we're thinking of the natural numbers as not including zero):

• Step $1$: put a "$1$" on the left.

• Step $2$: view the resulting string as a number in binary as usual.

E.g. "$010$" turns into "$1010$," which is ten. The empty string meanwhile turns into the string $1$, which then turns into the number one.

If we want to get $0$ in the mix too, we can just add "Step $3$: subtract $1$" to the above.