Binary, hexadecimal, and octal refer to different number systems. The one that we typically use is called decimal. These number systems refer to the number of symbols used to represent numbers. In the decimal system, we use ten different symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. With these ten symbols, we can represent any quantity. For example, if we see a 2, then we know that there is two of something. For example, this sentence has 2 periods on the end..
When we consider a binary system which only uses two symbols, 0 and 1, when we run out of symbols, we need to go to the next digit placement. So, we would count in binary 0, 1, 10, 11, 100, 101, and so on.
How a Number System Works
Number systems are used to describe the quantity of something or represent certain information. Because of this, We can say that the word “calculator” contains ten letters. Our number system, the decimal system, uses ten symbols. Therefore, decimal is said to be Base Ten. By describing systems with bases, we can gain an understanding of how that particular system works.
When we count in Base Ten, we count starting with zero and going up to nine in order.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, …
Once we reach the last symbol, we create a new placement in front of the first and count that up.
8, 9, 10, 11, 12, … , 19, 20, …
This continues when we run out of symbols for that placement. So, after 99, we go to 100.
Binary is another way of saying Base Two. So, in a binary number system, there are only two symbols used to represent numbers: 0 and 1. When we count up from zero in binary, we run out of symbols much more frequently.
0, 1, …
From here, there are no more symbols. We do not go to 2 because in binary, a 2 doesn’t exist. Instead, we use 10. In a binary system, 10 is equal to 2 in decimal.
We can count further.
Just like in decimal, we know that the more digits there are, the larger the number. However, in binary, we use powers of two. In the binary number 1001101, we can create a chart to find out what this really means.
The binary system is useful in computer science and electrical engineering. Transistors operate from the binary system, and transistors are found in practically all electronic devices. A 0 means no current, and a 1 means to allow current. With various transistors turning on and off, signals and electricity is sent to do various things such as making a call or putting these letters on the screen.
Octal is another number system with less symbols to use than our conventional number system. Octal is fancy for Base Eight meaning eight symbols are used to represent all the quantities. They are 0, 1, 2, 3, 4, 5, 6, and 7. When we count up one from the 7, we need a new placement to represent what we call 8 since an 8 doesn’t exist in Octal. So, after 7 is 10.
Just like how we used powers of ten in decimal and powers of two in binary, to determine the value of a number we will use powers of 8 since this is Base Eight. Consider the number 3623 in base eight.
The hexadecimal system is Base Sixteen. As its base implies, this number system uses sixteen symbols to represent numbers. Unlike binary and octal, hexadecimal has six additional symbols that it uses beyond the conventional ones found in decimal. But what comes after 9? 10 is not a single digit but two… Fortunately, the convention is that once additional symbols are needed beyond the normal ten, letters are to be used. So, in hexadecimal, the total list of symbols to use is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F.
Digits are explained as powers of 16. Consider the hexadecimal number 2DB7.
Conversion from One form to other
From decimal to binary
- Step 1: Check if your number is odd or even.
- Step 2: If it’s even, write 0 (proceeding backwards, adding binary digits to the left of the result).
- Step 3: Otherwise, if it’s odd, write 1 (in the same way).
- Step 4: Divide your number by 2 (dropping any fraction) and go back to step 1. Repeat until your original number is 0.
Convert 17 to binary:
- 17 is odd, so we write 1 (result so far – 1)
- Dividing 17 by 2, we get 8.5, or just 8.
- 8 is even, so we write 0 (result so far – 01 – remember to add it on the left)
- Dividing 8 by 2, we get 4.
- 4 is even, so we write 0 (result so far – 001)
- Dividing 4 by 2, we get 2.
- 2 is even, so we write 0 (result so far – 0001)
- Dividing 2 by 2, we get 1.
- 1 is odd, so we write 1 (result so far – 10001)
- Dividing by 2, we get 0.5 or just 0, so we’re done.
- Final result: 10001
Converting Decimal Fractions to Binary
There are two part of these types of numbers.
- Integral Part
- Fractional Part
The integral part is converted with the basic technique of Decimal to Binary conversion. The fractional part can be converted by multiplication.
First of all Convert the Integral part and for fractional parts follows these steps
Let us take an example by converting 4.625 to Binary
Step 1: Begin with integral part 4 and convert this into Binary
4(Decimal) = 100 (Binary)
Step 2: Take the decimal fraction and multiply by 2. The whole number part of the result is the first binary digit to the right of the point.
Because .625 x 2 = 1.25, the first binary digit to the right of the point is a 1.
So far, we have .625 = .1??? . . . (base 2) .
Step 3: Next we disregard the whole number part of the previous result (the 1 in this case) and multiply by 2 once again. The whole number part of this new result is the second binary digit to the right of the point. We will continue this process until we get a zero as our decimal part or until we recognize an infinite repeating pattern.
Because .25 x 2 = 0.50, the second binary digit to the right of the point is a 0.
So far, we have .625 = .10?? . . . (base 2) .
Step 4: Disregarding the whole number part of the previous result (this result was .50 so there actually is no whole number part to disregard in this case), we multiply by 2 once again. The whole number part of the result is now the next binary digit to the right of the point.
Because .50 x 2 = 1.00, the third binary digit to the right of the point is a 1.
So now we have .625 = .101?? . . . (base 2) .
Step 4: In fact, we do not need a Step 4. We are finished in Step 3, because we had 0 as the fractional part of our result there.
Hence the representation of 4.625=100.101(base 2).
From binary to decimal
Convert 101100 to decimal:
1*25+ 0 * 24 + 1*23 + 1*22 + 0*21 + 0*20 = 44
Result = 44
From decimal to hexadecimal.
- Convert your decimal number to binary
- Split up in nibbles of 4, starting at the end
(you can add zeroes at the beginning if the number of bits is not divisible by 4, because, just as in decimal, these don’t matter)
Convert 39 to hexadecimal:
- First, we convert to binary (see above). Result: 100111
- Next, we split it up into nibbles: 0010/0111 (Note: added two zeroes to clarify the fact that these are nibbles)
- After that, we convert the nibbles separately.
Final result: 27
From hexadecimal to decimal
Convert 1AB to decimal:
- Value of B = 160×11. This gives 11, obviously
- Value of A = 161×10. This gives 160. Our current result is 171.
- Value of 1 = 162×1. This gives 256.
- Final result: 11+171+256 = 427
From decimal to octal
- Convert to binary.
- Split up in parts of 3 digits, starting on the right.
- Convert each part to an octal value from 1 to 7
Example: Convert 25 to octal
- First, we convert to binary. Result: 11001
- Next, we split up: 011/001
- Conversion to octal: 31
From octal to decimal
Example: convert 42 to decimal
- Value of 2=80×2=2
- Value of 4=81×4=32
Result: 2+32 = 34