Electronics and Communication Engineering‹›⌂ 0:00 studied

Module 3 · 13 min read · Free chapter

Number systems, Boolean algebra and K-maps

In short

Digital circuits count in binary; 3 bits make an octal digit and 4 bits a hex digit. Negative numbers use 2's complement, with range −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1, so subtraction becomes addition. Boolean algebra simplifies logic with laws such as De Morgan and absorption, and a Karnaugh map groups adjacent 1s in powers of two to give the minimal expression.

What are you preparing for? We show the practice and previous year questions of your exam.

Start from zero: counting with two fingers

We count in tens because we have ten fingers. A digital circuit has only two reliable states, a low voltage and a high voltage, so it counts in twos. These states are written 0 and 1 and called bits.

With bits we can represent numbers, letters and instructions. To build circuits that work on them, we need an algebra for true-false values. That algebra was described by George Boole in 1854, long before electronics, and Claude Shannon showed in 1938 that relay circuits obey it.

Boolean algebra lets us write what a circuit must do as an expression, then simplify the expression so the circuit needs fewer gates. The Karnaugh map is a picture that makes the simplification quick for up to four or five variables.

This chapter covers the number systems and codes used in digital work, the rules of Boolean algebra, and minimisation with K-maps.

Why it matters. Every digital question, from GATE to RRB JE, assumes fluency in binary, 2's complement and K-maps. They also carry easy marks of their own.

Number systems and conversion

In a positional system with radix (base) rr, each digit is weighted by a power of rr:

N=∑idi riN = \sum_i d_i\, r^i

The digits left of the point have weights r0,r1,r2,…r^0, r^1, r^2, \ldots, and those to the right have r−1,r−2,…r^{-1}, r^{-2}, \ldots. Binary uses r=2r = 2, octal r=8r = 8 and hexadecimal r=16r = 16, with digits A to F for 10 to 15.

To decimal, multiply each digit by its weight and add. For example, 1011.012=8+2+1+0.25=11.25101011.01_2 = 8 + 2 + 1 + 0.25 = 11.25_{10}.

From decimal, convert the integer and fraction parts separately. For the integer part, divide repeatedly by the base and read the remainders from last to first. For the fraction, multiply repeatedly by the base and read the integer parts from first to last. Some decimal fractions, such as 0.1, never end in binary, which is why computers store them only approximately.

Binary to octal or hex is a matter of grouping. Group bits in threes from the point for octal and in fours for hex: 100111002=2348=9C1610011100_2 = 234_8 = 9\text{C}_{16}. This is why engineers write long binary values in hex.

Worked example. Convert 156 to binary. Dividing by 2 gives remainders 0, 0, 1, 1, 1, 0, 0, 1 from first to last, so reading upward 156=100111002156 = 10011100_2. Check: 128+16+8+4=156128 + 16 + 8 + 4 = 156.

Why it matters. Conversion questions are quick marks, and grouping by 3 or 4 bits is used constantly in microprocessor and memory work.

Signed numbers and 2's complement

A circuit must also store negative numbers. Three schemes have been used for an nn-bit word.

Sign-magnitude uses the leftmost bit as the sign and the rest as the size. It is easy to read but has two zeros, +0 and −0, and adding numbers of different signs needs extra logic.

1's complement forms −N by inverting every bit. It still has two zeros, and an end-around carry is needed in addition.

2's complement forms −N by inverting every bit and adding 1. It has a single zero, and the range of an nn-bit word is:

−2n−1 to 2n−1−1-2^{n-1} \ \text{to}\ 2^{n-1} - 1

For 8 bits that is −128 to +127. The leftmost bit still shows the sign, and it carries weight −2n−1-2^{n-1}.

The great advantage is that subtraction becomes addition. To find A−BA - B, add AA to the 2's complement of BB and ignore any carry out of the top bit. One adder therefore does both jobs, which is why every modern processor uses 2's complement.

Overflow happens when the true result does not fit. It can occur only when two numbers of the same sign are added, and it shows up as a result of the opposite sign. In hardware it is detected when the carry into the sign bit differs from the carry out of it.

Sign extension copies the sign bit to the left when a number is widened: −3 in 4 bits is 1101 and in 8 bits is 11111101.

Worked example. In 4 bits, 5+45 + 4: 0101+0100=10010101 + 0100 = 1001, which reads as −7. Two positives gave a negative, so overflow has occurred; the true answer 9 is outside −8 to +7.

