-[Craig] In this video, we're going to explore the concept of bit patterns
and the fact that a single bit pattern could actually be representing many different things.
(uplifting piano jingle)
So we live in an analog world.
All of our perceptions from sound to touch and sight
can be measured on a continuous, sinuating line.
Take this simple example of turning a light on and off again.
To us, it might appear that the light immediately changes from one state to another.
If we could slow time down, however,
we would notice a gradual increase of light
followed by a gradual decrease, which can be represented by the curved line.
Digital systems such as computing devices don't operate like this.
In our digital representation,
this light exists in one of two binary states, either on or off,
and it switches instantly between them as shown here.
So let's remind ourselves what binary is.
A binary digit or bit is a zero or a one.
Having just two states makes it simple to build electronic devices that use these two states.
Before we look at these binary values and how they can be used in different devices,
let's consider the maximum number of states which can be represented in any given bit pattern.
So as binary only has two digits available, one or zero,
it means that with a single bit, we can represent a maximum of two states.
If we increase this to two bits, we now can represent a maximum of four states as shown here.
When using three bits, we can represent a maximum of eight different states.
You can see that each time we add a bit,
we're effectively doubling the maximum number of possible states.
In mathematical terms, we can say there were two to the power of n possible states with n bits.
For example in RAM, data can be represented with capacitors.
They either hold a charge, one,
or they don't hold a charge, zero.
Having further states would make the components more difficult to build and potentially more prone to error.
Data on hard disks can be stored using magnetism with north and south polarity representing one or zero.
Data on optical discs can be stored such that
light from a laser can either be reflected from the surface or not, zero or one.
And data on memory sticks can be stored by trapped electrons or free electrons,
zero or one.
So have you ever asked yourself the question,
what exactly is zero, one, one, zero, zero, one, one, zero,
or indeed any sequence of binary digits?
When you first look at it, you probably think well,
that has to represent something, that's probably a number.
But as you've learned from the previous part this video,
everything in a computing system has to be stored as a series of zeros and ones;
for example, high and low voltages.
This pattern of bits could actually represent many different things.
It all depends how we interpret it.
So for example, if we shoved those pattern of bits,
zero, one, one, zero, zero, one, one, zero,
through the ASCII character set,
what would pop out would be the lowercase letter F.
The exact same pattern of bits interpreted as a signed binary integer in two's complement
would result in the number 102.
And indeed, this same bit pattern can be interpreted in many different ways
and could represent many different things.
If this was a black and white image which was using one bit to store each pixel,
then this sequence of bits would represent eight black or white pixels.
If this was a 24-bit colour image,
then this bit pattern could represent the value for the red, blue or green element of a single pixel.
And if this was passed through a digital-to-analog converter,
then this pattern of bits would represent part of an analog waveform that was coming out of a speaker.
The point here is that there was no way of knowing what a particular pattern of bits actually represents
until you know how to interpret that data.
(uplifting piano jingle)