5.1 Number Systems & Boolean Algebra

Key Takeaways

  • One hex digit equals exactly four binary bits, so 0xCA expands to 1100 1010 and equals 202 in decimal.
  • An n-bit two's complement system covers -2^(n-1) to +2^(n-1)-1, so 8 bits hold -128 to +127 with one extra negative value.
  • Negate a two's complement number by inverting every bit and adding 1; the same adder then does subtraction as addition.
  • De Morgan's theorems state NOT(A AND B) = NOT A OR NOT B and NOT(A OR B) = NOT A AND NOT B, making NAND and NOR universal gates.
  • A K-map group of 2^k adjacent 1-cells eliminates k variables, yielding a minimal sum-of-products expression.
Last updated: June 2026

Why number systems come first

The FE Electrical and Computer exam draws roughly 7 to 11 questions from Digital Systems, and most assume fluent base conversion. Computers store everything in binary (base 2), engineers read addresses in hexadecimal (base 16: digits 0-9 then A-F), sometimes group bits in octal (base 8), and people think in decimal (base 10). You must move between all four quickly: the NCEES FE Reference Handbook lists the place-value rules, but it cannot do the arithmetic for you.

The key shortcut is that one hex digit = four binary bits (because 2^4 = 16) and one octal digit = three binary bits (because 2^3 = 8). To convert hex to binary, expand each hex digit into its 4-bit pattern; to convert binary to hex, group bits in fours from the right. Decimal conversion uses positional weights: each binary position is a power of two, so 1011b = 8 + 0 + 2 + 1 = 11.

Base conversion reference

Memorize the first sixteen values so conversions become reflexive.

DecimalBinary (4-bit)OctalHex
0000000
5010155
81000108
10101012A
12110014C
15111117F

Worked conversion: Convert decimal 156 to binary and hex. Repeatedly divide by 2, reading remainders bottom-up: 156=10011100b. Group in fours from the right: 1001 1100 = 0x9C. Check: 916 + 12 = 144 + 12 = 156. To convert to octal, regroup the same bits in threes from the right: 010 011 100 = 0234 octal (264 + 3*8 + 4 = 156). Grouping bits is always faster and safer than dividing repeatedly by 8 or 16.

Test Your Knowledge

Convert the hexadecimal number 0x2F to decimal.

A
B
C
D

Two's complement and signed arithmetic

Two's complement is the standard way computers store signed integers because one adder handles both addition and subtraction and there is a single representation of zero. In an n-bit system the range is -2^(n-1) to +2^(n-1)-1; for 8 bits that is -128 to +127 (note one extra negative value, since there is no -0).

The most significant bit is the sign bit: 0 means non-negative, 1 means negative. To negate a number, invert every bit and add 1. Example: +5 in 8 bits is 0000 0101; inverting gives 1111 1010; adding 1 gives 1111 1011 = -5. Subtraction A - B is done as A + (two's complement of B).

Watch for overflow: when two operands of the same sign produce a result of the opposite sign, the answer wrapped and is invalid. A carry into the sign bit that differs from the carry out of it signals overflow. Adding two positives that yield a negative bit pattern is the classic exam trap; unsigned interpretation has no overflow, only carry-out.

Test Your Knowledge

What is the 8-bit two's complement representation of -6?

A
B
C
D

Boolean algebra, gates, and De Morgan's theorems

Digital logic rests on Boolean algebra, where variables take only 0 or 1. The identities the FE expects you to apply directly:

  • Identity: A + 0 = A; A AND 1 = A
  • Null: A + 1 = 1; A AND 0 = 0
  • Idempotent: A + A = A; A AND A = A
  • Complement: A + NOT A = 1; A AND NOT A = 0
  • Absorption: A + (A AND B) = A; A AND (A + B) = A
  • Distributive: A AND (B + C) = (A AND B) + (A AND C)

The most heavily tested rules are De Morgan's theorems: NOT(A AND B) = (NOT A) OR (NOT B), and NOT(A OR B) = (NOT A) AND (NOT B). A complemented group flips the operation and complements each term. This is why NAND and NOR are universal gates: any function can be built from either alone. The basic gates are AND, OR, NOT, NAND, NOR, XOR (1 when inputs differ), and XNOR (1 when inputs match).

Karnaugh maps and sum-of-products

A sum-of-products (SOP) expression is an OR of AND terms; it maps directly to a two-level AND-OR (or all-NAND) circuit. A Karnaugh map (K-map) minimizes an SOP by visual grouping instead of algebra. Rows and columns are labeled in Gray code (adjacent cells differ in one bit) so physically adjacent 1-cells can legally combine.

Minimization rules:

  1. Plot a 1 in every cell where the function is true.
  2. Circle the largest rectangular groups whose size is a power of two (1, 2, 4, 8).
  3. Groups may wrap edges and may overlap; a group of 2^k cells eliminates k variables.
  4. Cover every 1 with the fewest, largest groups; use a don't-care (X) as 1 only when it enlarges a group.

Worked K-map: For F(A,B,C) = sum of minterms (1,3,5,7) - every cell where C=1 - the four 1-cells form one group of four in which A and B both change and drop out, leaving simply F = C. Without the K-map you would write a four-term SOP and then reduce it algebraically; the map gives the answer at a glance.

Test Your Knowledge

Using De Morgan's theorem, the expression NOT(A OR B) is equivalent to which of the following?

A
B
C
D