Project // Digital Odyssey - Part 1: Bits and p-adic Number Systems
Project // Digital Odyssey
From 'Bits' to 'Hello World'... and Beyond.
Charpter I - Hardware and Theory
Part 1: Bits and p-adic Number Systems
This is the first post in a multi-part series. Check out the Table of contents for a project introduction. We will begin our adventure into the digital world by having a look at the smallest unit of information a computer can handle.
You most probably have already heard the term 'Bit' as it is quiet literally a very crucial part of your day to day experience with your computer. Your ISP (Internet Service Provider) is selling you Megabits per second, software asks you whether you want it to be flavoured 32 Bit or 64 Bit and so on. But what exactly is a Bit and how does it enable your computer to present this blog post or render your favourite farm game? Even though this might seem obvious (at least for some of you) it is still quiet instructive to begin our journey at the very basics and build things up from there.
First of all a formal definition: Bit is short for Binary Digit. This is a way of saying that a Bit is a numerical symbol (digit) similar to the symbols we use for counting ('0', '1', '2', ... '9'). However, it only has two possible values (unlike the digits with ten values we are used to). The two values of a Bit can for example be interpreted as states of a switch ('on'/'off') or the result of a logical statement ('true'/'false'), so this does not necessarily need to be too abstract. More importantly though, they can be used as digits in the binary number system. "What on earth is a binary number system?" you might ask now.
A little detour into the world of numbers: We are so used to expressing numbers in our perfectly cozy 'decimal number system', that we might not realize two important things: 1) Writing down a number is just a way of giving a symbol to an abstract thing. As the average human usually calls ten fingers his own, it comes as no surprise that finally we settled on using ten distinct symbols for counting. 2) However, there are literally infinitely more ways of writing down the same thing. Numbers are abstract constructs that arise from the fact that we feel the urge to structure, measure and count our environment. Ten apples on a tree are perfectly fine existing as apples without the need for the concept of there being 'ten' of them. However, when we look at the tree our brain tries to order things for us and comes up with the notion of 'ten' apples. This might be a little hand-wavy but to be honest this topic is borderline philosophic. A number being an abstract object might become even more obvious when we have a look at less natural numbers like π which cannot even be expressed using a finite amount of digits, or imaginary numbers like the imaginary unit i which arguably is not even a part of the 'measuring tape' we use to perceive our immediate surroundings (unless you are a quantum object or a high frequency electromagnetic signal). As soon as you realize that a number is just a concept, not a real thing, it almost falls naturally that we can use any way we like to express this concept, similarly to how multiple languages might have different vocabularies for the same thing.
Before using our decimal system other systems were established. The Romans had their own intriguing way of writing down numbers ('I', 'II', 'III', 'IV', ...) by adding and subtracting numerals depending on their ordering (see also fig. 2). Check out this overview if you want to learn more [1]. Today roman numerals are sometimes used for indexing when it is desirable to have something distinguishable from Arabian numerals (the ones we are using). Our modern way of counting is part of the so-called p-adic systems. Do not worry about this terminology too much as I just mentioned it for completeness sake. If you are interested in reading more about p-adic systems, have a look at this document [2]. The important part is p which denotes the base of the system, i.e. the number of distinct digits used for counting (10 in our case): When we say '9503', what we really mean is the number that can be expressed through:
'0', '3', '5' and '9' are the first, forth, sixth and tenth symbol of the ten distinguishable, ordered values that our base-10 digits can hold. '1', '10', '100', '1000' are ascending powers of the system's base, where 1 = 10⁰, 10 = 10¹, 100 = 10² = 10 · 10 and 1000 = 10³ = 10 · 10 · 10. In other words: To decode our way of writing down numbers you have to multiply the value of each digit with the power of 10 corresponding to its position in the number (remember that we start counting at zero!). Finally you add everything up. See figure 3 for a graphical representation. The fact that we scribble down our powers of ten in a descending order is an artifact of the Arabian (where it is normal to read from right to left) origins of our numeric system.
Fig. 3: Graphical visualization of the decoding process of the decimal numeral '9503'.
If you managed to stay awake up until this point: Now comes the important part! The described way of de-/encoding number using the 10-adic system can be applied to any natural base greater than 1 (2, 3, 4, ...). The Sumerians had a system to the base of 60! They had to count 60 different symbols before they moved to the next digit. This is the reason why we still divide our hours and minutes into 60 subunits and our circles have 6 · 60 = 360 degrees. In this sense '8:10:03' means 8 · 60² + 10 · 60¹ + 3 · 60⁰ = 29,403 seconds after midnight. Let's see how people react to this kind of formatting when they ask you for the current time. A less drastic application, finally, is the highly anticipated binary or 2-adic system. All you need is two symbols (let's call them '0' and '1') and plenty of powers of the base 2. For an example, we will look at the number '100101' in the binary system. It represents the value
in our decimal system (see fig. 4). After some practice this will start to feel a lot more comfortable as well. By the way, this is not as far fetched from nature as you might think. Our genome uses a Quaternary system (4-adic) to encode our entire organism by combining four nucleotides (Adenosine, Guanine, Thymine and Cytosine) into strings... more or less gigantic numbers identifying each individual.
Fig. 4: Graphical visualization of the decoding process of the binary numeral '100101'.
Why is all of this important? Let us recapitulate: We established a way of breaking down our sense of structuring our environment into a representation using chains of two valued digits. Remember when I said, that these could be interpreted as states of an electric switch? This is where is all comes together. By switching on and off electric signals we can utilize the binary system to encode numbers. If we now find a way to manipulate these signal states in an appropriate manner, we can cast our basic algebra (Addition, Subtraction, Multiplication, ...) into electric circuits. And voila, you can make circulating electrons do your math homework for you.
A detailed rundown of how this is accomplished and how to use this knowledge will be featured in the next part. Stay tuned.
[1] Roman numerals (web)
[2] Introduction to p-adic numbers (web)