Why it matters. Range, overflow and complement questions appear in GATE EC and CS every year.

Codes: BCD, excess-3, Gray and floating point

Not every binary pattern has to be a plain number. Codes assign patterns for convenience.

BCD (binary-coded decimal, 8421) writes each decimal digit as 4 bits, so 59 is 0101 1001. Patterns 1010 to 1111 are unused. BCD wastes some storage but makes decimal display and calculators simple. When two BCD digits add to more than 9, adding 6 (0110) corrects the result.

Excess-3 adds 3 to each digit before coding. It is self-complementing: inverting the bits gives the 9's complement, which once simplified decimal subtraction.

Gray code changes only one bit between successive values. It is formed from binary by gn−1=bn−1g_{n-1} = b_{n-1} and gi=bi⊕bi+1g_i = b_i \oplus b_{i+1}. A shaft encoder that reads position with Gray code cannot give a wildly wrong reading at a boundary, because only one bit is changing. Gray order also labels the rows and columns of a K-map.

ASCII codes letters and symbols in 7 bits, and Unicode extends this to all scripts, including Devanagari.

Very large and very small numbers use floating point, a sign, an exponent and a mantissa, like scientific notation in binary. The IEEE 754 standard stores the exponent with a bias and assumes a hidden leading 1. Its encoding, special values and rounding are covered in the computer arithmetic chapter Number representation and computer arithmetic.

Worked example. Binary 1011 to Gray: g3=1g_3 = 1, g2=1⊕0=1g_2 = 1 \oplus 0 = 1, g1=0⊕1=1g_1 = 0 \oplus 1 = 1, g0=1⊕1=0g_0 = 1 \oplus 1 = 0, so the Gray code is 1110.

Why it matters. Binary-Gray conversion and BCD addition are short GATE and JE questions.

The laws of Boolean algebra

A Boolean variable takes only the values 0 and 1. The three basic operations are AND (A⋅BA \cdot B, written ABAB), OR (A+BA + B) and NOT (A‾\overline{A}). Most laws look like ordinary algebra, but a few do not.

The basic identities are A+0=AA + 0 = A, A⋅1=AA \cdot 1 = A, A+1=1A + 1 = 1 and A⋅0=0A \cdot 0 = 0. Repeating a variable changes nothing, A+A=AA + A = A and AA=AAA = A, and a variable with its complement gives A+A‾=1A + \overline{A} = 1 and AA‾=0A\overline{A} = 0.

AND distributes over OR as usual, A(B+C)=AB+ACA(B + C) = AB + AC. Unlike ordinary algebra, OR also distributes over AND:

A+BC=(A+B)(A+C)A + BC = (A + B)(A + C)

The absorption laws remove redundant terms:

A+AB=A,A+A‾B=A+BA + AB = A, \qquad A + \overline{A}B = A + B

De Morgan's theorems turn ANDs into ORs and back:

AB‾=A‾+B‾,A+B‾=A‾ B‾\overline{AB} = \overline{A} + \overline{B}, \qquad \overline{A + B} = \overline{A}\,\overline{B}

In gate terms, a NAND equals an OR with inverted inputs, and a NOR equals an AND with inverted inputs. This is the basis of bubble pushing when redrawing logic circuits.

The consensus theorem removes a term that the others already cover:

AB+A‾C+BC=AB+A‾CAB + \overline{A}C + BC = AB + \overline{A}C

Every law has a dual, obtained by swapping AND with OR and 0 with 1. If one is true, so is the other.

Worked example. Simplify F=AB+AB‾+A‾BF = AB + A\overline{B} + \overline{A}B. The first two terms give A(B+B‾)=AA(B + \overline{B}) = A, so F=A+A‾B=A+BF = A + \overline{A}B = A + B by absorption.

Why it matters. Short simplification questions and "which identity is false" questions rely on these laws, especially absorption, De Morgan and consensus.

Canonical forms: minterms and maxterms

A truth table lists the output for every input combination. Two standard ways turn it into an expression.

A minterm is an AND of all variables, each in true or complemented form, that is 1 for exactly one row. For three variables, m5=AB‾Cm_5 = A\overline{B}C, which is 1 only for ABC=101ABC = 101. A function is the OR of the minterms where it is 1, the sum of products (SOP), written F=∑m(…)F = \sum m(\ldots).

