00:00:03
Hello. I’m Professor Von Schmohawk
and welcome to Why U.
00:00:08
In the previous lectures, we explored some
examples of the earliest number systems
00:00:14
which were used primarily for counting objects.
00:00:17
These counting numbers are called
“natural numbers”.
00:00:22
The natural numbers start at one
and can count to arbitrarily large quantities.
00:00:30
As we have seen, Roman numerals are one of
many possible ways to represent natural numbers.
00:00:37
The Roman system was eventually replaced with
the modern decimal number system
00:00:42
which uses “positional notation”
and only ten numeric symbols.
00:00:48
The decimal number system was found to be
superior to the ancient Roman system
00:00:53
because of the simple rules it uses
to create numbers.
00:00:58
In the decimal system there are ten numeric
symbols, 0 through 9, called “digits”.
00:01:07
Depending on the column they occupy
00:01:09
these digits represent the quantity of ones
00:01:12
tens
00:01:13
hundreds
00:01:14
thousands
00:01:15
and so on
00:01:16
which make up the number.
00:01:19
In positional notation,
the column occupied by a digit
00:01:23
determines the “multiplier” for that digit.
00:01:27
For example, in the decimal system
00:01:29
the value of the right-most digit
is multiplied by 1.
00:01:34
The digit in the next column to the left
is multiplied by 10.
00:01:39
The next digit is multiplied by 100
and so on.
00:01:44
The value of a number is the sum of
all its digits times their multipliers.
00:01:50
For example, the value of
the decimal number 1879
00:01:56
is 1 times 1000
00:01:58
plus 8 times 100
00:02:01
plus 7 times 10
00:02:03
plus 9 times 1.
00:02:07
In any positional notation, each column’s
multiplier differs from the adjacent column
00:02:12
by a constant multiple called
the “base” of the number system.
00:02:18
In the decimal system, each column multiplier
is ten times the previous column.
00:02:24
Therefore the decimal system is called a
“base-10” number system.
00:02:31
There are an infinite number of columns in
the decimal number system
00:02:34
with each column multiplier being ten times
bigger than the column to the right.
00:02:41
However, when writing a number,
the zeros in front are normally not written.
00:02:53
We can count up to 9
00:02:55
using only the ones column.
00:02:58
Once we reach 9
00:03:00
the ones column starts over at 0
00:03:02
and the tens column increments.
00:03:05
As we continue counting
00:03:07
the tens column counts the number of times
00:03:10
that the ones column
has passed from 9 to 0.
00:03:14
In other words, the tens column registers
the number of tens which we have counted.
00:03:20
This continues until we reach 99.
00:03:24
At that point
the ones and tens columns start over at 0
00:03:29
and the hundreds column increments.
00:03:34
The positional notation system is simple.
00:03:38
Every time a column passes from 9 to 0
00:03:42
the next column to the left increments.
00:03:47
How is it that we ended up with a number system
based on multiples of ten?
00:03:53
There is not any good reason
for choosing ten over some other number
00:03:57
other than the fact that people have ten fingers
00:04:01
and probably originally communicated quantities
using their fingers.
00:04:08
But what if we were cartoon characters
with four digits on each hand?
00:04:16
Is it possible that in cartoon land
00:04:18
everyone uses a number system
based on multiples of eight instead of ten?
00:04:25
How would a base-8 or “octal”
number system work?
00:04:30
In octal there are only eight numeric symbols
instead of ten as in decimal.
00:04:37
Instead of 0 through 9
the symbols 0 through 7 are used.
00:04:43
The symbols 8 and 9 are not needed.
00:04:46
Counting in octal is very similar
to counting in decimal.
00:04:51
Since there are no symbols for 8 or 9
00:04:54
the highest quantity which can be represented
in the ones column is 7.
00:05:00
Counting an eighth item
causes the ones column to start over at 0
00:05:05
and the next column to increment.
00:05:08
So the second column
counts the number of eights.
00:05:12
Therefore in octal
the number following 7 is 10
00:05:18
which looks just like the decimal number ten.
00:05:21
After octal "10" comes octal "11", "12", and so on
00:05:27
until we get to octal "17".
00:05:30
At that point, we go to octal "20".
00:05:33
The second column has now counted
two “eights” or sixteen.
00:05:39
We continue like this until we get to the
highest number we can represent with two digits
00:05:45
octal "77".
00:05:47
At that point, the ones and eights columns
start over at 0 and the third column increments.
00:05:55
The 1 in the third column represents
eight “eights” or sixty-four.
00:06:02
Each column multiplier is
eight times the previous one.
00:06:10
Every number which can be written in decimal
can also be written in octal
00:06:15
although after counting to 7
00:06:17
the way the quantities are represented
is completely different.
00:06:25
It is easy to convert an octal number to decimal
00:06:29
when you consider how positional notation works.
00:06:32
Let’s take for example, the octal number "1750".
00:06:38
As in decimal, the value of the octal number
is the sum of all its digits times their multipliers.
00:06:46
So the number "1750" represents
00:06:50
1 times 512
00:06:53
plus 7 times 64
00:06:55
plus 5 times 8
00:06:58
plus 0 ones
00:07:00
which adds up to the quantity
which in decimal is called one-thousand.
00:07:06
You may sometimes see a small subscript 8 or 10
after an octal or decimal number
00:07:13
in case there may be some confusion
about which base is being used.
00:07:20
Digital computers use electronic circuits
called “flip-flops” to represent numbers.
00:07:26
Each flip-flop can store a single bit
which can represent either a 0 or a 1.
00:07:35
Multiple bits can be combined to represent
a base-2 or “binary” number.
00:07:41
In the binary number system
0 and 1 are the only two numeric symbols.
00:07:47
Since binary is base-2
00:07:50
each column multiplier is two times
the multiplier of the previous digit.
00:07:55
And just like decimal or octal numbers
00:07:58
the value of a binary number is sum of
all its digits times their multipliers.
00:08:06
Since the digits are either 1 or 0
the calculation is simple.
00:08:11
We just add the multipliers
of all the columns which contain ones.
00:08:16
For example, the binary number 11010
00:08:21
represents 1 sixteen
00:08:24
plus 1 eight
00:08:25
plus 1 two
00:08:27
which is equal to twenty-six.
00:08:32
Even though digital computers
store numbers in binary
00:08:36
it can be quite tedious to write down
or remember large binary numbers.
00:08:42
For instance, the number one-million
in binary is
00:08:47
one one one one
00:08:49
zero one zero one
00:08:51
one zero zero one
00:08:54
one zero one one
00:08:56
zero zero zero zero.
00:08:59
Early in the history of digital computers
00:09:03
engineers found that it was easier
to use octal notation
00:09:07
than to deal with long strings
of ones and zeros.
00:09:11
Three binary digits can be represented
by a single octal symbol.
00:09:17
It is easy to memorize the eight possible
combinations of three binary bits.
00:09:25
To convert a multiple-digit octal number
to binary
00:09:29
each octal digit in the number
is converted to a 3-bit binary equivalent
00:09:35
and the binary digits are all combined
into a single binary number.
00:09:41
Any leading zeros can be removed.
00:09:45
To convert a binary number to octal
we do the same thing in reverse.
00:09:50
To convert this binary number back to octal
00:09:54
we split it into 3-bit groups
starting from the right
00:09:58
and each 3-bit group is then converted
to its equivalent octal symbol.
00:10:04
So the octal equivalent to this binary number
is "3654660"
00:10:13
a lot easier to remember
than all those ones and zeros.
00:10:19
Today, computer storage is normally organized
into 8-bit groups called "bytes".
00:10:26
Because of this, many computer engineers
prefer to use base-16
00:10:32
otherwise known as “hexadecimal” or “hex”
instead of octal.
00:10:36
With hexadecimal, every group of four bits
converts to a single hex symbol.
00:10:43
Two hex symbols represent exactly one byte.
00:10:47
Even fewer digits than octal are required
to represent a given number
00:10:52
and it's just as easy to convert
back and forth to binary.
00:10:56
Hexadecimal numbers
use sixteen numeric symbols.
00:11:00
The symbols 0 through 9
are used just as in decimal
00:11:04
but six more symbols are needed.
00:11:07
Instead of making up new symbols,
the letters A through F are used
00:11:12
to represent what we call
ten through fifteen in decimal.
00:11:18
Counting in hexadecimal
works the same way as in decimal or octal
00:11:22
except that hex uses sixteen symbols per digit.
00:11:27
Because each column multiplier is
sixteen times larger than the previous column
00:11:32
hexadecimal can represent large numbers
00:11:34
with fewer digits than octal or decimal.
00:11:40
When counting in hexadecimal
00:11:42
after getting to F which is decimal 15
00:11:46
we go to "10" which is decimal 16
00:11:49
then "11", "12", and so on.
00:11:54
Once we reach 1F
00:11:56
we go to "20" which is decimal 32.
00:12:01
When we get to the largest number which we
can represent with two hex digits, FF
00:12:07
we go to "100" which is decimal 256
00:12:13
and so on.
00:12:18
As we mentioned
00:12:19
using hex notation, four binary bits
can be represented by a single hex symbol.
00:12:28
Each of the sixteen possible combinations
of four bits
00:12:32
is equivalent to a single hex digit.
00:12:39
Let's convert the same binary number as before
to hex.
00:12:43
Starting from the right,
we group the digits into groups of four.
00:12:49
Each group of binary digits is then converted
to its equivalent hex symbol.
00:12:58
So we have seen how the same natural number
00:13:01
can be represented in base-2
using two numeric symbols
00:13:06
base-8 using eight symbols
00:13:09
base-10 using ten symbols
00:13:13
and base-16 using sixteen symbols.
00:13:17
But no matter how we choose to write
this natural number
00:13:21
it still represents the same quantity.
00:13:28
As you have seen
00:13:29
we use the same basic rules for counting in binary
00:13:33
octal
00:13:34
decimal
00:13:35
and hexadecimal.
00:13:37
The only difference is that each base has
a different number of numeric symbols.
00:13:45
So using positional notation
00:13:47
we can create a number system
using any natural base we like.
00:13:52
Try creating one of your own.
00:13:55
Who knows, it might catch on!