A number system is a system for representing numbers on a digital computer. Number systems are important because they provide a way for computers to represent and manipulate numerical data. The most commonly used number system in digital computers is the binary number system, which uses only two digits: 0 and 1. Other number systems that are used in computing include decimal, octal, and hexadecimal.
Binary number system
The binary number system is a number system that uses only two digits: 0 and 1. It is based on the concept of binary digits, which are the simplest form of data that a digital computer can understand and manipulate. In the binary system, each digit is known as a bit and each bit has a value of either 0 or 1. The binary number system is the foundation of all digital computing and is used by computers to represent and manipulate numerical data. It is important because it allows computers to perform arithmetic operations and to store and retrieve data in a convenient and efficient manner.
Here is an example of how the binary number system works:
- In the decimal (base-10) number system, the number 123 is represented as 1x10^2 + 2x10^1 + 3x10^0.
- In the binary (base-2) number system, the number 123 is represented as 1x2^7 + 1x2^6 + 0x2^5 + 1x2^4 + 1x2^3 + 0x2^2 + 1x2^1 + 1x2^0.
This can be written more concisely as 1111011 in binary, or 123 in decimal.
Decimal to binary conversion
- Divide the decimal number by 2 and write down the remainder.
- Divide the result from step 1 by 2 and write down the remainder.
- Continue dividing the result from the previous step by 2 and writing down the remainder until the result is 0.
- Read the remainders from bottom to top to get the binary representation of the decimal number.
- To convert the decimal number 123 to binary, we start by dividing it by 2:
- We then divide the result from the previous step by 2 and write down the remainder:
- We continue dividing the result from the previous step by 2 and writing down the remainder until the result is 0:
Decimal to binary - 458, 13, 369
- 458 / 2 = 229 remainder 0
- 229 / 2 = 114 remainder 1
- 114 / 2 = 57 remainder 0
- 57 / 2 = 28 remainder 1
- 28 / 2 = 14 remainder 0
- 14 / 2 = 7 remainder 0
- 7 / 2 = 3 remainder 1
- 3 / 2 = 1 remainder 1
- 1 / 2 = 0 remainder 1
- 13 / 2 = 6 remainder 1
- 6 / 2 = 3 remainder 0
- 3 / 2 = 1 remainder 1
- 1 / 2 = 0 remainder 1
- 369 / 2 = 184 remainder 1
- 184 / 2 = 92 remainder 0
- 92 / 2 = 46 remainder 0
- 46 / 2 = 23 remainder 0
- 23 / 2 = 11 remainder 1
- 11 / 2 = 5 remainder 1
- 5 / 2 = 2 remainder 1
- 2 / 2 = 1 remainder 0
- 1 / 2 = 0 remainder 1
- Divide 37 by 2 and record the remainder of 1: 37 / 2 = 18 R 1
- Divide the result of the previous division by 2 and record the remainder of 0: 18 / 2 = 9 R 0
- Divide the result of the previous division by 2 and record the remainder of 1: 9 / 2 = 4 R 1
- Divide the result of the previous division by 2 and record the remainder of 0: 4 / 2 = 2 R 0
- Divide the result of the previous division by 2 and record the remainder of 0: 2 / 2 = 1 R 0
- Divide the result of the previous division by 2 and record the remainder of 1: 1 / 2 = 0 R 1
Binary to decimal conversion
- Write down the binary number and assign each digit a value based on its position in the number. The rightmost digit has a value of 2^0, the next digit to the left has a value of 2^1, and so on.
- Multiply each digit by its assigned value and add the results together to get the decimal representation of the binary number.
- To convert the binary number 1111011 to decimal, we start by writing down the number and assigning each digit a value based on its position:
- We then multiply each digit by its assigned value and add the results together to get the decimal representation of the binary number:
Binary to decimal 1110001, 10010111, 1111
- Write down the digits of the binary number: 1, 1, 1, 0, 0, 0, 1
- For each digit, multiply it by 2 to the power of its position:
- Add up the products to get the decimal representation of the binary number: 1 + 2 + 4 + 0 + 0 + 0 + 64 = 73
- Write down the digits of the binary number: 1, 0, 0, 1, 0, 1, 1, 1
- For each digit, multiply it by 2 to the power of its position:
- Add up the products to get the decimal representation of the binary number: 1 + 0 + 0 + 8 + 0 + 32 + 64 + 128 = 151
- Write down the digits of the binary number: 1, 1, 1, 1
- For each digit, multiply it by 2 to the power of its position:
- Add up the products to get the decimal representation of the binary number: 1 + 2 + 4 + 8 = 15
- Therefore, the decimal representation of 1110001 is 113, the decimal representation of 10010111 is 151, and the decimal representation of 1111 is 15.
Octal number system
- In the decimal (base-10) number system, the number 123 is represented as 1x10^2 + 2x10^1 + 3x10^0.
- In the octal (base-8) number system, the number 123 is represented as 1x8^2 + 2x8^1 + 3x8^0.
- This can be written more concisely as 173 in octal, or 123 in decimal.
Conversion of decimal numbers to octal
- Divide the decimal number by 8 and write down the remainder.
- Divide the result from step 1 by 8 and write down the remainder.
- Continue dividing the result from the previous step by 8 and writing down the remainder until the result is 0.
- Read the remainders from bottom to top to get the octal representation of the decimal number.
- To convert the decimal number 123 to octal, we start by dividing it by 8:
- We then divide the result from the previous step by 8 and write down the remainder:
- We continue dividing the result from the previous step by 8 until the result is 0:
- We read the remainders from bottom to top to get the octal representation of the decimal number 123:
Decimal to octal - 2356, 2569, 3001, 526
- Divide 2356 by 8: 2356 / 8 = 294 with a remainder of 4
- Divide 294 by 8: 294 / 8 = 36 with a remainder of 6
- Divide 36 by 8: 36 / 8 = 4 with a remainder of 4
- Divide 4 by 8: 4 / 8 = 0 with a remainder of 4
- 342 / 8 = 42 R 6
- 42 / 8 = 5 R 2
- 5 / 8 = 0 R 5
- Divide 2569 by 8: 2569 / 8 = 321 with a remainder of 5
- Divide 321 by 8: 321 / 8 = 40 with a remainder of 1
- Divide 40 by 8: 40 / 8 = 5 with a remainder of 0
- Divide 5 by 8: 5 / 8 = 0 with a remainder of 5
- Divide 3001 by 8: 3001 / 8 = 375 with a remainder of 1
- Divide 375 by 8: 375 / 8 = 46 with a remainder of 7
- Divide 46 by 8: 46 / 8 = 5 with a remainder of 6
- Divide 5 by 8: 5 / 8 = 0 with a remainder of 5
Converting from octal to decimal
- Write down the octal number and assign each digit a value based on its position in the number. The rightmost digit has a value of 8^0, the next digit to the left has a value of 8^1, and so on.
- Multiply each digit by its assigned value and add the results together to get the decimal representation of the octal number.
- To convert the octal number 173 to decimal, we start by writing down the number and assigning each digit a value based on its position:
- We then multiply each digit by its assigned value and add the results together to get the decimal representation of the octal number:
- 1 * 8^3 = 512
- 4 * 8^2 = 256
- 1 * 8^1 = 8
- 4 * 8^0 = 4
Hexadecimal system
- In the decimal (base-10) number system, the number 123 is represented as 1x10^2 + 2x10^1 + 3x10^0.
- In the hexadecimal (base-16) number system, the number 123 is represented as 1x16^2 + 2x16^1 + 3x16^0.
- This can be written more concisely as 7B in hexadecimal, or 123 in decimal.
Conversion from decimal to hexadecimal
- Divide the decimal number by 16 and write down the remainder.
- Divide the result from step 1 by 16 and write down the remainder.
- Continue dividing the result from the previous step by 16 and writing down the remainder until the result is 0.
- Read the remainders from bottom to top to get the hexadecimal representation of the decimal number. If any of the remainders is greater than 9, convert it to its corresponding hexadecimal digit (A-F) before writing it down.
- To convert the decimal number 123 to hexadecimal, we start by dividing it by 16:
- We then divide the result from the previous step by 16 and write down the remainder:
- We continue dividing the result from the previous step by 16 until the result is 0:
- Since the result from the previous step is 0, there are no more remainders to write down.
- We read the remainders from bottom to top to get the hexadecimal representation of the decimal number 123:
- The remainder 11 is greater than 9, so we convert it to its corresponding hexadecimal digit (B) before writing it down:
- 154 / 16 = 9 R 10
- 9 / 16 = 0 R 9
Conversion of hexadecimal to decimal
- Write down the hexadecimal number and assign each digit a value based on its position in the number. The rightmost digit has a value of 16^0, the next digit to the left has a value of 16^1, and so on.
- Convert each hexadecimal digit to its corresponding decimal value and multiply it by its assigned value. Add the results together to get the decimal representation of the hexadecimal number.
- To convert the hexadecimal number 7B to decimal, we start by writing down the number and assigning each digit a value based on its position:
- We then convert each hexadecimal digit to its corresponding decimal value and multiply it by its assigned value:
- We add the results together to get the decimal representation of the hexadecimal number:
Hexadecimal to decimal - AB12, 5600, AFE, 9A
- Write down the digits of the hexadecimal number: A, B, 1, 2
- For each digit, multiply it by 16 to the power of its position:
- Add up the products to get the decimal representation of the hexadecimal number: 10 + 176 + 256 + 8192 = 43714
- Write down the digits of the hexadecimal number: 5, 6, 0, 0
- For each digit, multiply it by 16 to the power of its position:
- Add up the products to get the decimal representation of the hexadecimal number: 5 + 96 + 0 + 0 = 101
- Write down the digits of the hexadecimal number: A, F, E
- For each digit, multiply it by 16 to the power of its position:
- Add up the products to get the decimal representation of the hexadecimal number: 10 + 240 + 3584 = 2814
- Therefore, the decimal representation of AB12 is 43714, the decimal representation of 5600 is 21840, and the decimal representation of AFE is 2814.
- 9 * 16^1 = 144
- A * 16^0 = 10