3.1.4 · D3Boolean Algebra & Logic Gates

Worked examples — Boolean variables and operations (AND, OR, NOT)

2,583 words12 min readBack to topic

This page is the drill ground for Boolean variables and operations. The parent note taught you the three operations. Here we make sure you have seen every kind of situation they can appear in, so nothing on an exam can surprise you. Work each example's Forecast in your head before reading on — that guessing is where the learning happens.

Before we start, one reminder of the alphabet we are allowed to use, so no symbol sneaks in undefined:


The scenario matrix

Boolean algebra has no "quadrants" or "signs" like trigonometry does — its entire universe is . So "every scenario" means every shape of problem the topic can throw at you. Here is the full list, and which worked example covers each cell:

Cell Case class What is tricky about it Covered by
C1 Single-operator, both extreme inputs The pure definition, no precedence Ex 1
C2 Precedence collision (NOT + AND + OR together) Doing them in the wrong order Ex 2
C3 Degenerate / redundant variable A variable that does nothing to the answer Ex 3
C4 All-zero and all-one inputs (limiting cases) Confirming the "floor" and "ceiling" behaviour Ex 4
C5 Full truth table, 2 inputs ( rows) Enumerating every combination without gaps Ex 5
C6 Full truth table, 3 inputs ( rows) Same, but rows — easy to miss one Ex 6
C7 The De Morgan trap (NOT over OR/AND) The bar does not distribute naively Ex 7
C8 Real-world word problem Turning English into Boolean Ex 8
C9 Exam-style twist: expression that is always the same Recognising a constant / tautology Ex 9

We will visit all nine cells. Two of them get a picture, because seeing the "flip / gate / saturate" as geometry locks it in.


Example 1 — Cell C1 · pure single operators

The next picture shows why these three feel so different — each operator is a little machine with its own personality.

Figure — Boolean variables and operations (AND, OR, NOT)

Example 2 — Cell C2 · precedence collision


Example 3 — Cell C3 · a redundant (degenerate) variable


Example 4 — Cell C4 · all-zero and all-one limiting cases


Example 5 — Cell C5 · full 2-input truth table


Example 6 — Cell C6 · full 3-input truth table (8 rows)


Example 7 — Cell C7 · the De Morgan trap

Figure — Boolean variables and operations (AND, OR, NOT)

Example 8 — Cell C8 · real-world word problem


Example 9 — Cell C9 · exam twist: an expression that is always the same


Active Recall

Recall Which cell was hardest? Test the traps.
  • In , what runs first? ::: NOT, then AND, then OR
  • equals which of or ? ::: == (De Morgan)==
  • How many rows for inputs? ::: ====
  • What does always equal? ::: == (tautology)==
  • In , is needed? ::: ==No — absorption gives ; is redundant==
  • Door logic with ? ::: ==, door opens==

Connections

Scenario Map

order

more rows

flip operator

Scenario matrix

Single operator C1

Precedence collision C2

Redundant variable C3

All-zero all-one C4

Truth table 2 inputs C5

Truth table 3 inputs C6

De Morgan trap C7

Word problem C8

Always same C9