notAcalculator logo

Number Systems Guide: Bases, Powers, Roots, and Complex Numbers

A practical guide to number systems: positional bases and conversion, binary and hex arithmetic, exponent and root rules, logarithms, modular arithmetic, and complex numbers.

Number Systems Guide: Bases, Powers, Roots, and Complex Numbers

Introduction

A number is an abstract quantity; a numeral is the notation we use to write it down. The distinction sounds academic until you try to explain to a computer what "three hundred forty-five" means. Machines do not store quantities — they store symbols, and the rules that give those symbols meaning are called a number system.

This guide covers the number systems that appear most often in practice: positional bases (binary, octal, hexadecimal, decimal), the operations built on repeated multiplication (powers and roots), the operation that reverses them (logarithms), the arithmetic of remainders (modular arithmetic), and the extension of the real line into the complex plane.

Why Number Systems Matter

Every digital device you use depends on at least four of the topics in this guide:

  • Base conversion decides how a value typed as 255 becomes 0xFF in a stylesheet, 11111111 in memory, and 0377 in an octal permission field.
  • Powers of two set the size of every data type: 8-bit bytes, 32-bit integers, 64-bit addresses.
  • Logarithms turn multiplication into addition, which is why slide rules worked and why search algorithms can be logarithmic rather than linear.
  • Modular arithmetic is the mathematics behind checksums, hash tables, clock arithmetic, and the public-key encryption that secures every HTTPS connection.
  • Complex numbers are the natural language of alternating current, signal processing, and quantum mechanics.

The unifying idea is that notation is a choice and the underlying quantity is not. Once you see the pattern behind positional notation, base 16 stops being exotic and becomes the same idea as base 10 with a different digit set.

[khan-cs]

Core Concepts

Positional Notation and Bases

In a positional system, the position of a digit determines its weight. A number written in base bb expands as:

dnbn+dn−1bn−1+⋯+d1b+d0d_n b^n + d_{n-1} b^{n-1} + \cdots + d_1 b + d_0

The decimal number 345 is therefore:

345=3⋅102+4⋅101+5⋅100345 = 3 \cdot 10^2 + 4 \cdot 10^1 + 5 \cdot 10^0

Binary uses two digits (0 and 1) and powers of two:

11012=1⋅23+1⋅22+0⋅21+1⋅20=131101_2 = 1 \cdot 2^3 + 1 \cdot 2^2 + 0 \cdot 2^1 + 1 \cdot 2^0 = 13

To convert a decimal integer into base bb, divide repeatedly by bb and read the remainders from last to first. For 156 in base 2: 156, 78, 39, 19, 9, 4, 2, 1 produce remainders 0, 0, 1, 1, 1, 0, 0, 1 — reversed, that is 10011100210011100_2.

The binary calculator performs both directions at once and also converts to and from octal and hexadecimal, which is the quickest way to check a hand conversion.

Binary Arithmetic

Binary arithmetic follows the same column rules as decimal, with two digits instead of ten. Addition carries when a column reaches 2:

10112+01102=1000121011_2 + 0110_2 = 10001_2

That is 11 plus 6 equals 17. Multiplication is repeated shift-and-add, which is exactly how hardware multipliers work:

10112×1102=100001021011_2 \times 110_2 = 1000010_2

11 times 6 equals 66, and 66 in binary is 64 plus 2.

Negative integers are usually stored in two's complement: flip every bit and add one. In an 8-bit register, minus 5 is the bit pattern of 251, which is why signed and unsigned integers can overflow in surprising ways.

Hexadecimal and Octal

Hexadecimal is base 16 and needs sixteen digits, so it borrows A through F for 10 through 15. Its popularity is not aesthetic: one hex digit encodes exactly four bits, so a byte is always two hex digits. The value 255 is 11111111211111111_2 and also FF16\text{FF}_{16} — one line of text instead of eight.

Octal is base 8 and packs three bits per digit, which is why it survives in Unix file permissions such as 0755.

2F16=2⋅16+15=47\text{2F}_{16} = 2 \cdot 16 + 15 = 47

The hex calculator handles hex arithmetic and converts between hex, decimal, binary, and octal, which makes it useful when you are reading memory dumps, color codes, or permission masks.

Powers and Exponents

An exponent records repeated multiplication:

an=a⋅a⋯a⏟n factorsa^n = \underbrace{a \cdot a \cdots a}_{n \text{ factors}}

