Skip to content
Cambridge AS & A Level9618

Boolean Algebra and Logic Circuits

Computer Science 9618 Chapter Notes

Last updated November 2026

ShareWhatsAppPost

Boolean Algebra and Logic Circuits notes as a printable PDF.

Read online free. Download a watermarked copy with a free account.

Read the notes

The full Boolean Algebra and Logic Circuits notes as text: skim, search, and jump between subtopics.

~16 min read

1. Truth tables for logic circuits

A truth table lists every combination of inputs and the output each gives. Three inputs give eight rows, and four inputs give sixteen.

Add a working column for each bracket or gate output before the final column. Work the inside of a bracket first, then apply the NOT that sits outside it.

A gate can have more than two inputs. A 3-input NOR gate gives 1 only when all three inputs are 0.

rows = 2ⁿ for n inputs

X=overlineA+B+C is 1 only for A=B=C=0

Examiner insight

“A common incorrect answer was the opposite of the correct solution where candidates had correctly worked out the values for the bracketed expression, then omitted to invert the values for the final NOT.” “Some candidates need to understand that care must be taken when altering binary values.”

Worked example 12 marks

Complete the truth table for the logic expression:

X = NOT ((NOT A AND NOT B) OR (NOT B AND NOT C))

  1. 1

    working: bar A.bar B is 1 for ABC = 000, 001. bar B.bar C is 1 for ABC = 000, 100. The bracket is 1 for 000, 001, 100 only.

  2. 2

    invert for the final NOT. Rows 000 to 011 give X = 0, 0, 1, 1 [1]

  3. 3

    rows 100 to 111 give X = 0, 1, 1, 1 [1]

2. Half adders and full adders

A half adder adds two bits. In binary 1 + 1 = 10, so it gives a sum bit and a carry bit.

A full adder adds three bits: the two bits being added and a carry in from the column before. It has two outputs. One is the sum bit and the other is the carry output.

When the question asks for a sum-of-products, write one product term for each row of the output column that is 1. Do not simplify.

half adder: sum = A oplus B, carry = A.B

Examiner insight

“Many incorrect answers featured simplified Boolean algebra expressions, which the question did not ask for.”

Worked example 14 marks

Write the Boolean expressions for the two outputs Y and Z in the truth table as sum-of-products and state the purpose of each output.

ABCYZ
00000
00110
01010
01101
10010
10101
11001
11111
  1. 1

    Y = bar A.bar B.C + bar A.B.bar C + A.bar B.bar C + A.B.C [1]

  2. 2

    purpose of Y: sum bit [1]

  3. 3

    Z = bar A.B.C + A.bar B.C + A.B.bar C + A.B.C [1]

  4. 4

    purpose of Z: carry output [1]

3. Flip-flops as data storage

A flip-flop is used to store a binary digit. It is a data storage element.

An SR flip-flop is built from two NAND gates or two NOR gates of the same type. The output of each gate is fed back to become an input of the other gate. The inputs are Set (S) and Reset (R). The outputs are Q and bar Q.

Built from NOR gates, S = 1 with R = 0 sets Q to 1. S = 0 with R = 1 resets Q to 0. With both inputs 0 the circuit holds the bit it already stores. The syllabus also names the JK flip-flop.

Q=overlineR+bar Q

bar Q=overlineS+Q

Examiner insight

“Correct connections include the output from each of the logic gates passing back to become one of the inputs of the other logic gate.” “Candidates were generally aware that a flip-flop is used to store a binary digit.”

Worked example 15 marks

(a) Draw a logic circuit for an SR flip-flop and label the inputs.

(b) State the purpose of a flip-flop.

  1. 1

    (a) one correct NAND or NOR gate with two separate inputs and one output [1]

  2. 2

    a second gate of the same type, also with two separate inputs and one output [1]

  3. 3

    the output of each gate connected back as an input of the other gate [1]

  4. 4

    inputs labelled S / Set and R / Reset [1]

  5. 5

    (b) to store a binary digit / (single) bit [1]

4. De Morgan's laws

De Morgan's laws move a NOT across a bracket. The bar over a group splits into a bar on each term, and the operator changes: AND becomes OR, and OR becomes AND.

The law works with more than two terms. A bar over A+B+C becomes bar A.bar B.bar C.

Two bars over one term cancel by the double negation law. Use it after every De Morgan step.

overlineA.B=bar A+bar B

overlineA+B=bar A.bar B

barbar A=A

Worked example 13 marks

Simplify the following expression using Boolean algebra, including De Morgan’s laws.

Show your working.

