My partner is a software engineer — binary system

spareproj
4 min readMay 9, 2024

--

This is a series of educational pieces on computer science-related topics that he insists I — someone without a computer science background — know.

The other day we were eating sushi and he asked me,

‘how many numbers do we work with in this world?’

‘umm… infinite?’ i said, with sushi in my mouth.

‘no.’ he scratches his head. ‘how many alphabets do you know?’ he tried again.

‘26’

‘ok, so how many numbers do you know?’

‘ok…10?’

I learned that this is called the base-10 number system, or decimal system. This decimal system uses only 10 numbers — 0,1,2,3,4,5,6,7,8,9– to create and represent different permutation of numbers.

This was interesting. Growing up, I was taught that these these 10 numbers give us the way to represent all the numbers in the world. I just never thought that there are other ways, other kinds of number systems.

Computers use base-2 number system

Now that i see our number system is just one of the many, it makes sense to look at other base numerical systems.

Like base-2. Computers use base-2 number system.

This means that unlike us, they only work with 2 digits — 0,1. This is also called binary. Like black and white. Right and wrong.

Everything a machine does — from receiving input, to storing data, to running complex programmes — is built on this simple foundation of 0s and 1s.

How can a computer achieve so much complexity using just these 2 numbers?

‘how would you use 0,1 to count from 0 to 10?’ he asked. ‘look at the pattern of the base-10 number system we are familiar with’.

What’s after 9? When you maxed out single digit combinations, you start at 10.

What’s after 99? When you maxed out 2-digits combinations, you start at 100.

What’s after 100? After starting new digit, you add a 1 at the end. 101.

Did you see a pattern?

Binary counting

If you only have 0 and 1, you can only play with the total count of digits.

Notice how each time you run out of combinations in a given number of digits, you restart at zero with the next count of digits.

0 → this is 0

1 → this is 1, maxed out number of digits. We can no longer use any other numbers here.

10 → so the next one, we restart with zeros. This is 2.

11 → once again, we maxed out the number of digits. This is 3.

100 → so the next one, we restart with zeros. This is 4.

101 → 5

110 → 6

111 → 7. We maxed out the number of digits.

1000 → so the next one, we restart with 0. This is 8.

1001 → 9

1010 → 10

In summary, counting 0 to 10 using the base-2 system would look like this:

0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010.

As you can see, this can continue forever.

1011 → 11

1100 → 12

1101 → 13

1110 → 14

1111 → 15. We maxed out the number of digits

10000 → so the next one, we restart with 0. This is 16.

I have a little niece who is learning math right now, and I suddenly can see myself in her position, learning how to count from 0 to 10, all over again.

This applies to all 26 alphabets too. So that computers can read languages and convert them to binaries.

Since every media, file, information can be converted to 0s and 1s, you can imagine how much computers can do with these 2 numbers.

Why do computers use binaries?

computer transistors

At the very core, computers are made of hardware. They rely on transistors that act as switches.

Switches only exist in 2 states: switch on, switch off.

Similarly, base-2 number system only uses 2 numbers: 1,0.

This base-2 number system matches perfectly with the need to work within only 2 states: 1 (switch on), and 0 (switch off).

Since computers process numbers much faster than us, they have no trouble reading and understanding 1000000000001110000001000000 quickly. Unlike us, their eyes wouldn’t glaze over with the increasing number of digits.

However, if computers were to use our decimal system, they will need to have 10 different states, humans will need to create transistors circuits to represent 10 different states, which is a lot harder.

Each of us (computers vs uhmans) have our own limitations.

Ah, this all makes easy sense. It almost seemed as if we had created the base-2 number system to fit with the computer transistors hardware requirements, although that is not the case.

Now I know the really fundamental basics of how computers work — binary system. But I’m barely scratching the surface here, as he likes to remind me after each lesson.

--

--