Boolean expression from circuit

Writing Boolean Expressions from Circuit Diagrams

A Boolean expression can be read directly from a logic circuit diagram by tracing each wire and gate from input to output, and substituting the appropriate symbol for each gate encountered. This is the reverse process of drawing a circuit from an expression: instead of going from symbols to gates, you go from gates to symbols.

The method is straightforward if applied systematically. Start at the inputs, work gate by gate towards the output, and write the expression as you go. Use AQA notation throughout: · for AND, + for OR, for XOR, and an overbar for NOT.

The Four-Step Method

  1. Identify all inputs and label them (A, B, C...).
  2. Trace from input to output. For each gate, write what feeds into it and what symbol represents that gate.
  3. Add overbars for any variable passing through a NOT gate.
  4. Use brackets where the order of operations might be ambiguous - particularly when AND feeds into OR, or when a NOT applies to a compound expression.

Worked Examples

Two Gates: NOT into AND

A B Q

Step-by-step reading:

  1. Input A passes through the NOT gate (triangle with circle). Write: A
  2. Input B goes directly to the AND gate - no gate applied to B, so just write B.
  3. The AND gate (·) takes A and B as its inputs.
  4. Final expression: A · B

No brackets are needed here because there is no ambiguity - the NOT is applied to A before AND, and that is already clear from the overbar notation.

Three Gates: AND and NOT into OR

A B C Q

Step-by-step reading:

  1. A and B feed into the AND gate (·). Write: A · B. (No brackets yet needed - this is just the AND result.)
  2. C feeds through the NOT gate. Write: C
  3. The OR gate (+) takes A · B and C as its two inputs.
  4. Final expression: A · B + C

Brackets are not needed here because AND (·) takes natural precedence over OR (+) - the expression is read as (A · B) + C by default. If it were the OR feeding into AND, brackets would be essential.

Three Inputs: XOR and NOT into AND

A B C Q

Step-by-step reading:

  1. A and B feed into the XOR gate (⊕). Write: A ⊕ B. Add brackets to keep this group explicit: (A ⊕ B).
  2. C feeds through the NOT gate. Write: C
  3. The AND gate (·) takes (A ⊕ B) and C.
  4. Final expression: (A ⊕ B) · C

Brackets around A ⊕ B are essential here. Without them, the expression A ⊕ B · C would imply B · C is evaluated first (because AND takes precedence over XOR), giving the wrong result.

When to Add Brackets

Brackets are needed whenever the intended order of operations differs from the default precedence (NOT first, then AND, then OR and XOR). A practical rule: any gate whose output feeds into a gate with lower precedence should have its sub-expression wrapped in brackets. For example, if an OR gate feeds into an AND gate, write (A + B) · C - the brackets prevent the default precedence from misrepresenting what the circuit actually does.

 Key Takeaways

  • To write a Boolean expression from a circuit, trace from inputs to output, replacing each gate with its AQA symbol: · (AND), + (OR), ⊕ (XOR), overbar (NOT).
  • Write overbars over variables that pass through a NOT gate before reaching the next gate.
  • Add brackets around any sub-expression that feeds into a gate of lower precedence (e.g. XOR or OR result feeding into AND).
  • No brackets are needed when AND feeds into OR, because AND already has higher precedence and the expression reads correctly without them.
  • Always work gate by gate from left (inputs) to right (output) - never try to write the whole expression in one step.