overlineoverline(bar A.bar B).overline(bar A.C).overline(B.D)

  1. 1

    apply De Morgan's law to the outer bar, so each AND becomes OR: overlineoverline(bar A.bar B)+overlineoverline(bar A.C)+overlineoverline(B.D) [1]

  2. 2

    double negation removes each pair of bars: (bar A.bar B)+(bar A.C)+(B.D) [1]

  3. 3

    factorise bar A: bar A.(bar B+C)+B.D [1]

5. Simplifying with Boolean algebra

Simplify one law at a time and show all the stages. Name each law as you use it.

The laws seen in the mark schemes are the distributive law, the complement law, the identity law and the redundancy law. Stop only when no law can be applied.

A.(B+C)=A.B+A.C

A+bar A=1

A.1=A

X.Z+bar X=bar X+Z

Examiner insight

“Some candidates did a good job of applying the rules of Boolean algebra to substantially simply the expression but did not quite get it to its simplest form.”

Worked example 13 marks

Simplify the following expression using Boolean algebra.

Show all the stages in your simplification.

T = X.Y.Z + X.bar Y.Z + bar X

  1. 1

    distributive law: T = X.Z.(Y+bar Y)+bar X [1]

  2. 2

    complement law then identity law: T = X.Z.1+bar X = X.Z+bar X [1]

  3. 3

    redundancy law: T = bar X + Z [1]

6. Karnaugh maps from an expression

A Karnaugh map (K-map) is a grid of a truth table. The labels run 00, 01, 11, 10, so only one variable changes between neighbouring cells. Fill every cell with a 0 or a 1.

Loop groups of 1s to produce an optimal sum-of-products. Loops may overlap. The left and right edges are neighbours, so a loop can wrap round from column 00 to column 10. Each loop is one product term: keep the variables that do not change inside it.

A K-map is guaranteed to give you an optimal solution, and you do not need Boolean algebra to find it. Boolean algebra then puts the answer in its simplest form.

Examiner insight

“Sometimes, all the cells in the K-map were not filled in with either a 0 or a 1.” “Incorrect answers seen included candidates who placed a single loop around all six 1s or candidates who placed multiple loops around every group of two 1s.”

Worked example 17 marks

(a) Complete the Karnaugh map (K-map) for the following Boolean expression.

Z = bar A.bar B.bar C.bar D + bar A.bar B.bar C.D + bar A.B.bar C.bar D + bar A.B.bar C.D + A.B.bar C.bar D + A.B.bar C.D

(b) Draw loop(s) around appropriate group(s) in the K-map to produce an optimal sum-of-products.

(c) Write the Boolean logic expression from your answer to part(b) as a simplified sum-of-products.

(d) Use Boolean algebra to give your answer to part(c) in its simplest form.

CD \ AB00011110
00
01
11
10
  1. 1

    (a) every cell filled. The six terms are ABCD = 0000, 0001, 0100, 0101, 1100, 1101

  2. 2

    ``` CD\AB 00 01 11 10 00 1 1 1 0 01 1 1 1 0 11 0 0 0 0 10 0 0 0 0 ``` [2]

  3. 3

    (b) loop 1: the four 1s with AB = 00, 01 and CD = 00, 01 [1]

  4. 4

    loop 2: the four 1s with AB = 01, 11 and CD = 00, 01 (the loops overlap) [1]

  5. 5

    (c) Z = bar A.bar C + B.bar C [2]

  6. 6

    (d) Z = bar C.(bar A + B) [1]

7. Solving a logic problem with a K-map

Start from the truth table. Each row with output 1 gives one product term, and a variable that is 0 in that row carries a bar. Joined by OR, these terms are the sum-of-products.

Put the same 1s on the K-map and fill every other cell with 0. Loop the 1s, read one term off each loop, then use Boolean algebra for the simplest form.

Worked example 110 marks

This truth table represents a logic circuit.

(a) Write the Boolean logic expression that corresponds to the given truth table as the sum-of-products.

(b) Complete the Karnaugh map (K-map) for the given truth table.

(c) Draw loop(s) around appropriate group(s) in the K-map to produce an optimal sum-of-products.

(d) Write the Boolean logic expression from your answer to part(c) as a simplified sum-of-products.

(e) Use Boolean algebra to give your answer to part(d) in its simplest form.

ABCDZ
00001
00011
00101
00111
01000
01010
01101
01111
10000
10010
10100
10110
11000
11010
11100
11110
  1. 1

    (a) Z = bar A.bar B.bar C.bar D + bar A.bar B.bar C.D + bar A.bar B.C.bar D + bar A.bar B.C.D + bar A.B.C.bar D + bar A.B.C.D [3]

  2. 2

    (b) every cell filled with a 0 or a 1

  3. 3

    ``` CD\AB 00 01 11 10 00 1 0 0 0 01 1 0 0 0 11 1 1 0 0 10 1 1 0 0 ``` [2]

  4. 4

    (c) loop 1: column AB = 00. Loop 2: AB = 00, 01 with CD = 11, 10 [2]

  5. 5

    (d) Z = bar A.bar B + bar A.C [2]

  6. 6

    (e) Z = bar A.(bar B + C) [1]