Five rules cover almost every manipulation you will need:

am⋅an=am+n,aman=am−n,(am)n=amna^m \cdot a^n = a^{m+n}, \qquad \frac{a^m}{a^n} = a^{m-n}, \qquad (a^m)^n = a^{mn}
a0=1(a≠0),a−n=1ana^0 = 1 \quad (a \neq 0), \qquad a^{-n} = \frac{1}{a^n}

Fractional exponents are roots in disguise, which is the bridge to the next section:

am/n=amna^{m/n} = \sqrt[n]{a^m}

The exponent calculator accepts positive, negative, zero, and fractional exponents and switches to exponential notation when the result gets too large to display in full.

Roots and Radicals

The nn-th root asks which number, multiplied by itself nn times, produces the radicand:

an=b  ⟺  bn=a\sqrt[n]{a} = b \iff b^n = a

Roots behave like exponents, because they are exponents:

an=a1/n,abn=an bn\sqrt[n]{a} = a^{1/n}, \qquad \sqrt[n]{ab} = \sqrt[n]{a}\,\sqrt[n]{b}

Two asymmetries matter in practice. Square roots of negative numbers have no real solution, which forces the complex numbers described below. Cube roots, by contrast, are defined for negatives: −83=−2\sqrt[3]{-8} = -2 because −2×−2×−2=−8-2 \times -2 \times -2 = -8.

The root calculator extracts square, cube, and any n-th root with adjustable precision, including negative radicands for odd roots. The cube calculator specialises in the cube case: it computes cubes and cube roots and tells you whether the input is a perfect cube such as 27 or 3375.

Logarithms

A logarithm answers the question "what exponent do I need?". It is the inverse of exponentiation:

log⁡bx=y  ⟺  by=x\log_b x = y \iff b^y = x

Three bases dominate practice: base 10 (common log), base ee (natural log), and base 2 (binary log, the currency of computer science). The rules mirror the exponent laws:

log⁡b(xy)=log⁡bx+log⁡by,log⁡b ⁣(xy)=log⁡bx−log⁡by\log_b(xy) = \log_b x + \log_b y, \qquad \log_b\!\left(\frac{x}{y}\right) = \log_b x - \log_b y
log⁡b(xn)=nlog⁡bx,log⁡bx=ln⁡xln⁡b\log_b(x^n) = n \log_b x, \qquad \log_b x = \frac{\ln x}{\ln b}

That last identity — change of base — is why a calculator with only a natural log button can still compute a base-2 log. The log calculator works in any base and shows the product, quotient, and power rules applied to your numbers.

Modular Arithmetic

The modulo operation returns the remainder of an integer division:

a mod m=rwherea=qm+r,  0≤r<ma \bmod m = r \quad \text{where} \quad a = qm + r, \; 0 \le r < m

Two conventions coexist. Truncated division keeps the sign of the dividend, so minus 7 mod 3 gives minus 1. Floored division keeps the sign of the divisor, so minus 7 mod 3 gives 2. Programming languages disagree about which one % implements, which is a classic source of off-by-one bugs when working with negative values.

Congruence notation compresses the same idea: a≡b(modm)a \equiv b \pmod{m} means both numbers leave the same remainder. A clock is the everyday example — 10 o'clock plus 5 hours is 3, not 15.

The modulo calculator uses floored modular arithmetic for values up to 999,999 and shows the remainder directly, which is the convention most number-theory work assumes.

Complex Numbers

The square root of a negative number has no place on the real line, so mathematicians extended the line into a plane by defining:

i2=−1i^2 = -1

A complex number has a real and an imaginary part:

z=a+biz = a + bi

Arithmetic works by treating ii as a symbol and replacing i2i^2 with minus 1 wherever it appears:

(3+4i)(1−2i)=3−6i+4i−8i2=11−2i(3 + 4i)(1 - 2i) = 3 - 6i + 4i - 8i^2 = 11 - 2i

Two derived quantities describe the geometry. The modulus is the distance from the origin, and the argument is the angle from the positive real axis:

∣z∣=a2+b2,arg⁡z=arctan⁡ ⁣(ba)|z| = \sqrt{a^2 + b^2}, \qquad \arg z = \arctan\!\left(\frac{b}{a}\right)

Together they give the polar form, which turns multiplication into a rotation:

