Number systems & Boolean algebra

Digital logic & computing · tree view

Binary and hexadecimal are place-weighted number systems that map cleanly onto two-state electronics; Boolean algebra is the two-value mathematics (OR, AND, NOT, De Morgan) used to predict and simplify the behaviour of digital circuits.

Prerequisites

binary-place-weights.svg
binary-place-weights.svg
nibble-grouping.svg
nibble-grouping.svg

But the primary reason that the binary numeration system is used in modern electronic computers is because of the ease of representing two cipher states (0 and 1) electronically. With relatively simple circuitry, we can perform mathematical operations on binary numbers by representing each bit of the numbers by a circuit which is either on (current) or off (no current).

— kuphaldt-linac DIGI, Vol. IV (Digital), ch. 1 — Systems of numeration source

To convert a number in binary numeration to its equivalent in decimal form, all you have to do is calculate the sum of all the products of bits with their respective place-weight constants.

— kuphaldt-linac DIGI, Vol. IV (Digital), ch. 1 — Decimal versus binary numeration source

Octal and hexadecimal numeration systems would be pointless if not for their ability to be easily converted to and from binary notation. Their primary purpose in being is to serve as a "shorthand" method of denoting a number represented electronically in binary form. Because the bases of octal (eight) and hexadecimal (sixteen) are even multiples of binary's base (two), binary bits can be grouped together and directly converted to or from their respective octal or hexadecimal digits.

— kuphaldt-linac DIGI, Vol. IV (Digital), ch. 1 — Octal and hexadecimal numeration source

This other method uses repeated cycles of division (using decimal notation) to break the decimal numeration down into multiples of binary, octal, or hexadecimal place-weight values. In the first cycle of division, we take the original decimal number and divide it by the base of the numeration system that we're converting to (binary=2 octal=8, hex=16). Then, we take the whole-number portion of division result (quotient) and divide it by the base value again, and so on, until we end up with a quotient of less than 1.

— kuphaldt-linac DIGI, Vol. IV (Digital), ch. 1 — Conversion from decimal numeration source

However, Claude Shannon of MIT fame recognized how Boolean algebra could be applied to on-and-off circuits, where all signals are characterized as either "high" (1) or "low" (0). His 1938 thesis, titled A Symbolic Analysis of Relay and Switching Circuits, put Boole's theoretical work to use in a way Boole never could have imagined, giving us a powerful mathematical tool for designing and analyzing digital circuits.

— kuphaldt-linac DIGI, Vol. IV (Digital), ch. 7 — Introduction source

It should be clearly understood that Boolean numbers are not the same as binary numbers. Whereas Boolean numbers represent an entirely different system of mathematics from real numbers, binary is nothing more than an alternative notation for real numbers. The two are often confused because both Boolean math and binary notation use the same two ciphers: 1 and 0.

— kuphaldt-linac DIGI, Vol. IV (Digital), ch. 7 — Introduction source

Since the sum "1 + 1" certainly isn't 0, it must be 1 by process of elimination.

— kuphaldt-linac DIGI, Vol. IV (Digital), ch. 7 — Boolean arithmetic source

DeMorgan's theorem may be thought of in terms of breaking a long bar symbol. When a long bar is broken, the operation directly underneath the break changes from addition to multiplication, or vice versa, and the broken bar pieces remain over the individual variables.

— kuphaldt-linac DIGI, Vol. IV (Digital), ch. 7 — DeMorgan's Theorems source

If we translate a logic circuit's function into symbolic (Boolean) form, and apply certain algebraic rules to the resulting equation to reduce the number of terms and/or arithmetic operations, the simplified equation may be translated back into circuit form for a logic circuit performing the same function with fewer components. If equivalent function may be achieved with fewer components, the result will be increased reliability and decreased cost of manufacture.

— kuphaldt-linac DIGI, Vol. IV (Digital), ch. 7 — Boolean rules for simplification source
Show alternative explanations

With analog representation, the quantity is symbolized in a way that is infinitely divisible. With digital representation, the quantity is symbolized in a way that is discretely packaged.

— kuphaldt-linac DIGI, Vol. IV (Digital), ch. 1 — Numbers and symbols source

The terms unit and number when used with the decimal system are almost self-explanatory. By definition the unit is a single object; that is, an apple, a dollar, a day. A number is a symbol representing a unit or a quantity.

— NEETS Module 13, Module 13, ch. 1, p. 1-3 (Unit and Number)

These two types are the ones (R’s-1) complement and the twos (R’s) complement. The binary system R’s-1 complement is the difference between the binary number and all 1s. The R’s complement is the difference between the binary number and the next higher power of 2.

— NEETS Module 13, Module 13, ch. 1, p. 1-20 (complements)

Base conversion drill — binary ↔ hex ↔ decimal