A maxterm is an OR of all variables that is 0 for exactly one row. M5=A‾+B+C‾M_5 = \overline{A} + B + \overline{C}, which is 0 only for 101. A function is the AND of the maxterms where it is 0, the product of sums (POS), written F=∏M(…)F = \prod M(\ldots).

The two lists are complementary. If F=∑m(1,3,5,7)F = \sum m(1, 3, 5, 7) for three variables, then F=∏M(0,2,4,6)F = \prod M(0, 2, 4, 6).

With nn variables there are 2n2^n rows and so 2n2^n minterms. Each row can be 0 or 1, so the number of distinct functions is:

22n2^{2^n}

For two variables that is 16 functions, including AND, OR, XOR and their complements.

Worked example. A three-input majority function is 1 when at least two inputs are 1, so F=∑m(3,5,6,7)=∏M(0,1,2,4)F = \sum m(3, 5, 6, 7) = \prod M(0, 1, 2, 4). Simplified, it is F=AB+BC+CAF = AB + BC + CA.

Why it matters. Converting between ∑m\sum m and ∏M\prod M and counting functions are quick GATE questions.

Karnaugh maps

Algebraic simplification depends on spotting the right identity. A Karnaugh map (K-map) makes it visual. It is the truth table redrawn as a grid, with one cell per minterm, arranged so that neighbouring cells differ in exactly one variable.

The rows and columns are labelled in Gray order: 00, 01, 11, 10. The map also wraps round, so the left edge touches the right edge and the top touches the bottom. A four-variable map is best imagined on a doughnut.

Two adjacent 1s differ in one variable, so that variable drops out: ABC‾+ABC=ABAB\overline{C} + ABC = AB. In general:

  • Group the 1s in rectangles of 1, 2, 4, 8 or 16 cells, a power of 2.
  • Make each group as large as possible, since a group of 2k2^k cells removes kk variables.
  • Use as few groups as possible, covering every 1 at least once; overlaps are allowed.
  • Each group gives one product term, made of the variables that stay constant across it.

A group that cannot be enlarged is a prime implicant. If a 1 is covered by only one prime implicant, that group is essential and must appear in every minimal answer. Start with essential prime implicants, then cover any remaining 1s with as few extra groups as possible.

Some input combinations never occur, such as codes 1010 to 1111 in BCD. Their outputs are don't-cares, marked X. An X may be treated as 1 if it helps make a bigger group, or as 0 otherwise.

Grouping the 0s instead gives the minimal POS form. For more than five variables, maps become hard to read, and the Quine-McCluskey tabular method finds prime implicants systematically by combining minterms that differ in one bit. It is the basis of logic-minimisation software.

Worked example. Minimise F(A,B,C,D)=∑m(0,2,5,7,8,10,13,15)F(A, B, C, D) = \sum m(0, 2, 5, 7, 8, 10, 13, 15). The four corners (0, 2, 8, 10) form a quad giving B‾ D‾\overline{B}\,\overline{D}. Cells 5, 7, 13 and 15 form a quad giving BDBD. So F=B‾ D‾+BDF = \overline{B}\,\overline{D} + BD, which is the XNOR of B and D.

Why it matters. K-map minimisation, often with don't-cares, is one of the most frequent GATE digital questions.

Descriptive lens: how this topic is asked in written papers

Written papers ask this topic in four ways:

  1. Convert numbers between bases and codes, or perform 2's complement arithmetic with overflow checks.
  2. Prove Boolean identities, De Morgan's theorems or the consensus theorem.
  3. Minimise a function with a K-map, with or without don't-cares, in SOP and POS form.
  4. Explain why 2's complement is used, why Gray code suits encoders, or how Quine-McCluskey works.

Practice questions (our own, not previous-year questions).

  1. Explain the representation of negative numbers in sign-magnitude, 1's complement and 2's complement, and show why 2's complement simplifies hardware. Give the 8-bit range of each. (15 marks)
  2. Minimise F(A,B,C,D)=∑m(1,3,7,11,15)+d(0,2,5)F(A, B, C, D) = \sum m(1, 3, 7, 11, 15) + d(0, 2, 5) using a K-map and draw the circuit with NAND gates only. (10 marks)
  3. Prove the consensus theorem algebraically and state its dual. (10 marks)