z=∣z∣(cos⁡θ+isin⁡θ)=∣z∣eiθz = |z|(\cos\theta + i\sin\theta) = |z|e^{i\theta}

De Moivre's theorem follows immediately: raising to a power multiplies the angle by that power.

zn=∣z∣n(cos⁡nθ+isin⁡nθ)z^n = |z|^n (\cos n\theta + i\sin n\theta)

The complex number calculator performs all four operations and reports the modulus, argument, conjugate, and polar form alongside the result.

[needham]

Key Calculations: Worked Examples

Example 1: Decimal to Binary

Problem: Write 156 in binary.

Solution: Subtract the largest powers of two that fit: 128 fits, leaving 28; 16 fits, leaving 12; 8 fits, leaving 4; 4 fits, leaving 0. The powers 64, 32, and 2 are unused.

156=128+16+8+4=100111002156 = 128 + 16 + 8 + 4 = 10011100_2

Check by expansion: 128 plus 16 plus 8 plus 4 equals 156.

Example 2: Hexadecimal to Decimal

Problem: Convert BEEF16\text{BEEF}_{16} to decimal.

Solution: Expand each digit against its power of sixteen, remembering that B is 11, E is 14, and F is 15.

11⋅163+14⋅162+14⋅16+15=45056+3584+224+15=4887911 \cdot 16^3 + 14 \cdot 16^2 + 14 \cdot 16 + 15 = 45056 + 3584 + 224 + 15 = 48879

Example 3: Negative and Fractional Exponents

Problem: Evaluate 2−32^{-3} and 163/416^{3/4}.

Solution: A negative exponent is a reciprocal, not a negative result:

2−3=123=18=0.1252^{-3} = \frac{1}{2^3} = \frac{1}{8} = 0.125

A fractional exponent is a root first, then a power:

163/4=(161/4)3=23=816^{3/4} = \left(16^{1/4}\right)^3 = 2^3 = 8

Example 4: Cube Roots and Perfect Cubes

Problem: Find 33753\sqrt[3]{3375} and determine whether 3375 is a perfect cube.

Solution: Factor 3375 by extracting cubes: 3375 equals 27 times 125, and both factors are perfect cubes.

33753=27⋅1253=3⋅5=15\sqrt[3]{3375} = \sqrt[3]{27 \cdot 125} = 3 \cdot 5 = 15

Because the root is an integer, 3375 is a perfect cube. A non-integer root would mean the number is not one.

Example 5: Logarithms in Different Bases

Problem: Evaluate log⁡21024\log_2 1024 and log⁡381\log_3 81.

Solution: Ask what exponent produces the argument:

210=1024⇒log⁡21024=102^{10} = 1024 \Rightarrow \log_2 1024 = 10
34=81⇒log⁡381=43^4 = 81 \Rightarrow \log_3 81 = 4

With only a natural log available, change of base gives the same answer: ln⁡81/ln⁡3=4\ln 81 / \ln 3 = 4.

Example 6: Modular Arithmetic

Problem: Compute 17 mod 517 \bmod 5 and 210 mod 72^{10} \bmod 7.

Solution: The first is direct: 5 times 3 is 15, and 17 minus 15 leaves 2.

17=3⋅5+2⇒17 mod 5=217 = 3 \cdot 5 + 2 \Rightarrow 17 \bmod 5 = 2

The second matters because modular exponentiation is the core operation in public-key cryptography: you never need the full power, only its remainder.

210=1024=146⋅7+2⇒210 mod 7=22^{10} = 1024 = 146 \cdot 7 + 2 \Rightarrow 2^{10} \bmod 7 = 2

Example 7: Complex Multiplication and Polar Form

Problem: Multiply 3+4i3 + 4i by 1−2i1 - 2i, then express the first factor in polar form.

Solution: Expand as you would two binomials and use i2=−1i^2 = -1:

(3+4i)(1−2i)=3−6i+4i−8i2=11−2i(3 + 4i)(1 - 2i) = 3 - 6i + 4i - 8i^2 = 11 - 2i

For z=3+4iz = 3 + 4i, the modulus is 5 and the argument is about 53.13 degrees:

∣z∣=9+16=5,θ=arctan⁡ ⁣(43)≈53.13∘|z| = \sqrt{9 + 16} = 5, \qquad \theta = \arctan\!\left(\frac{4}{3}\right) \approx 53.13^\circ

