s5cs05 the binary number system
It's all about the base, 'bout the base, no treble.

Computers don't count in denary like we do. They are made a switches and don't have any fingers. They count in Base 2 or Binary. Part of being a computer scientists is being able to count in different number bases than the one that we normally count in.
We are learning ...
About different number bases
So that we can ...
Describe the format of number systems
- The concept of a number base
- Writing numbers to include their base, nB
Describe and use the denary number system
Describe and use the binary number system
Discuss the concept of binary coding
Represent unsigned denary numbers in binary format and vice versa
Describe and use the hexadecimal number system
Perform base conversions.


Activity 1
The format of number systems
We use our fingers to count like a scale with 10 different levels (technically 11 if we start at zero but early civilisations didn't have a concept of zero).

This is why we use the Base 10 or Denary number system. However, if we use all 10 of our fingers, we are actually representing 1 lot of 10 and 0 units, so we don't really need to use our last finger ...

The Base 10 number system consists of 10 different values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. This is the same for any number system - the base tells you how many symbols are available to represent things. This is OK up to Base 10 but what single character do we use to represent 10, 11, 12 etc?
Base 12 - Numberphile
Numberphile tells us about a very strange (or is it strange?) number base called 'Dozenal'.

Task 1.1 Counting

Pay particular attention to the place values. Starting with Denary, this obvious (but only because we work in denary). In other number bases, the values of the places are different.
Write some notes in your books about numbers bases.
OUTCOME : Notes about number bases.


When we write numbers, we should always include the base they are in. For instance, the number 1101 is ambiguous - I could assume that it's written in denary (since this is the base we normally work in), but this may not be the case...
10102
10108
101010
101016
... all represent different number of 'things' (10, 520, 1010 and 4112 things respectively).

Counting on your fingers
Normally, when we count, we use each finger to represent just one 'thing'. This can be severely limiting when it comes to counting a large number of things because we quickly run out of fingers! How would it be different if we could use one finger to represent each available symbol in our base? That means we could use one finger to represent each place (and it's associated value) in the number rather than just one value.
Count to a trillion on your fingers! | Head Squeeze
In this first of two videos - Part 2 here - looking at 'How big is a trillion?', mathematical genius Matt Parker shows how to count to one trillion using our hands.
Consider, then two situations...

...which goes some way to explaining why computers count in binary.

Activity 2
Why binary?
So, why do computers use Binary? (Hint : because they are made of switches)


Task 2.1 Why binary?
OUTCOME : Written explanation of what you have found out from 'Why Binary?' activity



Activity 3
Binary <> Denary Conversions
Now that we understand the concept of place value, conversions are easy and best explained by example ...
Binary to Denary

Your teacher may well demonstrate this as well.

Task 3.1 Binary to Denary conversions
1
000011012
2
000101112
3
000110102
4
010111002
5
101101012
OUTCOME : Binary to denary conversions with workings


Denary to Binary

Your teacher may well demonstrate this as well

Task 3.2 Denary to Binary conversions
1
2910
2
3710
3
9610
4
7210
5
1210
OUTCOME : Denary to binary conversions with workings.



Activity 4
Hexadecimal
Hexadecimal simply provides a convenient way of representing long binary strings.
15 and Hexadecimal - Numberphile
Why is "f" a number to people who work with computers?
One hexadecimal digit is used to represent 4 bits, or a nybbleI have no idea what this means, in our binary string. For reference ...

Click to engage
Binary to hexadecimal conversion

Your teacher may well demonstrate this to you as well

Task 4.1 Binary to hexadecimal conversion
1
100001102
2
100100112
3
1000010001002
4
0100010010002
5
101001102
OUTCOME : Binary to hexadecimal conversions with workings.


Hexadecimal to binary conversion

Your teacher may well demonstrate this to you as well

Task 4.2 Hexadecimal to binary conversion
1
8316
2
A916
3
57216
4
60416
5
ABC16
OUTCOME : Hexadecimal to binary conversions with working.


Extension Activities
How about these?
1
Binary to denary conversion program
Write a program to input a binary number as a text string, convert it to denary and output the result. You may use the following algorithm:
Output "Enter a binary number "
Input BinaryString
BinaryLength ← Length of BinaryString
Multiplier ← 1
DenaryValue ← 0
For n ← BinaryLength Down To 1
Digit ← nth character in BinaryString
DenaryValue ← DenaryValue + Digit * Multiplier
Multiplier ← Multiplier * 2
Next n
Output "The denary equivalent is ", DenaryValue
Note: Line seven requires a function that returns the nth character from a string. It may also need a function to convert this character to an integer.
Could you adapt this so that it can handle different number bases?
2
Denary to binary conversion program
Write a program to input a denary number, convert it to binary and output the result. You may use the following algorithm which employs integer division:
Output "Enter a denary number "
Input DenaryValue
BinaryString ← ""
While DenaryValue > 0
BinaryString ← CStr(DenaryValue MOD 2) + BinaryString
DenaryValue ← DenaryValue DIV 2
Endwhile
Output "The binary equivalent is ", BinaryString
Note: The function
CStr
converts a number to a string. The sign ‘+’ here represents concatenation.3
Poster competition
Create a poster about binary : research and include simple binary rules, jokes, binary watches / clocks, comics …
4
The Octal number system
One other commonly used number system is Octal, or Base 8, since octal can be used to represent 3 bits where hexadecimal is used to represent 4. Read more about Octal on it's Wikipedia page. One particularly interesting fact is that the Yuki people from America count in Octal because they count using the gaps between the fingers rather than the fingers themselves.

What's next?
Before you hand your book in for checking, make sure you have completed all the work required and that your book is tidy and organised. Your book will be checked to make sure it is complete and you will be given a spicy grade for effort.

Before you hand your book in for checking, make sure you have completed all the work required and that your book is tidy and organised. Your book will be checked to make sure it is complete and you will be given a spicy grade for effort.
Last modified: February 14th, 2024