Computers store and process information using number systems built from symbols and place value. Binary matters because digital circuits naturally represent two stable states, usually called 0 and 1. Understanding binary, decimal, octal, and hexadecimal helps students see how data, memory addresses, colors, instructions, and files are represented inside a computer.
Each number system uses a base, which tells how many digits are available and what each position is worth. In binary, place values are powers of 2, while decimal uses powers of 10, octal uses powers of 8, and hexadecimal uses powers of 16. Conversions work by expanding a number into place values or by grouping binary digits into sets of 3 for octal and sets of 4 for hexadecimal.
Understanding Binary and Number Systems
A computer does not treat a zero or one as an abstract digit at first. It works with physical signals. A transistor can be arranged so that a circuit recognizes a low voltage as one state and a higher voltage as the other.
Real voltages are not perfectly exact, so circuits use ranges and thresholds. This makes digital systems more reliable than trying to store many different voltage levels. A bit is one binary digit.
Bits are usually handled in groups of eight, called bytes. A byte can represent two hundred and fifty six different patterns, from all zeros through all ones.
The meaning of a bit pattern depends on the rules being used. The same eight bits might stand for a whole number, a letter, part of a picture, or a machine instruction. Text uses character encodings.
In a common encoding, the pattern for an uppercase A is assigned a particular number. Images store color information as numbers. Sound recordings store many measurements of air pressure each second.
Files are therefore long sequences of bits, with software deciding how to interpret them. Without the right format rules, a computer can read the bits but cannot know what they are meant to represent.
Computers need ways to represent negative numbers and fractions too. Most modern machines use two's complement for signed whole numbers. In this system, the leftmost bit of a fixed length value helps indicate whether the number is negative.
This method is useful because the same electronic circuits can add both positive and negative values. It does have limits. With eight bits, only a fixed range of whole numbers fits.
If a calculation goes beyond that range, overflow can occur and the stored result wraps into an incorrect value. Fractions are often stored with floating point numbers, which keep a sign, a scaled value, and an exponent. They can represent very large or very small values, but many decimal fractions cannot be stored exactly.
Hexadecimal is useful because long binary patterns are difficult for people to scan. Programmers use hex when inspecting memory, debugging programs, reading machine data, or setting colors in web design. A color such as red, green, and blue can be described by three byte-sized values, often written as six hex digits.
Permissions in some operating systems are commonly written in octal because each digit neatly represents three yes or no permission settings. When learning conversions, write place values clearly and work from the rightmost digit.
When grouping binary for octal or hexadecimal, begin at the right and add leading zeros only when needed. Keep the base labels in your working, since the digit one zero has different values in different number systems.
Key Facts
- Binary uses base 2, so its digits are only 0 and 1.
- Decimal uses base 10, so place values are 1, 10, 100, 1000, and so on.
- A binary number converts to decimal by adding powers of 2: 1011₂ = 1⋅8 + 0⋅4 + 1⋅2 + 1⋅1 = 11₁₀.
- In any base b, place values are powers of b: b^0, b^1, b^2, b^3, and so on.
- One hexadecimal digit equals 4 binary bits: 1111₂ = F₁₆.
- One octal digit equals 3 binary bits: 101₂ = 5₈.
Vocabulary
- Bit
- A bit is the smallest unit of digital information and can have the value 0 or 1.
- Base
- The base of a number system is the number of different digit symbols it uses.
- Place value
- Place value is the value a digit has because of its position in a number.
- Hexadecimal
- Hexadecimal is a base 16 number system that uses digits 0 through 9 and letters A through F.
- Octal
- Octal is a base 8 number system that uses digits 0 through 7.
Common Mistakes to Avoid
- Treating binary numbers like decimal numbers is wrong because 101₂ means 5₁₀, not one hundred one.
- Forgetting the rightmost place is 2^0 is wrong because the first place value is 1, not 2.
- Using invalid digits in a base is wrong because each base has a limited digit set, such as no digit 8 in octal and no digit 2 in binary.
- Grouping binary digits from the left when converting to hex or octal is wrong because groups should start from the right, with leading zeros added on the left if needed.
Practice Questions
- 1 Convert 110101₂ to decimal.
- 2 Convert 3A₁₆ to decimal, then write the same value in binary.
- 3 Explain why hexadecimal is more convenient than binary for writing long memory addresses.