Recap

  • A truth table has 2ⁿ rows. Use working columns and apply the outer NOT last.
  • A full adder gives a sum bit and a carry output. A sum-of-products has one product term for each 1.
  • A flip-flop stores a binary digit. An SR flip-flop is two NAND or two NOR gates, each fed back into the other.
  • De Morgan's laws split a bar and change the operator. Double negation cancels a pair of bars.
  • Simplify one law at a time and show every stage.
  • A K-map is labelled 00, 01, 11, 10. Loop groups of 1s and read one product term from each loop.

End-of-chapter exercise

Test yourself on the whole chapter. Work through these before moving on.

  1. State the output of a NOR gate when both inputs are 0.1 mark
    Answer
    1. A NOR B is NOT (A OR B)
    2. A OR B = 0, so the output is 1

    Trap: Reading NOR as OR gives the output 0.

  2. A logic circuit has inputs A, B and C. Its output is X = (A NAND B) OR C. State the values of A, B and C for which X = 0.2 marks
    Answer
    1. A NAND B is 0 only when A = 1 and B = 1
    2. X = 0 also needs C = 0
    3. So X = 0 only for A = 1, B = 1, C = 0. The other seven rows give X = 1

    Trap: Treating NAND as AND: the NOT comes after the AND, so NAND is 0 only when both inputs are 1.

  3. A half adder adds the bits A = 1 and B = 1. State the sum bit and the carry bit.2 marks
    Answer
    1. 1 + 1 = 10 in binary
    2. sum bit = 0 and carry bit = 1

    Trap: Writing a sum bit of 1 forgets that 1 + 1 carries in binary.

  4. A full adder has inputs A = 1, B = 1 and carry in C = 1. State the sum bit Y and the carry output Z.2 marks
    Answer
    1. 1 + 1 + 1 = 11 in binary
    2. sum bit Y = 1 and carry output Z = 1

    Trap: Giving Y = 0 because 1 + 1 gives a sum bit of 0 forgets the third input, which adds another 1.

  5. An SR flip-flop is made from two NOR gates. The upper gate has inputs R and bar Q and gives Q. The lower gate has inputs S and Q and gives bar Q. The flip-flop is storing Q = 0. S is set to 1 while R stays 0. Then S returns to 0 while R stays 0. State Q after each change.3 marks
    Answer
    1. S = 1: the lower gate gives bar Q=overline1+0=0
    2. the upper gate then gives Q=overline0+0=1, so Q is set to 1
    3. S back to 0: bar Q=overline0+1=0 and Q=overline0+0=1. Q stays 1: the flip-flop has stored the bit

    Trap: Expecting Q to fall back to 0 when S returns to 0 ignores the feedback: the circuit holds its value.

  6. Use De Morgan's laws to write overlineA.bar B with no bar over more than one term.2 marks
    Answer
    1. the bar splits and AND becomes OR: overlineA.bar B=bar A+barbar B
    2. double negation: barbar B=B, so the answer is bar A+B

    Trap: Splitting the bar but keeping the AND gives bar A.B. Examiners reported this error.

  7. Simplify overlinebar A+bar B+overlineA+bar B. Show each stage.3 marks
    Answer
    1. De Morgan's laws and double negation: overlinebar A+bar B=A.B and overlineA+bar B=bar A.B
    2. so the expression is A.B+bar A.B and factorising gives B.(A+bar A)
    3. complement law: A+bar A=1, so the answer is B

    Trap: Stopping at A.B+bar A.B gives an expression that is not in its simplest form.

  8. Simplify X = A.B + A.bar B.C + A.bar B.bar C. Show all the stages.3 marks
    Answer
    1. factorise the last two terms: X = A.B + A.bar B.(C+bar C)
    2. complement and identity laws: X = A.B + A.bar B
    3. factorise: X = A.(B+bar B) = A

    Trap: Treating C+bar C as 0 drops the last two terms and gives A.B: the complement law makes it 1.

  9. An irrigation controller has four sensor inputs A, B, C and D. The pump output Z must be 1 for exactly these six input patterns (ABCD): 0011, 0111, 1011, 1111, 0110 and 1110. For every other pattern Z is 0. (a) Place the 1s on a K-map with AB across the top and CD down the side, both in the order 00, 01, 11, 10. State the loops you would draw. (b) Write the simplified sum-of-products. (c) Use Boolean algebra to give it in its simplest form.5 marks
    Answer
    1. (a)
    2. The 1s fill the whole row CD = 11 and the cells AB = 01, 11 in the row CD = 10
    3. loop 1: the four 1s in row CD = 11. Loop 2: the four 1s with AB = 01, 11 and CD = 11, 10. The loops overlap
    4. (b)
    5. loop 1 keeps C = 1 and D = 1. Loop 2 keeps B = 1 and C = 1: Z = C.D + B.C
    6. (c)
    7. factorise C: Z = C.(D + B)

    Trap: One loop round all six 1s, or a loop round every pair, instead of two overlapping loops of four.

  10. A medicine fridge has four sensors A, B, C and D. Its alarm Z is 1 for exactly these six input patterns (ABCD): 0000, 0001, 0011, 1000, 1001 and 1011. For every other pattern Z is 0. (a) Complete a K-map with AB across the top and CD down the side, both in the order 00, 01, 11, 10. (b) State the loops for an optimal sum-of-products and write the simplified sum-of-products. (c) Use Boolean algebra, including De Morgan's laws, to show that Z=overlineB+C.bar D.8 marks
    Answer
    1. (a)
    2. ``` CD\AB 00 01 11 10 00 1 0 0 1 01 1 0 0 1 11 1 0 0 1 10 0 0 0 0 ```
    3. (b)
    4. columns AB = 00 and 10 are neighbours because the edges wrap round
    5. loop 1: the four 1s in rows CD = 00, 01 of those columns, keeping B = 0 and C = 0. Loop 2: the four 1s in rows CD = 01, 11, keeping B = 0 and D = 1. The loops overlap
    6. Z = bar B.bar C + bar B.D
    7. (c)
    8. factorise: Z = bar B.(bar C + D)
    9. De Morgan and double negation: bar C + D = overlineC.bar D, so Z = bar B.overlineC.bar D
    10. De Morgan again, the AND becomes OR under one bar: Z = overlineB + C.bar D

    Trap: Missing that the left and right edges wrap round leaves a loop round every pair of 1s, a mistake examiners reported.