So z=5(cos⁡53.13∘+isin⁡53.13∘)z = 5(\cos 53.13^\circ + i \sin 53.13^\circ). In this form, multiplying by another complex number multiplies the moduli and adds the angles — a rotation plus a scale.

[mathworld-complex]

Practical Applications

Programming: Bitmasks and Colors

A bitmask is a binary number used as a set of switches. The flag 0b0100 tests bit 2, and the operation value & 0b0100 returns non-zero only when that bit is set. Web colors use the same idea in hex: #1E90FF is three bytes, one per channel, and each pair of hex digits is exactly one byte.

Cryptography: Modular Exponentiation

RSA and Diffie-Hellman both live in modular arithmetic. Encryption raises a message to a power modulo a large number, and decryption reverses it using the structure of the multiplicative group. The security rests on the difficulty of factoring the modulus, which is why number theory from the previous guide and modular arithmetic from this one are two halves of the same story.

Engineering: Impedance and Phasors

Alternating current analysis uses complex numbers because a sinusoid has an amplitude and a phase, and a complex number carries both. Impedance is complex, so Ohm's law becomes V=IZV = IZ with complex quantities, and series impedances add like vectors. The modulus gives the magnitude ratio; the argument gives the phase shift.

Audio: Decibels

A decibel is a logarithm: a gain in dB is ten times the base-10 log of a power ratio. Because logs turn multiplication into addition, cascaded amplifier stages can be summed in dB instead of multiplied as ratios — which is why audio engineers think in addition, not multiplication.

Computing: Big Numbers and Precision

Standard floating point has 53 bits of mantissa, roughly 15 to 17 significant decimal digits. Factorials, combinatorics, and cryptographic keys blow past that immediately: 100 factorial has 158 digits. The big number calculator performs arithmetic with adjustable precision and handles factorials, powers, GCD, and LCM beyond ordinary limits, which is what you need when a result must be exact rather than rounded.

[knuth-taocp2]

Comparison Tables

The Same Values in Four Bases

510155
10101012A
15111117F
16100002010
25511111111377FF
1024100000000002000400

Each extra hexadecimal digit adds four bits of range, so the number of representable values grows exponentially with the width of the field.

Distinct values representable by an unsigned field of n bits (2 to the n).

Exponent, Root, and Logarithm as Inverses

ExponentWhat is the result of repeated multiplication?2 to the 101024
RootWhat number, repeated, gives this result?10th root of 10242
LogarithmWhat exponent produces this result?log base 2 of 102410
ModuloWhat remainder is left over?1024 mod 72
Complex modulusHow far is the point from the origin?3 + 4i5

The first three are three views of a single equation, by=xb^y = x: solve for the result, the base, or the exponent. The logarithm grows so slowly that it compresses enormous ranges into small numbers.

Base-2 logarithm of increasing magnitudes: every factor of 1000 adds about 10 bits.
[cormen]

Common Mistakes

  1. Reading binary as decimal. The string 10 means ten in base 10 and two in base 2. Always state the base, or use a prefix such as 0b or 0x, when the context is ambiguous.

  2. Treating a negative exponent as a negative result. 2−32^{-3} is one eighth, not minus eight. The minus sign inverts the value; it does not change its sign.

  3. Assuming the root of a square is always positive. x2=∣x∣\sqrt{x^2} = |x|, not xx. The square root function returns the principal (non-negative) root, so it discards the sign.

  4. Forgetting the base of a logarithm. log⁡100=2\log 100 = 2 only in base 10. In base 2 it is about 6.64, and in base ee it is about 4.61. Calculator buttons hide the base, which is exactly why the confusion survives.

  5. Mixing floored and truncated modulo. In floored arithmetic, minus 7 mod 3 equals 2; in truncated arithmetic it equals minus 1. Both conventions are in use, so a negative dividend is where bugs appear.

  6. Losing the imaginary unit in multiplication. When expanding complex products, every i2i^2 must become minus 1. Dropping that substitution turns a real contribution into an imaginary one and silently changes the answer.

  7. Trusting floating point for exact arithmetic. 0.1+0.20.1 + 0.2 is not exactly 0.3 in binary floating point, because one tenth has no finite binary expansion — the same reason one third has no finite decimal expansion.

Frequently Asked Questions

