Number Systems

Today, we are going to learn about number systems. A “number system” is defined here as “any notation for the representation of numerals or numbers.” We naturally use the decimal (base 10) system, meaning we use the numbers 0-9 to represent all the other numbers. The three types of number systems that we are going to talk about today are decimal, binary, and hexadecimal, but there are many more!

Decimal sudoku. From Wikipedia.

Sudoku provides a great visual of how different number systems can be!



Decimal is the base 10 number system. This is the first number system we are gonna learn about, as we’ve been using it our whole life, and is fairly easy to show mathematically.

We will use the number 1,234.

 

In the single digits, we can say it is 4×10^0. Any number to the 0th power is equal to one, so we have 4×1 (or 4).

 

In the tenth place, we have 3×10^1. Using exponent rules, this works out to 3×10 (or 30).

 

For the hundredths and thousandths places there is 1×10^3 and 2×10^2. These values are 1×1000 and 2×100.

 

When we combine all the values, we get 1000+200+30+4, which is equal to 1,234.

Binary Sudoku
Binary sudoku.

Binary is slightly more complicated. Binary is base two, and only uses 1 and 0 as its numbers.

 

Let’s check out the binary number 1001. Just like any other number system, we can simplify each number to a summation of bases and exponents. 1001 will simplify into 1×2^3 + 0x2^2 + 0x2^1 + 1×2^0. If we simplify this problem we have 8 + 0 + 0 + 1 = 9.

Hexadecimal sudoku. From brainden.com.


Hexadecimal Table
Hexadecimal table.

Hexadecimal is the most complicated of the three number systems we are going to learn about. Hexadecimal stands for base-16 values, going from 0-F (with F being 15).

 

We are going to use the number E41D as our example for hexadecimal.

 

As with other number systems, we can break it down into less complicated pieces, which gets us
Ex16^3 + 4*16^2 + 1*16^1 + D*16^0. We can use our hexadecimal table to convert all the letters to decimal numbers.

 

That gets us 14×16^3 + 4*16^2 + 1*16^1 + 13*16^0, and this is just a mathematical equation we can solve! Expanded, that is 14*16*16*16 + 4*16*16 + 1*16 + 13*1 = 58397.


So far we’ve only been converting to and from decimal. But what if we wanted to convert between hex and binary. If you understand what we’ve been doing so far, this will be much simpler than hex-decimal conversion!

 

It is important to know that the binary string 1111 is equal to 15, which is great, as we can use every 4 bits as one number in hex. We use some decimal conversions here, but it is only between 0 and 15, which isn’t too bad.

 

If we take the binary number 1111111001. If we divide this into string of four, we get 11 1111 1001. We can add two 0s on the front to get 0011 1111 1001, this doesn’t change the number value, but it makes it easier to read.

Conversion
Conversion.


The graphic shows us converting every 4 bits into a decimal number, then converting those decimal numbers into hex. We get 3F9 as our hex number. We can check the two values in decimal, and they should be the same!


We use different number systems because computers “think” differently than humans do! Computers use binary to compute everything, but most humans use the decimal system (theoretically because we have two hands with five digits each). Hexadecimal is a good balance between the two, making it much easier to convert by computers and humans!

Author

Be the 1st to vote.

About Josh

I love Coding!

View all posts by Josh →

One Comment on “Number Systems”

  1. Hello Sir,
    You have explained the number system in detail which was really helpful for me but I have a confusion in a question that :
    Any signed negative binary number is recognized by its MSB or LSB?

Leave a Reply

Your email address will not be published. Required fields are marked *