3.1.7 · D4Boolean Algebra & Logic Gates

Exercises — Boolean algebra laws (commutative, associative, distributive)

2,170 words10 min readBack to topic

Reminders you will lean on (all proven in the parent note):

Here means AND (output 1 only if both 1), means OR (output 1 if at least one is 1), and every variable is only or .


Level 1 — Recognition

L1.1

Name the single law that turns into .

Recall Solution

WHAT: We swapped the order of the two operands of an OR. WHICH LAW: the commutative law (OR form). WHY it holds: , and doesn't care about order — the bigger of two numbers is the bigger no matter which you read first. Answer: Commutative law.

L1.2

Name the law behind .

Recall Solution

WHAT: Only the brackets (grouping) moved; the operator is AND throughout and the order of is unchanged. WHICH LAW: associative law (AND form). WHY: — the smallest of three numbers is the same whichever pair you compare first. Answer: Associative law.

L1.3

Which law lets you rewrite as ?

Recall Solution

WHAT: The was "shared out" across both terms inside the bracket. WHICH LAW: distributive law, AND over OR. This is the one that looks exactly like ordinary school algebra. Answer: Distributive law (AND over OR).


Level 2 — Application

L2.1

Apply commutativity to line up a common factor: rewrite so the shared variable is on the left of each product.

Recall Solution

WHAT & WHY, term by term:

  • — commutative (AND), lets lead.
  • — commutative (AND), same reason. Result: . Now is visibly common in both products, which is the setup for factoring later. Answer: .

L2.2

Apply the AND-over-OR distributive law to expand .

Recall Solution

WHAT: Share into each term of the three-term OR. WHY three terms is fine: by associativity is one big OR , and distribution splits over every OR term. Result: .

L2.3

Apply the OR-over-AND distributive law to expand into product-of-sums form.

Recall Solution

WHAT: Use the "weird" Boolean form . Match up: , , . Result: . WHY the appears twice: the lone term must be OR-ed into both brackets — it copies, it doesn't split. Answer: .


Level 3 — Analysis

L3.1

Simplify to a single variable. Name each law used.

Recall Solution
  • distributive (factor out ).
  • — complement law (from Boolean Algebra Identity & Null Laws): a bit OR its own flip is always 1.
  • — identity law. Result: . Two AND gates + one OR gate collapse to a bare wire.

L3.2

Simplify .

Recall Solution

Group the first two (they share ):

  • — distributive.
  • , so — identity. Now combine with the last term:
  • — distributive then complement then identity. Result: .

L3.3

Prove (absorption) using only distributive + identity/null laws — show every step.

Recall Solution
  • — identity, writing as so a common appears.
  • — distributive (factor ).
  • — null law (OR with 1 is always 1).
  • — identity. WHY this matters: the whole term vanished — the -gate was wasted silicon.

Level 4 — Synthesis

L4.1

A circuit computes with four 2-input ANDs and one 4-input OR. Refactor it to use as few gates as possible, then state the gate count before and after. (See figure.)

Figure — Boolean algebra laws (commutative, associative, distributive)
Recall Solution

WHAT — factor in stages. Group by the first letter using commutativity to line things up:

  • — distributive.
  • — distributive. So . Now is a common factor — factor it out (distributive again): Gate count:
  • Before: 4 ANDs + 1 OR (4-input) gates.
  • After: 1 OR () + 1 OR () + 1 AND gates. Saved: 2 gates, and the widest gate shrank from 4-input to 2-input. Same truth table, cheaper chip — the payoff Combinational Circuit Simplification chases.

L4.2

Show that OR distributes over AND is genuinely needed here: express as a product of sums.

Recall Solution

WHAT: Apply but with , :

  • . Now expand the right bracket the same way, :
  • . Result: — the lone copied into every bracket.

Level 5 — Mastery

L5.1 (edge case: degenerate inputs)

Someone claims associativity fails when a variable is . Test at the "all-zero-ish" corner and at , and explain why no input can ever break it.

Recall Solution
  • : LHS ; RHS . ✓
  • : LHS ; RHS . ✓ WHY it can never break: both sides equal regardless of the values. There are only possible input rows and every one gives LHS=RHS, because "the biggest of three bits" is a single well-defined number. Degenerate (all-zero) inputs are just one of those 8 rows — nothing special. Associativity is total, not conditional.

L5.2 (the copy-once trap, defused for good)

A student writes . Find the exact input that exposes the error and give the correct identity.

Recall Solution

Find a counterexample: try .

  • Correct value: .
  • Student's form: . → the identity is false. Correct identity: . Re-test that same row: ✓. The lone must live in both brackets.

L5.3 (build the full argument)

Prove the OR-over-AND distributive law from the AND-over-OR law + identity/idempotent/null laws, with a reason on every line.

Recall Solution

Start from the RHS and reach the LHS:

  • — AND-over-OR distributive, expand fully.
  • — idempotent ; commutative .
  • — factor from the first three terms (distributive), writing the bare as .
  • — null law (OR with 1 is always 1).
  • — identity . This is exactly the algebraic proof previewed in the parent note — now every single line is justified.

Wrap-up

Recall Self-test checklist

Can you now, without notes:

  • Factor and state the gate saving? ::: Yes → , 3 gates down to 2.
  • Break with one input? ::: Yes → gives .
  • Refactor ? ::: Yes → , 5 gates down to 3.

Feed these factorings into Karnaugh Maps to automate them, or into Combinational Circuit Simplification to see the silicon payoff. Physical gate meanings live in Logic Gates AND OR NOT.

Connections

  • Parent laws note (Hinglish)
  • Boolean Algebra Identity & Null Laws (the helper laws , used all over these solutions)
  • De Morgan's Theorems (for expressions with mismatched complements)
  • Logic Gates AND OR NOT (what the gate counts physically mean)
  • Karnaugh Maps (automates the factoring done by hand here)
  • Combinational Circuit Simplification (the fewer-gates payoff)