positional numeral systems
Number Representations (Binary, Hex)
You should know: integers
Overview
A number representation (positional numeral system) writes an integer as a sequence of digits, where each digit's contribution to the total value depends on both the digit and its position — its place value is a power of the system's base (radix). The familiar decimal system uses base 10 with digits 0–9, but any integer b ≥ 2 works as a base: binary (base 2, digits 0–1) is the native language of digital circuits, since a bit's two states map directly onto 'off' and 'on'; hexadecimal (base 16, digits 0–9 then A–F for 10–15) is popular in computing because each hex digit corresponds to exactly 4 bits, making it a compact, human-readable stand-in for binary. The same integer has a different digit string in each base, but converting between bases is mechanical: repeated division by the target base (to convert to that base) or summing digit × base^position (to convert from that base to decimal).
Intuition
Positional notation is an accounting trick: instead of one symbol per quantity (like tally marks), a digit's meaning is multiplied by where it sits, the way $1, $10, and $100 bills all use the same face value system but differ by position (power of 10). Binary is the same idea with only two denominations, 1 and 2, 4, 8, 16... (powers of 2) instead of 1, 10, 100...; converting decimal to binary by repeated division by 2 is just asking 'is there a $1 bill left over? a $2? a $4?' one denomination at a time, from the smallest up. Hexadecimal exists purely for human convenience: because 16 = 2⁴, every group of exactly 4 bits maps to one hex digit with no leftover boundary crossing, so hex strings are a shorthand for binary that's roughly 4 times shorter and much easier for people to read and type.
Formal Definition
In base b, a string of digits dₖdₖ₋₁...d₁d₀ (each dᵢ satisfying 0 ≤ dᵢ < b) represents the integer given by summing each digit times its place value:
Worked Examples
Repeatedly divide by 2, recording remainders from last to first.
Reading the remainders from bottom (last division) to top (first division) gives the binary digits.
Answer: 156 in decimal equals 10011100 in binary.
Practice Problems
Convert the binary number 101101 to decimal.
Convert the decimal number 45 to hexadecimal.
A color in a web page is written in hex as #9C2D3F, where each pair of hex digits is one of the red, green, blue channels (0-255 each). What is the decimal value of the red channel, 9C?
Quiz
Summary
- A positional numeral system in base b represents N = Σ dᵢ bᵢ, with each digit dᵢ satisfying 0 ≤ dᵢ < b.
- Binary (base 2) matches the two-state nature of digital circuits; hexadecimal (base 16) is a compact stand-in since 16 = 2⁴.
- Converting decimal to base b uses repeated division by b, reading remainders from last to first.
- Every group of exactly 4 binary bits corresponds to exactly one hexadecimal digit, with no boundary overlap.
References
- WebsiteWikipedia — Hexadecimal
Mathematics