Hex is binary shorthand: split the bits into groups of four from the right (add leading zeros to fill the last group), convert each 4-bit group to one hex digit (A=10 … F=15). Going the other way, expand each hex digit into four bits. Decimal comes from the place-weight sum, or from repeated division by 2 (remainders, LSB first).

To predict the outcome:

  1. To go binary → hex: group the bits in fours from the LSB, left-pad with zeros.
  2. Convert each group to its hex digit (1010 = A, 1011 = B, … 1111 = F).
  3. To get decimal: multiply each bit by its place weight and add, or divide the decimal number by 2 repeatedly and read the remainders bottom-to-top.
  4. Check the round trip: convert your answer back — you must land on the original number.
givenbinaryhexadecimaldecimal
11010110₂1101 0110D6₁₆214₁₀
10010111₂1001 011197₁₆151₁₀
3F₁₆0011 11113F₁₆63₁₀
A4₁₆1010 0100A4₁₆164₁₀
87₁₀ (repeated ÷2)101011157₁₆87₁₀
200₁₀ (repeated ÷2)11001000C8₁₆200₁₀

Counting milestones — the numbers you should read at sight

A few landmark values anchor every conversion: one hex digit covers exactly 0–15 (one nibble), 8 bits cover 0–255, and each extra bit doubles the count (2ᵇ values, from 0 to 2ᵇ − 1).

To predict the outcome:

  1. Memorise the nibble table 1010–1111 → A–F; everything else is decimal digits you already know.
  2. For byte-sized values, split into two nibbles and read each as a hex digit.
  3. Sanity-check magnitudes: FF₁₆ = 255, 80₁₆ = 128, 10₁₆ = 16.
decimalbinaryhexadecimalnote
000₁₆the same zero in every base
910019₁₆largest single decimal digit
101010A₁₆hex borrows letters from here
151111F₁₆one full nibble, all ones
161 000010₁₆rolls over to two hex digits
1281000 000080₁₆MSB alone in a byte
2551111 1111FF₁₆every bit set — byte maximum

Boolean identities — predict, then verify on every input row

Each identity below is a claim that two expressions agree for every possible input. Because inputs are only 0/1, you can prove each one by brute force: check both values of A (and all four pairs for two-input identities). That is exactly how the verdict column was computed.

To predict the outcome:

  1. Write the identity as a claim, e.g. (A + B)′ = A′·B′.
  2. List every input combination (2 per variable).
  3. Evaluate both sides at each row — if they agree everywhere, the identity holds.
  4. Remember De Morgan's bar-breaking rule: complementing a group flips + ↔ · and leaves the bar over each variable.
identityclaimverdict
A + A′ = 1a variable OR its complement is always 1verified — true for A=0 and A=1
A · A′ = 0a variable AND its complement is always 0verified — true for A=0 and A=1
A + 1 = 1OR with 1 forces the output highverified — true for A=0 and A=1
A · 1 = AAND with 1 leaves the signal aloneverified — true for A=0 and A=1
A + A·B = Athe B term is absorbedverified — equal on all 4 input pairs
(A + B)′ = A′ · B′De Morgan: NOR = negative-ANDverified — equal on all 4 input pairs
(A · B)′ = A′ + B′De Morgan: NAND = negative-ORverified — equal on all 4 input pairs
(A′)′ = Adouble complement cancelsverified — true for A=0 and A=1

Candidate projects — awaiting review

  • Build a 4-bit hex readout: four DIP-switch bits feed LEDs (binary view) while you compute and label the hex and decimal equivalents by hand for ten switch settings, verifying each against python's int(bits, 2) and hex(). Extend it with a 4511-style BCD decoder once the paper conversions are solid. (https://www.reddit.com/r/AskElectronics/comments/awhjn5/critique_my_binary_to_hex_converter_schematic/, community)
  • Conversion boot camp: convert the same twelve values (e.g. 87, 200, 0x3F, 0xA4, 11010110₂) by three routes each — place-weight sum, repeated division, and nibble grouping — and confirm all routes agree, exactly as Kuphaldt demonstrates. (https://www.ibiblio.org/kuphaldt/electricCircuits/DIGI/DIGI_1.html, book)
  • Complement arithmetic drill (how computers subtract): pick five 8-bit binary numbers, form the ones- and twos-complement of each by hand, then verify that subtracting = adding the complement for every pair. (NEETS Module 13, ch. 1 (complements), curriculum)
  • Identity trial-by-table: write five random Boolean expressions with 2–3 variables, predict a simplification using the identities above, then prove or refute it by writing the full truth table for both versions — the tables must match row for row. (https://www.ibiblio.org/kuphaldt/electricCircuits/DIGI/DIGI_7.html (Circuit simplification examples), book)