Informatics I / Computers and Programming 1 / 6

Binary Numbers and Information Quantity

Inside computers, all information is represented using only two digits: "0" and "1." Characters, images, and music are all, ultimately, sequences of 0s and 1s. In this lesson, we will learn how the binary system used by computers works and about units for measuring the amount of information.

Bits and Bytes — The Smallest Units of Information

The smallest unit of information handled by a computer is called a bit. One bit can represent two states: "0 or 1." As the number of bits increases, the number of possible pieces of information doubles each time, and n bits can distinguish 2n possibilities. For example, 2 bits have four possibilities (00, 01, 10, and 11), 3 bits have eight, and 8 bits have 28 = 256.

A group of 8 bits is called 1 byte (B). As the amount of data increases, units such as kilobytes (KB), megabytes (MB), gigabytes (GB), and terabytes (TB) are used (1 KB = 1,000 B, 1 MB = 1,000 KB, and so on, increasing by 1,000 each time. Some conventions count by 1,024 inside computers).

Converting Between Binary and Decimal

The decimal system we use every day represents numbers with ten digits, 0 through 9, and the place value becomes ten times greater with each increase in place. The binary system, on the other hand, uses only 0 and 1, and its place values double from right to left: 1, 2, 4, 8, 16, and so on.

To convert a binary number to decimal, add the place values where there is a 1. To convert a decimal number to binary, a reliable method is to arrange the remainders from division by 2 from bottom to top.

Example Let us convert the binary number 1101 to decimal. The place values from left to right are 8, 4, 2, and 1, so 1101 = 8 + 4 + 0 + 1 = 13.
Conversely, to convert decimal 25 to binary: 25÷2 = 12 remainder 1, 12÷2 = 6 remainder 0, 6÷2 = 3 remainder 0, 3÷2 = 1 remainder 1, 1÷2 = 0 remainder 1. Reading the remainders from bottom to top gives 11001 (check: 16 + 8 + 1 = 25).

Hexadecimal — A Way to Write Binary Numbers More Briefly

Binary numbers tend to become long. Therefore, the hexadecimal system, which groups every four bits and represents them with one digit, is often used. In hexadecimal, after 0–9 come A (10), B (11), C (12), D (13), E (14), and F (15). For example, hexadecimal 2F is 2×16 + 15 = 47 in decimal. Hexadecimal numbers are familiar in uses such as web page color specifications (#FF0000 = red).

Binary Addition

The rules for binary addition are only these four: "0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, and 1 + 1 = 10 (carry)." For example, 1010 (10) + 0011 (3) = 1101 (13).

Key Points
  • Because computers operate with two states, such as high and low voltage, binary is easy to handle.
  • n bits give 2n possibilities. 8 bits = 1 byte = 256 possibilities.
  • Binary to decimal: "sum the place values." Decimal to binary: "read the remainders from division by 2 from bottom to top."
  • One hexadecimal digit corresponds to four binary digits (four bits).
  • The units increase in size in the order B → KB → MB → GB → TB.

Practice Questions

  1. Convert binary 10110 to decimal.
  2. Convert decimal 45 to binary.
  3. How many possibilities can be represented with 3 bits?
  4. Convert hexadecimal 1A to decimal.

Answers and Explanations

  1. Answer: 22
    Explanation: The place values from left to right are 16, 8, 4, 2, and 1. The 1s are in the 16, 4, and 2 places, so 16 + 4 + 2 = 22.
  2. Answer: 101101
    Explanation: 45÷2 = 22 remainder 1, 22÷2 = 11 remainder 0, 11÷2 = 5 remainder 1, 5÷2 = 2 remainder 1, 2÷2 = 1 remainder 0, 1÷2 = 0 remainder 1. Reading the remainders from bottom to top gives 101101. Check: 32 + 8 + 4 + 1 = 45.
  3. Answer: 8 possibilities
    Explanation: 23 = 8. There are eight possibilities from 000 to 111.
  4. Answer: 26
    Explanation: A represents 10. 1×16 + 10 = 26.

Questions and answers for this lesson

Loading...