Say this, not that

Wording that loses the mark, against the wording the mark scheme credits.

Loses the markGets the mark
overlineA.B becomes bar A.bar B (the bar splits but the AND stays)overlineA.B becomes bar A+bar B: the operator changes from AND to OR
Wrote simplified expressions for the outputs of an adderWrote the sum-of-products the question asked for, one product term for each 1 in the column
One loop round all six 1s, or a loop round every pairTwo overlapping loops of four 1s
Worked out the bracket and left its values as the answerInverted the bracket's values for the final NOT

Frequently asked questions

How do you complete a truth table for a logic expression with brackets?
A truth table lists every combination of inputs and the output each gives. Three inputs give eight rows, and four inputs give sixteen. Add a working column for each bracket or gate output before the final column. Work the inside of a bracket first, then apply the NOT that sits outside it.
What are De Morgan's laws and how are they used?
De Morgan's laws move a NOT across a bracket. The bar over a group splits into a bar on each term, and the operator changes: AND becomes OR, and OR becomes AND. Two bars over one term cancel by the double negation law, so use it after every De Morgan step.
How do you simplify a Boolean expression?
Simplify one law at a time and show all the stages, naming each law as you use it. The laws seen in the mark schemes are the distributive law, the complement law, the identity law and the redundancy law. Stop only when no law can be applied.
How do you use a Karnaugh map to find a simplified sum-of-products?
A Karnaugh map (K-map) is a grid of a truth table, labelled 00, 01, 11, 10, so only one variable changes between neighbouring cells. Fill every cell with a 0 or a 1, then loop groups of 1s to produce an optimal sum-of-products. The left and right edges are neighbours, so a loop can wrap round. Each loop is one product term.
What does an SR flip-flop look like as a logic circuit and what is its purpose?
An SR flip-flop is built from two NAND or two NOR gates of the same type. The output of each gate is fed back to become an input of the other gate. The inputs are Set (S) and Reset (R), and the outputs are Q and the inverse of Q. A flip-flop is used to store a binary digit.
Should the sum-of-products for an adder be simplified?
No. When the question asks for a sum-of-products, write one product term for each row of the output column that is 1, and do not simplify. Many incorrect answers simplified Boolean algebra expressions, which the question did not ask for. A half adder adds two bits, and a full adder adds three bits.

Free notes are just the start.

Unlock every Workbook and Chapter at a Glance, and generate your own worksheets and predicted papers.

Explore plans

Related chapters