I’ve recently been doing more maths than usual using Roman numerals, which has got me thinking about the relationship between how numbers are represented and how easy it is for them to do different jobs for us. I’ll go into a few representations below, and their good and bad points.
I won’t talk about floating point numbers (such as 4.6 x 107) as I’ve already talked about them. Similarly, I won’t talk about complex numbers – numbers that include the square root of –1. I’ve already talked about them elsewhere, particularly how two different ways of representing them fit with different tasks.
What I will talk about is:
- Roman numerals
These will be in contrast to base 10 integers using Arabic numerals (everyday numbers for most people).
Unary is probably the first way many people learn to count, by counting on their fingers as a child. You hold one finger up for one, two fingers up for two etc. Despite it being the simplest representation in this article, it has advantages over the alternatives.
It’s simple to use for small numbers when you don’t have a way of writing or typing anything down – you just hold up the correct number of fingers (or toes, if that works for you).
If you are counting up, for instance, recording the number of days you have been trapped in a prison cell by scratching into the walls, then the representation for the number on day X forms part of that for day X+1. If you were writing in base 10 you would need to scratch out e.g. 49 to change to 50. But in unary, 50 is the previous day’s 49 marks plus another.
If you are counting down, e.g. silently co-ordinating with someone else when you will stage an attack, then the representations naturally form a shrinking progress bar. You start with e.g. 3 fingers up, which narrows to 2, then to 1. In other representations, particularly using a variable width font, numbers don’t reliably look smaller as they get smaller.
If you are counting on your fingers using unary, most people have to stop at 10. Switching to binary (see below) means you can get up to 31 on one hand and 1,023 on two hands. The drawback is that some numbers give rise to rude finger gestures – 4 in many countries and 6 in places such as the UK (the Archer’s Salute or the Harvey Smith).
The big problem with unary is how long representations get for big numbers. You need a lot of space to record anything, it takes ages to count out e.g. 47 digits, and so it’s easy to make a mistake when you’re working with them.
Roman numerals, unlike unary, are a valid way of doing maths – as I described in my previous article on multiplication. Either directly using numbers e.g. writing on a slate, or via counters on a counting cloth or merchant’s cloth, you can add, subtract, multiply and divide.
There are two approaches to using Roman numerals – a more compact form and a longer form. In the more compact form you would write 4 as IV, but in the longer form you write 4 as IIII (or IIIJ). The compact form is shorter because if you write a smaller number to the left of a larger number, you subtract the smaller number from the bigger one. In the longer form, numbers are only ever added.
The compact form is useful if the numbers never change, for instance if you are labelling positions on a clock face, or writing marriage marks or carpenters marks on bits of timber that are fitting together into a building or bit of furniture.
The longer form is better if the numbers could change, e.g. if you’re multiplying them. The simplicity is worth it – you don’t need to worry if a digit is subtracted or added as they’re always added.
I think it’s interesting to compare Roman numerals to Arabic numerals in base 10 (normal numbers for most people) and to unary. Roman numerals (if you use the longer form) don’t care about position (“position hath no value”). X is always ten, V is always five and so on. In Arabic numerals 2 means two, unless there’s a 0 to its right in which case it becomes twenty. It can also mean two hundred, two thousand etc, depending on how many zeroes are next to it.
There is nonetheless a link between Roman numerals and base 10. The symbols available in Roman numerals are powers of 10 (the column headings for base 10 numbers), as well as half of each of those numbers:
|I = 1|
|X = 10||V = 5|
|C = 100||L = 50|
|M = 1000||D = 500|
As well as not needing a zero to fill out the representation of e.g. twenty, Roman numerals can’t explicitly represent nothing. They are a representation of the natural numbers (1, 2, 3 etc.). Natural numbers relate to things you can point at – I can point at V pigs, X trees, L bowls etc. I can’t point at 0 trees. Someone might say “Here are 0 trees” and point at e.g. the floor. The problem with that (ignoring the fact that they might be pointing at 1 floor or 7 floor tiles by accident) is that they are also pointing at 0 pigs, 0 clouds, 0 houses etc. at the same time – it’s so ambiguous as to be useless.
We’ve got so used to zero that we usually forget quite how weird it is. It often crops up in special places or doing special things – try dividing by zero, or raising a number to the power 0. Working with Roman numerals has reminded me of this.
The comparison with unary is interesting. Having done enough maths in Roman numerals, it struck me that Roman numerals are just unary in different clothes. The numeral I is obviously 1, but V is effectively just a box with five Is in, X is a box with two Vs in and so on. When you add Roman numerals, you often tidy up e.g. two Vs into an X, and when you subtract you might need to go the other way. This is similar to carrying or borrowing in Arabic base 10 numerals, but for me feels more direct in Roman numerals – it is an explicit exchange using a constant exchange rate.
This direct mapping to unary, constant meanings for all symbols, and lack of zero might make it easier for people to understand Roman numerals than base 10 Arabic numerals. This comes at the cost of a lack of zero and also longer representations for big numbers. Also, base 10 Arabic numerals are a good jumping off point for negative numbers, fractions, real numbers and complex numbers. It hurts my head slightly trying to think how I might do those with Roman numerals.
Binary, or base 2, was introduced in my previous article as it’s what’s going on behind the scenes in the method of multiplying using halving, doubling and adding. Please refer to that if binary is new to you – here I’ll concentrate on what binary gives you that other representations don’t.
Binary is one step up from unary (base 1) – you need two symbols rather than just one. This could be on/off, high/low voltage, dot/dash, finger up/finger down, 1/0, true/false etc.
One thing that you get with binary that you don’t get with other representations is Boolean logic. You can treat one or more of the binary digits (bits) that make up a number as true/false values and do Boolean operations on them. There are several operations available; these are three of the most common. They take two input bits and give one output bit.
|Input 1||Input 2||Output|
|Input 1||Input 2||OuTPUT|
|Input 1||Input 2||OUTPUT|
For instance, there might be an 8 bit number (which can hold values 0-255) and I want to make sure that it it’s in the range 0-15. This means I want only the right-most 4 bits, and I want to set the other bits to 0. I can do that by ANDing the number with 15. It’s a bit like when you’re painting, and want to constrain where the paint can go by using a stencil or some masking tape. For the paint to end up on the wall or paper at a particular place, there has to be a gap in the stencil at that place.
If you are ANDing numbers together, you can see from the table above that for the output to be 1 then both inputs must be 1. If I force one of the inputs to 0, I know the output will also be 0 regardless of what’s in the other input. My mask or stencil is one of the inputs, and it constrains how bits from the other input flow through to the output. The gap in the stencil corresponds to the 1s and the barrier bit of the stencil corresponds to the 0s.
Each column is taken separately. The top two rows are the two inputs – the unknown number and my mask. Where the mask is 0 (the grey part) this forces the output to be 0 (the green part). Where the mask is 1 (the black part), the output (the blue part) is a copy of the unknown number.
It’s a bit like multiplying by 0 or 1 – if you multiply something by 0 you always get 0, regardless of what the thing is, and if you multiply something by 1 it is unchanged. If you AND with 0 you always get 0 regardless, and if you AND with 1 the other thing is unchanged. (But it’s important to remember that AND is not the same thing as multiplying.)
It’s a bit of a pain to convert between base 10 and binary – there’s no obvious way to predict what you will get when you convert from one form to the other. However, it’s easy to convert between binary and other bases such as octal (base 8) or hexadecimal (base 16). That’s because the bases – 2, 8 and 16 – are all powers of two. To convert a binary number to hexadecimal, you take the binary number in chunks of 4 bits. 4 bits can store 0 to 15, which is one hexadecimal digit (0-F). Similarly, to convert hexadecimal to binary you just get 4 bits per hexadecimal digit. Hexadecimal is often used to encode colours in web pages, among many other things.
There are many different kinds of numbers (natural numbers, integers, real numbers, complex numbers etc.) and many different ways of representing them. It’s useful to have many different tools in your mental toolbox – both kinds of number and ways to represent them – so that you are more likely to have the right tool for the job.