Answer plan for question 3.

  • Write BC=BC(A+A‾)=ABC+A‾BCBC = BC(A + \overline{A}) = ABC + \overline{A}BC.
  • Show that AB+ABC=ABAB + ABC = AB and A‾C+A‾BC=A‾C\overline{A}C + \overline{A}BC = \overline{A}C by absorption.
  • Conclude that AB+A‾C+BC=AB+A‾CAB + \overline{A}C + BC = AB + \overline{A}C.
  • State the dual, (A+B)(A‾+C)(B+C)=(A+B)(A‾+C)(A + B)(\overline{A} + C)(B + C) = (A + B)(\overline{A} + C), obtained by swapping AND and OR.
  • Note the use: removing the consensus term simplifies circuits, while adding it back removes static hazards.

Quick revision

  • A positional number is N=∑diriN = \sum d_i r^i, and 3 bits make one octal digit while 4 bits make one hex digit.
  • Convert integers by repeated division and fractions by repeated multiplication.
  • The nn-bit 2's complement range is −2n−1-2^{n-1} to 2n−1−12^{n-1} - 1, and subtraction is addition of the complement.
  • Overflow occurs when same-sign operands give an opposite-sign result.
  • BCD adds 6 to correct sums above 9, and Gray uses gi=bi⊕bi+1g_i = b_i \oplus b_{i+1} with one bit changing per step.
  • De Morgan gives AB‾=A‾+B‾\overline{AB} = \overline{A} + \overline{B}, absorption gives A+A‾B=A+BA + \overline{A}B = A + B, and consensus drops BC.
  • The minterm and maxterm lists are complementary, and there are 22n2^{2^n} functions of n variables.
  • On a K-map, group powers of two, as large and as few as possible; edges wrap, and don't-cares are optional.

Check yourself

Exam-style questions on this chapter. Pick an answer to see the explanation. 0 of 12 answered

  1. The hexadecimal equivalent of binary 11010110211010110_2 is:

  2. The decimal value of 101.1012101.101_2 is:

  3. The range of an 8-bit 2's complement integer is:

  4. The 8-bit 2's complement representation of −20 is:

  5. In 4-bit 2's complement, which addition overflows?

  6. The Gray code for binary 0110 is:

  7. Decimal 47 in 8421 BCD is:

  8. The expression A+A‾BA + \overline{A}B simplifies to:

  9. By De Morgan's theorem, A+BC‾\overline{A + BC} equals:

  10. How many distinct Boolean functions of three variables exist?

  11. The minimal SOP of F(A,B,C,D)=∑m(0,2,8,10,5,7,13,15)F(A, B, C, D) = \sum m(0, 2, 8, 10, 5, 7, 13, 15) is:

  12. On a four-variable K-map, a group of eight adjacent 1s produces a term with how many literals?

Previous year questions

Previous year questions for UPSC CSE will appear here once each one is checked word for word against the official question paper.

Learn with AI

A tutor that asks instead of telling, a partner that argues the other side, and this chapter told through your own district.

Tell the tutor what you are stuck on. It will guide you with questions and give the answer after a few tries.

🙋 Raise a doubt or feedback

Stuck somewhere, or spotted a mistake? Write to the ExamHike team. We usually reply within a day, and you will see the reply on My progress.

Log in to ask a doubt or send feedback →

Frequently asked questions

What is Gray code used for?

Successive values differ in one bit, so shaft encoders cannot give a wildly wrong reading at a boundary; Gray order also labels K-map rows and columns.

How many Boolean functions of n variables are there?

2 raised to 2ⁿ, because each of the 2ⁿ truth-table rows can be 0 or 1; for two variables that is 16.

Can the four corners of a K-map be grouped?

Yes. The map wraps round, so the four corners of a four-variable map are adjacent and form one quad.

What is the consensus theorem?

AB + A'C + BC = AB + A'C: the term BC is already covered by the other two and can be dropped, though adding it back removes a static hazard.

More in this module: Digital circuits

Official sources

Facts in this chapter were checked against these official sources.

  1. GATE 2026 Electronics and Communication Engineering (EC) syllabus, IIT Guwahati
  2. NPTEL Digital Electronic Circuits (IIT Kharagpur, 108105132): number systems, Boolean algebra, Karnaugh maps, Quine-McCluskey