Boolean algebra: simplification, De Morgan & Karnaugh maps

Computer Science · Boolean logic

Question 1 of 10

0

    What is the output of an XOR gate with inputs A = 1 and B = 0?

    Stuck? Read the explanation

    Unlocks at a streak of 5 correct answers in a row.

    Print a free worksheet (PDF)

    Embed this practice on your site or class page

    Paste this HTML into your page. Students practise right there; it is free and needs no account.

    Boolean algebra: simplification, De Morgan & Karnaugh maps explained

    Boolean algebra works with two values, true and false, written as 1 and 0. The basic operators are AND, OR and NOT. A Boolean expression can often be simplified into an equivalent expression with fewer terms, which means a smaller and cheaper logic circuit. Useful laws include the identity law (A AND 1 = A), the complement law (A OR NOT A = 1) and the double negation law (NOT NOT A = A).

    De Morgan's laws describe how negation passes through a bracket. NOT (A AND B) equals NOT A OR NOT B, and NOT (A OR B) equals NOT A AND NOT B. Breaking the negation and swapping AND with OR is a frequent step in simplification. A Karnaugh map arranges the outputs of a truth table in a grid, using Gray code order so that neighbouring cells differ by one variable. Groups of 1s of size 1, 2, 4 or 8 that sit next to each other can be combined, and each group removes the variables that change within it.

    Worked example

    Simplify Q=AB‾+ABQ = A\overline{B} + AB.

    1. Factor out A: Q=A(B‾+B)Q = A(\overline{B} + B).
    2. Complement law: B‾+B=1\overline{B} + B = 1.
    3. Identity law: Q=A×1=AQ = A \times 1 = A.

    A truth table confirms this. When A is 1, Q is 1 whether B is 0 or 1, and when A is 0, Q is 0. So Q is equivalent to A.

    What you will practise

    125 multiple-choice questions (Easy, Medium, Hard). Each answer is followed by an explanation.

    Example questions

    • Which expression is equivalent to ¬(A · B) by De Morgan’s law?
    • What is the value of A + 0 for any Boolean variable A?
    • What is the value of A + ¬A?
    • Which law states that A · A = A?
    • Which expression simplifies to A by the absorption law?
    • Which logic gate gives output 1 only when both of its inputs are 1?
    • Which logic gate has the output ¬(A + B)?
    • How many rows does a truth table for three input variables have?

    …and 117 more.