❓ Why do computers use binary instead of decimal?
✅ Because a physical switch has two stable states, on and off. Building circuits that reliably distinguish ten voltage levels is far harder and more error-prone than distinguishing two. Binary also maps cleanly onto Boolean logic, which is what logic gates implement.
❓ Why is hexadecimal used if computers work in binary?
✅ Hexadecimal is a compact human-readable shorthand for binary. Each hex digit maps to exactly four bits, so a byte is always two hex digits. Reading 0xFF is far less error-prone than counting eight ones and zeros.
❓ What is the difference between a root and a logarithm?
✅ Both invert exponentiation, but they solve for different unknowns. A root solves b to the y equals x for the base b. A logarithm solves the same equation for the exponent y. Exponentiation solves it for the result x.
❓ Can you take the square root of a negative number?
✅ Not within the real numbers. Extending the number system with the imaginary unit i, where i squared equals minus 1, makes every negative number have two complex square roots. Odd roots such as the cube root do have real answers for negative inputs.
❓ Why does log base 2 matter in computer science?
✅ Because binary search and balanced trees halve the problem at each step, so the number of steps is the base-2 logarithm of the input size. An algorithm that takes about 20 steps on a million items is logarithmic, and that is why large datasets remain searchable.
❓ What is modular arithmetic used for?
✅ Checksums, hash tables, clock arithmetic, cyclic scheduling, and public-key cryptography. Any time a quantity wraps around at a fixed boundary, modular arithmetic is the correct model. It is also the operation behind the last digit of a product or power.
❓ Why does minus 7 mod 3 give two different answers?
✅ Because there are two conventions. Floored division rounds toward negative infinity and returns 2; truncated division rounds toward zero and returns minus 1. Both satisfy the division identity, differing only in how the remainder is normalised.
❓ What does the modulus of a complex number mean?
✅ It is the distance from the origin in the complex plane, computed as the square root of a squared plus b squared. For 3 plus 4i the modulus is 5. It is the complex analogue of absolute value, and it multiplies when you multiply complex numbers.
❓ What is polar form good for?
✅ It turns multiplication into rotation and scaling. In polar form, multiplying two complex numbers multiplies their moduli and adds their arguments, which is why complex numbers describe rotations, oscillations, and alternating current so naturally.
❓ When do I need arbitrary-precision arithmetic?
✅ When a result must be exact and larger than about 15 significant digits: factorials, binomial coefficients, cryptographic keys, and financial totals. Standard floating point rounds, so exactness requires a big-number library or calculator.

Glossary

  • Argument: The angle of a complex number measured from the positive real axis.
  • Base: The number of distinct digits a positional system uses; also the number raised to a power in a logarithm.
  • Binary: Base 2, using the digits 0 and 1.
  • Bit: A single binary digit.
  • Complex number: A number of the form a plus bi, where i squared equals minus 1.
  • Conjugate: For a plus bi, the value a minus bi; their product is a squared plus b squared.
  • Exponent: The power to which a base is raised.
  • Floored modulo: A remainder convention that returns a value with the sign of the divisor.
  • Hexadecimal: Base 16, using 0 through 9 and A through F.
  • Logarithm: The exponent that produces a given value in a given base.
  • Modulus: The remainder in modular arithmetic, or the distance from the origin for a complex number.
  • Nibble: Four bits, equivalent to one hexadecimal digit.
  • Octal: Base 8, using the digits 0 through 7.
  • Polar form: Writing a complex number as modulus times the cosine-plus-i-sine of its argument.
  • Positional notation: A numeral system in which a digit's value depends on its position.
  • Radicand: The number under a root symbol.
  • Two's complement: The standard binary encoding of signed integers.

References

  1. [1]Knuth, Donald E. (1997). The Art of Computer Programming, Volume 2: Seminumerical Algorithms (3rd ed.). Addison-Wesley.Buy on Amazon
  2. [2]Cormen, Thomas H., Leiserson, Charles E., Rivest, Ronald L., and Stein, Clifford. (2022). Introduction to Algorithms (4th ed.). MIT Press.Buy on Amazon
  3. [3]Needham, Tristan. (1997). Visual Complex Analysis. Oxford University Press.Buy on Amazon
  4. [4]OpenStax. Algebra and Trigonometry 2e (free textbook).
  5. [5]Weisstein, Eric W. "Complex Number." From MathWorld - A Wolfram Web Resource (free reference).
  6. [6]Khan Academy. Computers and the Internet: digital information (free).
Give us your feedback! Was this useful?
1b

UnByte — Independent Software Engineering

All reference data cites its sources — Editorial policy