- Learn
- Engineering
- Electrical Engineering
- Digital Logic Design
- Boolean Algebra and Logic Gates
Boolean Algebra and Logic Gates
BeginnerLesson 1 of 7 in Digital Logic Design Course
What you will learn
- Represent two-valued logic with Boolean variables, evaluate the basic and derived operators, and build a truth table for any expression.
- Use the AND, OR and NOT operatorsDefine Boolean variables and the three basic operators, read their different notations, and evaluate expressions in the correct order of operations.
- Build truth tables for Boolean expressionsList every input combination in standard order, evaluate an expression row by row, and use truth tables to define functions and test whether two expressions are equivalent.
- Use the NAND, NOR, XOR and XNOR operatorsDefine the derived operators, write them with AND, OR and NOT, and recognize their typical uses in parity, comparison and addition.
- Use the AND, OR and NOT operators
- Use the postulates, the theorems and De Morgan's laws to prove identities, complement functions and simplify expressions step by step.
- Apply the postulates and single-variable theoremsState the postulates of Boolean algebra, use the principle of duality, and apply the identity, null, idempotent, complement and involution laws.
- Use absorption, consensus and other multivariable theoremsApply the associative, absorption, combining, redundant-literal and consensus theorems to rewrite expressions and recognize redundant terms.
- Apply De Morgan's laws and complement functionsUse De Morgan's laws for two or more variables to move complements through an expression and to find the complement of a function.
- Simplify expressions algebraicallyReduce the number of terms and literals in an expression step by step, justify each step with a law, and verify the result with a truth table.
- Apply the postulates and single-variable theorems
- Read minterms and maxterms from a truth table, write sum-of-minterms and product-of-maxterms forms, convert between them, and use standard sum-of-products and product-of-sums expressions.
- Identify minterms and maxtermsWrite the minterm and maxterm for each row of a truth table, use their index notation, and relate the two to each other.
- Write sum-of-minterms and product-of-maxterms formsRead the canonical forms of a function from its truth table, write them in Σ and Π notation, convert between them, and expand an expression into canonical form.
- Use standard sum-of-products and product-of-sums formsConvert any expression into a sum of products or a product of sums, choose between the two, and connect them with two-level AND-OR and OR-AND circuits.
- Identify minterms and maxterms
- Recognize the standard gate symbols, translate between circuits and expressions, and build any function from NAND gates or NOR gates alone.
- Recognize logic gate symbolsIdentify each gate in the distinctive-shape and rectangular symbol sets, read inversion bubbles and multi-input gates, and relate logic values to voltage levels.
- Translate between expressions and gate circuitsDraw a gate circuit for an expression, derive the expression and truth table of a given circuit, and compare circuits by gates, gate inputs and levels.
- Build any function from NAND or NOR gatesShow that NAND and NOR are each universal, build NOT, AND and OR from them, and convert AND-OR circuits to NAND-only and OR-AND circuits to NOR-only form.
- Recognize logic gate symbols
Boolean Algebra and Logic Gates study guide
1Work with logic values, operators and truth tables
Digital signals use two logic values, but combining them can describe many behaviors. Begin by reading AND, OR, and NOT, then organize their results in complete truth tables. Derived operations add useful tests for matching bits and parity. Throughout, keep the operation order and the scope of each complement visible: those small details decide which function an expression actually describes.
1.1 Use the AND, OR and NOT operators
A Boolean variable has exactly two possible values: 0 and 1. These can describe false and true, or the low and high signal ranges in a circuit. An expression tells you how input values determine an output.
Read the three basic operations
AND gives 1 only when all inputs are 1. Write it as or . If a device needs both permission and a request , its enable signal is . When either input is 0, the output is 0.
OR gives 1 when at least one input is 1. Write it as . Both inputs may be 1: Boolean OR is inclusive. The plus sign means a logic operation, so . In binary arithmetic, adding two bits gives ; that is a different operation.
NOT reverses one bit. Write it as or . Thus and . The names complement, inversion, and NOT describe the same operation.
| Inputs A B | AND | OR |
|---|---|---|
| 0 0 | 0 | 0 |
| 0 1 | 0 | 1 |
| 1 0 | 0 | 1 |
| 1 1 | 1 | 1 |
The output of each operation is still 0 or 1. Several operations can therefore be joined to make a larger expression.
Evaluate in the right order
Work through parentheses, then NOT, then AND, then OR. A bar over a whole group also groups that expression: calculate everything beneath the bar before reversing its value.
For with , , and :
- Find the complements: and .
- Find each product: and .
- OR the products: .
Parentheses change the function. With , , and , the expression gives . The expression gives . Building the OR first would change the required behavior.
Keep the complement's scope visible
The expression complements the result of AND. It differs from , which complements the inputs before AND. At and , the first gives 1 and the second gives 0. In prime notation, write the whole-group complement as ; the parentheses show what the prime applies to.
A literal is one variable or its complement. The expression has three literals and is a product term, an AND of literals. The expression is a sum term, an OR of literals. A bar over a product does not make that entire product a literal.
Recognize equivalent notation
In mathematical logic, AND, OR, and NOT are written , , and . In C-like code, &&, ||, and ! act on logical true/false values. The operators &, |, and ~ act bit by bit on a number. A bitwise operation on a multi-bit word performs a separate Boolean operation at each bit position.
Key Takeaways
- AND requires every input to be 1; OR requires at least one.
- NOT complements the value covered by its bar or prime.
- Evaluate parentheses, NOT, AND, then OR.
- A literal is a variable or its complement; products AND literals and sums OR them.
1.2 Build truth tables for Boolean expressions
A truth table describes a function completely by listing every input combination and the output it produces. Intermediate columns let you check how an expression reaches that output.
List every input row
Each input has two possible values. For inputs, the table therefore needs rows: 4 for two inputs, 8 for three, and 16 for four. Count in binary from zero. State the variable order, with the first variable as the most significant bit.
For the order , the rows are 000, 001, 010, 011, 100, 101, 110, and 111. Row 5 means , , . You can construct the columns without guessing: alternates every row, every two rows, and every four rows.
Build columns for the expression
Consider . First form , then , then the final OR.
| Row | A | B | C | NOT B | A AND NOT B | F |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 0 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 |
| 2 | 0 | 1 | 0 | 0 | 0 | 0 |
| 3 | 0 | 1 | 1 | 0 | 0 | 1 |
| 4 | 1 | 0 | 0 | 1 | 1 | 1 |
| 5 | 1 | 0 | 1 | 1 | 1 | 1 |
| 6 | 1 | 1 | 0 | 0 | 0 | 0 |
| 7 | 1 | 1 | 1 | 0 | 0 | 1 |
In row 4, , but the product is 1, so the output is 1. In row 5, both the product and are 1; OR still gives 1. The 1-rows are 1, 3, 4, 5, and 7. A repeated output value is normal; a repeated input row means a different combination may be missing.
Turn a verbal rule into a table
Define every signal before filling outputs. For a three-input majority function, means at least two inputs are 1. Rows 3, 5, and 6 each contain two 1s, and row 7 contains three. Those four rows have output 1; all other rows have output 0.
An inclusive condition such as “at least two” includes three. Reading it as “exactly two” would incorrectly change row 7. The table exposes that difference before you choose an expression or circuit.
Compare functions, not appearances
Expressions are equivalent when their output columns agree in every row for the same input order. For , if then both terms are 0; if then the OR is 1. Its truth table therefore equals that of .
To disprove equivalence, one differing row is enough. At and , while . To establish equivalence by a truth table, compare all rows. A few matching tests leave the unchecked combinations unresolved.
Count possible functions
A fixed set of inputs supplies rows. Each output cell can independently contain 0 or 1, giving possible functions. Two inputs give 4 rows and functions; three inputs give 8 rows and functions. Constants and functions that ignore an input are included: an output column of all zeros is a valid function too.
Key Takeaways
- Use all 2ⁿ input combinations in a stated variable order.
- Intermediate columns keep each operation checkable.
- Equivalent functions agree in every row; one differing row disproves equivalence.
- A function may ignore an input or have a constant output.
- There are 2^(2ⁿ) Boolean functions of n inputs.
1.3 Use the NAND, NOR, XOR and XNOR operators
Derived operators combine AND, OR, and NOT into useful single operations. Their names describe related functions, but their output conditions differ.
Compare the output rules
NAND complements AND: . It gives 0 only when both inputs are 1. NOR complements OR: . It gives 1 only when both inputs are 0.
XOR, written , gives 1 when the two inputs differ. XNOR complements XOR and gives 1 when they match.
| A | B | NAND | NOR | XOR | XNOR |
|---|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 | 0 | 1 |
XOR differs from inclusive OR in the last row. XNOR checks equality of two bits, including the case where both are 0.
Express XOR and XNOR with basic operations
Different bits occur in two cases: and . Joining those cases gives
Matching bits occur in and , so
XOR with 0 leaves a bit unchanged: . XOR with 1 reverses it: . This makes XOR a controlled inverter, with the second input choosing whether to reverse the first. Equal inputs cancel in XOR: .
When adding two bits, XOR gives the sum bit and AND gives the carry bit. Two 1s add to : the sum bit is 0 and the carry is 1. This arithmetic use does not change the meaning of Boolean OR.
Extend XOR to parity
XOR is associative and commutative, so a chain can be grouped or reordered without changing its output. Every 1 reverses the running result. An even number of reversals returns it to 0; an odd number leaves it at 1. Thus is the odd-parity function.
For data 1011, the XOR is . Append a parity bit of 1 to make the total count of 1s even. The transmitted bits 10111 contain four 1s, so their combined XOR is 0. A single flipped bit changes that check to 1. Two flipped bits leave the parity unchanged, so an even-parity check does not detect every possible error.
The complement of an XOR chain detects an even count of 1s, including zero. With three inputs at 111, the XOR is 1 and its complement is 0. “Exactly one” is a different condition once there are more than two inputs.
Do not cascade NAND as though it were AND
NAND and NOR are commutative, but neither is associative. A three-input NAND computes . Two two-input NANDs in a chain compute
At 111, the three-input NAND gives 0, while the chain gives 1. The first NAND has already reversed its intermediate output; the second gate acts on that reversed value. A multi-input NAND or NOR symbol must be read as one operation over all its inputs.
Key Takeaways
- NAND is complemented AND; NOR is complemented OR.
- Two-input XOR detects different bits; XNOR detects matching bits.
- An XOR chain gives 1 for an odd number of 1s.
- NAND and NOR are not associative, so simple cascades change the function.
2Manipulate expressions with the laws of Boolean algebra
Boolean laws give you a way to change an expression while keeping its truth table. Begin with the basic identities, then look for terms that add no new cases. De Morgan’s laws handle complements of groups, and simplification brings these methods together. Each equality needs a reason; the aim is a function with fewer terms or inputs whose behavior you can still justify for every input combination.
2.1 Apply the postulates and single-variable theorems
Boolean laws let you rewrite an expression without changing its output for any input. They resemble algebraic rules, but both the values and the operations belong to two-valued logic.
Start from the postulates
An axiom, or postulate, is a rule used as a starting point. Huntington's postulates describe closure, identities, commutativity, both distributive laws, complements, and at least two distinct elements. Closure means that applying an operation to elements of the set gives another element of that set. For two-valued Boolean algebra, the set is .
The identities are 0 for OR and 1 for AND. Commutativity gives and . Both operations distribute over the other:
The second identity is specific to Boolean algebra. For example, with , both sides are 1 regardless of the other inputs. With , both sides reduce to . Shannon's 1938 work connected this algebra to switching circuits, making algebraic design a practical tool for hardware.
Apply the single-variable laws
| Law | OR form | AND form |
|---|---|---|
| Identity | ||
| Null or dominance | ||
| Idempotent | ||
| Complement |
Involution removes a double complement: . Each law also applies when its variable stands for a whole expression. If , then gives .
As a short simplification, take . Identity changes the first part to ; idempotence changes to . Thus . No value was assigned to the inputs: the laws justify the result for every row.
Form the dual
To form a dual, swap OR with AND and swap 0 with 1. Leave variables and their complements unchanged, and preserve grouping. The dual of is . The dual of is .
Duality carries a valid identity into another valid identity. It does not say that an expression equals its dual. At , , the expression gives 1 but its dual gives 0. Complementing a function is a separate operation that reverses its output.
Prove and avoid invalid cancellation
Perfect induction means checking every possible input assignment. A one-variable identity requires two rows; an identity involving three variables requires eight. For , both and equal 1.
A proof from postulates can also establish a theorem. For idempotence:
The steps use identity, complement, reverse distribution, complement, then identity.
Subtraction and division are not Boolean operations. You cannot cancel from : when , that equation holds even if and differ. Likewise, when , the equation supplies no information about whether .
Key Takeaways
- Identity, dominance, idempotence, complement, and involution preserve every output row.
- Both AND and OR distribute over the other operation.
- Duality swaps AND/OR and 0/1 while leaving literals unchanged.
- Perfect induction checks all possible input assignments.
- Ordinary subtraction, division, and cancellation do not apply.
2.2 Use absorption, consensus and other multivariable theorems
Some expressions contain a term or literal that adds no new 1-rows. Multivariable theorems identify those redundancies, often without expanding a whole truth table.
Reorder before looking for a pattern
Associativity lets you regroup repeated operations: and . Commutativity lets you reorder them. Thus can be written as when that makes a theorem easier to see. These rules apply within the same operation; they do not allow arbitrary movement across AND and OR.
Absorb a more restrictive term
Absorption gives . Whenever , is already 1, so the extra product contributes no new output case. Algebraically,
The dual is . A whole product can act as the common part. For example,
The three-literal product is more restrictive, so it is the term that disappears.
Remove a redundant literal
The theorem removes the complemented literal, not the entire second term. If , both sides are already 1. If , both sides depend on . The proof is
For , treat as a group to get . Reducing the expression to would lose cases where and . The dual theorem is .
Combine a pair that differs in one literal
For , factor out :
The pair covers both values of while keeping the same condition on . Similarly, . The dual form is .
Check that every other literal matches. The terms and differ in two variables. Combining them into 1 would incorrectly turn the XNOR function into a constant.
Recognize consensus
The consensus theorem is
The first two terms contain opposite forms of . Their remaining literals form the consensus term . Whenever , either and , or and . The consensus therefore adds no new 1-row.
You can also write . Absorption removes these pieces under and . The dual removes a redundant sum:
For , the consensus of the first two terms is . Remove that term to obtain ; the unrelated term stays. If a suspected consensus lacks either supporting term, the theorem does not justify deleting it.
Key Takeaways
- Absorption removes a term already covered by a less restrictive term.
- A + A′B = A + B removes a literal while retaining B.
- Combining requires identical terms except for one complemented/uncomplemented pair.
- Consensus removes a term covered jointly by two supporting terms.
- Associativity and commutativity help expose theorem patterns.
- The dual theorems simplify products of sums.
2.3 Apply De Morgan's laws and complement functions
A complement must reverse the output of an entire function. De Morgan's laws move that complement through AND and OR while keeping the meaning of the expression intact.
Change the operation and complement each part
The two laws are
For an OR to be false, both inputs must be false. For an AND to be false, at least one input must be false.
A truth table confirms the second law. In rows 00, 01, and 10, AND is 0, so NAND is 1; at least one complemented input is also 1. In row 11, NAND is 0 and both complemented inputs are 0. The output columns agree in all four rows.
The same rule extends to larger groups:
Work through nested groups
Take . The outer operation under the bar is OR, with parts and . Complement those two parts and join them with AND:
Now the remaining group is an AND. Change it to OR and complement each input:
If a sum of products is useful, distribute to get . The parentheses in the factored form keep both terms dependent on . Dropping them would produce a different function.
The phrase “break the bar and change the operator” refers to the operation directly beneath that bar. It does not permit breaking apart every product and sum at once without preserving their groups.
Complement a whole function
For , complement the OR of the two product terms:
You may describe the procedure as taking the dual expression and complementing every literal. Taking the dual alone leaves the literal polarities unchanged and does not generally reverse the output.
Expanding the result gives . The last term is the consensus of the first two, so an equivalent shorter form is .
Check the inversion and read its gate form
A function and its complement have opposite outputs in every row. At , , , the original is 1 and is 0. A full table also satisfies and in every row.
In a circuit, says that a NAND equals an OR with both inputs inverted. Similarly, a NOR equals an AND with both inputs inverted. An output bubble can therefore move to every input when the gate operation changes. Moving the bubble while keeping the same operation would change the truth table.
Key Takeaways
- Complementing an OR gives the AND of the complements.
- Complementing an AND gives the OR of the complements.
- Preserve each subgroup while applying De Morgan’s laws from the outside inward.
- A dual swaps operations; a complement also reverses literal polarities.
- De Morgan’s laws explain bubbled-input equivalents of NAND and NOR.
2.4 Simplify expressions algebraically
Simplification seeks an equivalent expression with fewer terms or literal occurrences. The best first move depends on the expression: expanding may expose a combination, while factoring may save work immediately.
Choose a useful direction
First remove double complements and use De Morgan's laws when bars hide useful structure. Look for absorption, pairs that differ in one literal, and consensus terms. Factor shared literals if that reduces the expression. Give a law for each equality so that a shorter expression still has a clear justification.
A literal count counts occurrences, not distinct variable names. The expression contains four literal occurrences; its equivalent contains one. Count after simplifying, because repeated inputs can correspond to repeated gate connections.
Reuse a term to combine twice
Consider
There are nine literal occurrences. The first term can combine with the second by removing , and with the third by removing . Idempotence permits duplicating that first term without changing the function:
Factoring each pair gives
The result has four literals. A term can support two combinations because OR-ing it with itself adds no new output row.
For variable order , the original terms select rows 2, 3, and 6. The reduced term selects rows 2 and 3; selects rows 2 and 6. Their union is exactly the original set.
Let the laws guide a less obvious reduction
Take . Factor the first two terms:
Now combine the remaining with :
Together, . This is the majority function: every product represents one pair of 1s. In each reduction, the redundant-literal theorem applies to the expression inside the parentheses.
For a product of sums, reverse distribution can be shorter than expansion. The identity reduces four literals to three. With complementary terms, .
Verify the function and interpret the result
Compare original and simplified outputs over every input row, or use a complete chain of valid identities. A few trial rows can reveal an error, but matching samples leave other rows untested. Keep input order fixed when recording the table.
Algebraic methods can stop before the shortest form. For instance, has no pair that combines by differing in one literal; consensus still removes . A successful reduction shows an improvement, not a guarantee of the global minimum.
Watch for a lost term when factoring. Since , writing it as would drop the cases where and . Ordinary cancellation is not a valid substitute for a Boolean law.
Key Takeaways
- Count every literal occurrence when comparing expressions.
- Idempotence allows one term to support more than one combination.
- Use expansion, factoring, absorption, combining, and consensus where they help.
- A complete truth table or valid algebraic proof establishes equivalence.
- A shorter algebraic result need not be globally minimal.
3Express functions in canonical and standard forms
A truth table can be translated into an expression one row at a time. Minterms describe the rows where a function is 1; maxterms describe the rows where it is 0. Canonical forms record those rows explicitly, while standard SOP and POS forms allow shorter terms. Learn to move between these representations and use their structure to choose how the function will be built from gates.
3.1 Identify minterms and maxterms
Minterms and maxterms connect an individual truth-table row to an expression. Each contains every input variable exactly once, but a minterm selects a 1-row and a maxterm selects a 0-row.
Write the minterm for a row
A minterm is an AND of all variables, each in its normal or complemented form. It gives 1 in exactly one row. To match that row, choose each literal so that it equals 1 there.
For order , row 5 is 101. The required product is . At 101, its three literals are all 1. In every other row, at least one is 0, so the product is 0. A row bit of 0 therefore gives a complemented variable; a row bit of 1 gives an uncomplemented variable.
Three variables have eight possible rows and therefore eight minterms. A product that omits an input is not a minterm of all three variables. The product is 1 at both 010 and 011, because it places no condition on .
Write the maxterm for the same row
A maxterm is an OR of all variables. It gives 0 in exactly one row. Every literal must therefore equal 0 in that row. This reverses the minterm rule: a row bit of 0 gives an uncomplemented variable, and a row bit of 1 gives a complemented variable.
For row 5, write . At 101, all three terms are 0. At any other input combination, at least one term is 1, so the sum is 1.
The subscript tells you the row selected, not whether the expression is a sum or a product. Lowercase means minterm and uppercase means maxterm.
Keep a small reference table
For variable order :
| Index | A B | Minterm | Maxterm |
|---|---|---|---|
| 0 | 0 0 | ||
| 1 | 0 1 | ||
| 2 | 1 0 | ||
| 3 | 1 1 |
Each maxterm is the complement of the minterm with the same index:
For example, complementing with De Morgan's law produces . Its single 1-row becomes the maxterm's single 0-row.
Make the variable order explicit
The same product can carry different indexes. Under , selects 101, so it is . Under , its matching bits are 110, so it is . The function has not changed; only the row labels have changed.
To check a proposed minterm, substitute its indexed row and require every literal to be 1. To check a proposed maxterm, require every literal to be 0. Writing for row 5 fails that check: it is 1 there and is actually zero at row 2.
The OR of all minterms is 1, because every input row makes one minterm true. The AND of all maxterms is 0, because every row makes one maxterm false. These two complete collections will let you describe any output column by selecting only the needed rows.
Key Takeaways
- A minterm contains all variables and is 1 in exactly one row.
- A maxterm contains all variables and is 0 in exactly one row.
- Minterms complement 0-bits; maxterms complement 1-bits.
- Row indexes depend on the stated variable order.
- Mᵢ is the complement of mᵢ.
3.2 Write sum-of-minterms and product-of-maxterms forms
A canonical form writes a Boolean function directly from its truth table. It keeps a complete record of the selected rows, even when a shorter expression exists.
Select 1-rows for a sum of minterms
Each minterm contributes a 1 in its own row only. OR the minterms for every row where the function is 1. The notation names this sum of minterms; the numbers inside the parentheses are row indexes, not values to add.
For with order , the 1-rows are 1, 3, 4, 5, and 7:
Written out, this is
Every term contains all three variables, making this the canonical SOP. Its five products contain 15 literal occurrences.
Select 0-rows for a product of maxterms
Each maxterm contributes a 0 in its own row only. AND the maxterms for every row where the function is 0. Here the 0-rows are 0, 2, and 6, giving
This is the canonical POS. The product becomes 0 whenever one listed maxterm is 0; it stays 1 in all unlisted rows.
For three variables, the full index set runs from 0 through 7. The indexes absent from the sum-of-minterms list form the product-of-maxterms list of the same function. Changing both the operator and the list preserves the function. Changing the list while keeping complements it:
Expand an expression without losing a row
For , fill in each missing variable with a factor equal to 1:
Expansion produces rows 4, 5, 6, and 7. The second term becomes
which produces rows 5 and 1. Row 5 appears twice, so idempotence removes the duplicate:
For maxterms, use the dual procedure. Add a missing variable's product with its complement, which equals 0, then distribute. For :
Thus .
Use canonical forms as a check
With a fixed variable order, a function's canonical index lists are unique apart from ordering. Two expressions with the same minterm list define the same function. Compare the lists only after confirming that both use the same variable order and number of inputs.
Canonical forms can be long. The five-term form for above has the same truth table as the three-literal expression . A complete row record is useful for verification; a circuit may benefit from simplifying that record before implementation.
Key Takeaways
- Canonical SOP ORs the minterms of 1-rows.
- Canonical POS ANDs the maxterms of 0-rows.
- To switch Σm and ΠM for the same function, use the missing indexes.
- To complement a function within the same form, use the missing indexes.
- Expand missing variables with X + X′ = 1 for SOP or XX′ = 0 for POS.
- Remove repeated canonical terms by idempotence.
3.3 Use standard sum-of-products and product-of-sums forms
Standard forms organize expressions by their final two operations. They make the circuit structure easy to read, without requiring every term to mention every variable.
Recognize SOP and POS
A sum of products (SOP) is an OR of products of literals, such as . A product of sums (POS) is an AND of sums of literals, such as . A single literal can serve as a product term or a sum term.
Canonical forms are special cases with every variable in every term. For a three-input function, is standard SOP but not canonical SOP. The term omits , and the term omits both and .
An expression can be neither form. In , the sum sits inside an AND and a product sits inside the sum. Distributing gives the SOP ; distributing in the other direction gives the POS .
Convert to a sum of products
Move complements onto individual variables, then distribute AND over OR. For example,
The complementary product is 0. The remaining is the consensus of and . Removing it leaves
A complement over a whole product also needs attention: . A standard product term contains literals, not an unprocessed complemented group.
Convert to a product of sums
Use . Applied to , this produces
The final factor is the dual consensus term, so the POS reduces to . Another route is to find an SOP for the complement and then complement it using De Morgan's laws.
Connect the form to gates
An SOP uses an AND gate for each multi-literal product and a final OR. Single-literal terms enter that OR directly. A POS uses OR gates for its multi-literal sums and a final AND. These are called two-level circuits when input inverters are excluded from the level count. A physical path through an input inverter and both main gates still passes through three gates, and the inverter contributes delay.
The choice affects circuit size. The POS has four literal occurrences. Its expanded SOP has eight. A truth table with few 1-rows offers a short canonical SOP; few 0-rows offers a short canonical POS. Simplification may further change the comparison.
Translate a condition into both forms
Let 1 mean “on.” A pump runs when start is on and the tank-full signal is off, or manual override is on. Its SOP is . Reverse distribution gives the POS .
The override can enable the output even when the start branch is false. At , , , both forms give 0. Treating the description as would require the override for every run and would change the specified behavior.
Key Takeaways
- SOP is an OR of products; POS is an AND of sums.
- Canonical terms contain every variable; standard terms may omit variables.
- Move group complements to literals before classifying a standard form.
- SOP maps to AND-OR; POS maps to OR-AND.
- Input inverters are excluded from the usual two-level count but still add delay.
- Equivalent SOP and POS forms can require different numbers of gates and inputs.
4Draw and analyze logic gate circuits
Gate diagrams turn Boolean expressions into connected operations. Learn the two common symbol styles, follow wires and inversion bubbles, and label intermediate outputs so that a circuit can be checked one gate at a time. Then compare equivalent implementations by their gates, inputs, and levels. NAND and NOR provide a final connection: either type alone can implement all the operations needed for any Boolean function.
4.1 Recognize logic gate symbols
A logic gate is a circuit element that implements a Boolean operation. Read its shape or label, then look for inversion bubbles and follow the connected wires.
Read distinctive shapes
In the distinctive-shape style, often called ANSI, an AND has a straight input side and a rounded D-shaped front. An OR has a concave curved input side and a pointed front. An XOR adds a second curved line behind the OR shape's input side.
A buffer is a triangle whose output equals its input. It can strengthen or isolate a signal without changing the Boolean value. A triangle with a small circle at its output is an inverter, which outputs the complement.
The circle is an inversion bubble. An output bubble turns AND into NAND, OR into NOR, and XOR into XNOR. An input bubble complements only that input before the main operation. A bubble is part of the function, not decoration.
Read rectangular labels
IEC-style symbols use rectangles with internal labels:
| Label | Operation without an output bubble |
|---|---|
| & | AND |
| ≥1 | OR: at least one input is 1 |
| =1 | Exactly one input is 1; two-input XOR |
| 1 | Buffer |
Add an output bubble to obtain the complemented operation. An “&” box with a bubble is NAND; a “1” box with a bubble is NOT. The same truth table can therefore be drawn using either symbol style.
For two inputs, exactly one 1 is the same condition as odd parity. With three inputs, those conditions differ. At 111, a rectangular “=1” element gives 0, while . IEC provides a separate odd-parity symbol. Do not assume that adding an input to an exactly-one element creates an XOR chain.
Follow the wiring
Inputs are usually drawn on the left and outputs on the right. A dot at an intersection means that the wires connect. Crossing lines without a dot do not connect. An output may branch to several gate inputs; this is fan-out.
Trace a branch back to its source before assigning a variable. Two lines that cross without a connection dot carry independent signals. A bubble also differs from a connection dot: a bubble is an open circle on a gate terminal; a connection dot is filled and marks joined wires.
AND, OR, NAND, and NOR can each have more than two inputs. A three-input NOR gives . Associativity allows several two-input ANDs to replace one multi-input AND, and similarly for OR. A simple NAND or NOR chain changes intermediate polarities and does not perform the corresponding multi-input operation.
Relate logic to voltage
Hardware represents low and high with voltage ranges. Low may be near 0 V and high near a supply such as 3.3 V or 5 V. These examples are not universal switching thresholds.
In positive logic, high represents 1 and low represents 0. Negative logic reverses those assignments for inputs and output. The physical voltage behavior stays the same, while its Boolean description changes. A physical positive-logic AND is described as OR under negative logic: a high output requires both physical inputs high, which translates to a logical 0 only when both newly assigned inputs are 0. De Morgan's laws explain this dual relationship.
Key Takeaways
- Shapes and rectangular labels describe the same Boolean functions.
- A terminal bubble complements the signal at that terminal.
- For more than two inputs, exactly-one and odd parity are different functions.
- A junction dot connects wires; an unmarked crossing does not.
- Positive logic assigns high to 1; negative logic assigns high to 0.
4.2 Translate between expressions and gate circuits
Expressions, truth tables, and circuits are three descriptions of the same function. Moving between them becomes manageable when each gate output gets its own expression or table column.
Build a circuit from an expression
For , first invert . Feed and into an AND, then feed that result and into an OR. The product is built before the final sum. Building the OR first would implement a different grouping.
An expression with parentheses makes an internal group explicit. For , the OR output feeds an AND with . An input already available elsewhere in the circuit may branch to several gates; it does not need a fresh variable name.
Derive an expression from connected gates
Suppose a NAND takes and , an OR takes and , and an AND combines their outputs. Label the first two outputs:
The final gate gives . Preserve the NAND's output complement over its whole product. Writing instead would describe an AND with inverted inputs.
Now simplify:
The product disappears during expansion. Consensus removes , leaving .
Evaluate every wire
For order , the circuit's outputs in rows 0 through 7 are 0, 1, 1, 1, 0, 1, 0, 0. For example, at 101 the NAND is 1, the OR is 1, and the final AND is 1. At 110 the NAND is 0, so the final AND is 0 even though the OR is 1.
The simplified expression selects rows 2 and 3 through , and rows 1 and 5 through . It therefore produces the same output column. Labeling intermediate wires lets you locate a mismatch before checking the entire circuit again.
Compare implementation costs
State what you count. Excluding input inverters, needs two gates and four gate-input terminals: two on the AND and two on the OR. Its longest path has two main gate levels. An inverter on is an additional physical gate.
For the majority function, canonical SOP uses four three-input ANDs and one four-input OR: five main gates and inputs. The simplified form uses three two-input ANDs and one three-input OR: four gates and inputs. Both have two main levels when complemented inputs are available.
Factoring can save more. uses four gates and nine inputs. The equivalent uses one three-input OR and one two-input AND: two gates and five inputs. In larger expressions, factoring can create extra levels, so fewer gates need not mean a shorter signal path.
A few matching rows do not establish that different circuits implement the same function. A valid algebraic derivation or matching complete truth tables does. A single differing row is enough to show that a proposed replacement changes the behavior.
Key Takeaways
- Build expressions in their operation order and label intermediate gate outputs.
- Preserve every inversion bubble when deriving an expression.
- Count gate-input terminals separately from the number of gates.
- Levels measure the longest gate path under the stated inverter convention.
- Simplifying or factoring can save gates while preserving the truth table.
4.3 Build any function from NAND or NOR gates
A universal gate type can build any Boolean function. NAND and NOR each meet that requirement because each can reproduce NOT, AND, and OR.
Build the basic operations from NAND
Tie both inputs of one NAND to :
This makes an inverter. To build AND, feed and into a NAND, then invert its output with another tied-input NAND. The result is , using two gates.
For OR, invert both inputs with two NANDs and feed those results into a third NAND:
De Morgan's law justifies the result. Three gates implement OR when only the original input polarities are available.
Build the basic operations from NOR
A tied-input NOR also makes an inverter: . A NOR followed by a NOR inverter gives OR, using two gates. To make AND, invert both inputs and NOR the results:
Every Boolean function has a canonical sum-of-minterms expression. Once a gate type can build NOT, AND, and OR, it can build that expression and hence any function. AND and OR alone, without complements or a supplied inverted signal, cannot produce NOT. With all inputs 0, every gate in such a circuit outputs 0, while NOT must output 1 for input 0.
In common integrated-circuit technology, NAND and NOR are smaller and faster than corresponding AND and OR implementations, which usually add an inverter after a NAND or NOR. This makes NAND and NOR useful building blocks.
Convert SOP directly to NAND-NAND
For , use one NAND for each product and feed both outputs into a final NAND:
The final NAND acts as an OR of the original products. In the bubble view, redraw it as an OR with inverted inputs. Each input bubble meets a first-level output bubble; two successive inversions cancel.
A single-literal branch also needs the proper polarity. For :
- A tied-input NAND produces .
- A NAND produces .
- A tied-input NAND produces .
- The final NAND combines the last two branch outputs.
Leaving uninverted at the final NAND would produce , changing the function.
Convert POS directly to NOR-NOR
The dual structure is
Use NOR gates for the sum terms and a final NOR. Replacing this POS structure by NAND-NAND gates would implement an SOP of the corresponding products instead.
Follow a four-NAND XOR
Let , , and . The final NAND gives . At 10, the internal outputs are , , , so . At 11, makes both middle outputs 1, so . The complete output column is 0, 1, 1, 0: XOR. The first NAND output branches to both middle gates, so this construction needs four NANDs, not a separate copy for each branch.
Key Takeaways
- NAND and NOR are each universal because each can build NOT, AND, and OR.
- Tying a NAND’s or NOR’s inputs together produces an inverter.
- Two-level SOP maps directly to NAND-NAND; POS maps directly to NOR-NOR.
- Single-literal branches need inversion before the final universal gate.
- Two bubbles in series cancel without changing the signal.
- Four NANDs can implement a two-input XOR with a shared intermediate output.
Boolean Algebra and Logic Gates examples
1From input bits to a complete output column
13 steps
- 1IntroductionDescribe a decision with bits
A small logic circuit can combine several yes/no conditions into one output. Assign 1 to a true condition and 0 to a false one.
We will evaluate expressions, record every input case, and then use a derived operation to check a group of bits. The same output can be described in words, by an expression, or by a complete truth table.
- 2ExplanationRead the operators before calculating
AND requires all inputs to be 1: write . OR requires at least one input to be 1: write . NOT reverses a value: write .
Boolean OR includes the case where both inputs are 1, so . Keep that meaning separate from binary arithmetic, where adding two 1s produces a sum bit and a carry.
- 3ExampleFind the complemented input first
Let and take , , . First find . Then form the product .
Finally OR with to get . Writing those intermediate results prevents the last OR from being evaluated before the product.
- 4ChallengeCheck what the bar covers
At and , evaluate and . Do they match?
---reveal---
The product , so . Separately inverted inputs give . They differ because the first expression complements the result of AND, while the second performs AND after complementing its inputs.
- 5ExplanationMake room for every input case
Three Boolean inputs give combinations. In order , count 000, 001, 010, 011, 100, 101, 110, 111.
The first variable is the most significant bit, so row 5 means 101. Intermediate output columns will use these same eight rows; changing the input order halfway through would change their meaning.
- 6ExampleFill the product column
Keep . The product requires and ; is free to take either value.
The product is therefore 1 at 100 and 101, which are rows 4 and 5. Every other row makes at least one product input 0. Its column, from row 0 through row 7, is 0, 0, 0, 0, 1, 1, 0, 0.
- 7ExampleAdd the final OR column
The input is 1 at rows 1, 3, 5, and 7. OR combines those rows with product rows 4 and 5, giving 1-rows 1, 3, 4, 5, and 7.
Row 5 appears in both branches but is counted once; Boolean OR stays 1 when both branches are 1. The final output column is 0, 1, 0, 1, 1, 1, 0, 1.
- 8ChallengeFind a row that separates two functions
Compare with . Find an input row where they differ.
---reveal---
At , , , the first gives and the second gives . One differing row establishes that the functions are different. If a few chosen rows had matched, that would leave the other rows unresolved; a truth-table proof of equivalence requires all eight.
- 9ExplanationRecognize equality and difference
For two bits, XOR gives 1 when they differ: . XNOR gives 1 when they match.
NAND and NOR instead complement AND and OR. In row 11, the outputs are NAND 0, NOR 0, XOR 0, and XNOR 1. That row separates XOR from ordinary OR, which would give 1.
- 10ExampleChoose an even-parity bit
The data 1011 contains three 1s. Its XOR is 1, so append a parity bit of 1 to make the total even. The transmitted group 10111 contains four 1s and has combined XOR 0.
Every single flipped bit reverses that XOR. The receiver can use a result of 1 to detect that the even-parity condition has failed.
- 11ChallengeTest the limit of parity
A valid even-parity message has two bits flipped during transmission. What happens to its combined XOR?
---reveal---
Each flip reverses the XOR, so two flips return it to its original value of 0. The message can be changed while the parity test still passes. A parity bit detects a single flipped bit, but it does not identify the changed position or detect all multi-bit errors.
- 12ChallengeDistinguish one gate from a cascade
At , compare a three-input NAND with a NAND of feeding a second NAND with .
---reveal---
The three-input gate gives . In the cascade, the first NAND gives 0 and the second gives . The table row reveals the effect of the intermediate inversion. NAND is not associative, so simply chaining it does not extend AND in the same way.
- 13RecapUse the right check for the task
When evaluating a row, keep complements and operation order visible. When comparing whole functions, use all input rows or a valid algebraic argument.
XOR supports parity because each 1 reverses the running value; NAND and NOR include inversions that prevent simple associative cascades. These distinctions will guide both algebraic rewriting and the interpretation of circuit symbols.
2Rewrite expressions without changing their outputs
18 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionGive each equality a reason
- 2ExplanationRecognize identities and dominant values
- 3ExampleUse both distributive laws
- 4ChallengeForm a dual without complementing literals
- 5ExplanationRemove a branch already covered
- 6ExampleCombine opposite forms of one literal
- 7ExampleFind the consensus term
- 8ChallengeRetain the independent condition
- 9ExplanationMove a complement through a group
- 10ExampleComplement the outer operation first
- 11ExampleHandle the remaining product complement
- 12ChallengeComplement two product branches
- 13ExamplePrepare a term for two combinations
- 14ExampleCombine each pair and count literals
- 15ChallengeVerify the covered rows
- 16ChallengeConnect complements with simplification
- 17TipKnow what a reduction establishes
- 18RecapChoose a law that fits the structure
3Turn truth-table rows into useful expressions
14 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionGive each row its own expression
- 2ExplanationBuild a minterm from a matching row
- 3ExampleBuild a maxterm from the same row
- 4ChallengeRead a different row in both forms
- 5ExplanationJoin the selected rows
- 6ExampleRead the two lists from one function
- 7ExampleIntroduce a missing variable
- 8Key InsightCount overlap only once
- 9ChallengeSeparate conversion from complementation
- 10ExplanationAllow terms to omit variables
- 11ExampleConvert a mixed expression
- 12ChallengeCompare two-level implementations
- 13ChallengeChoose a short canonical starting point
- 14RecapKeep the row meaning attached to each form
4Read, check, and rebuild a logic circuit
17 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionTrace one operation at a time
- 2ExplanationRead shapes and labels together
- 3TipNotice every terminal bubble
- 4ChallengePredict a rectangular gate’s result
- 5ConnectionSeparate physical levels from logic assignments
- 6ExampleLabel the two first-stage outputs
- 7ExampleExpand the circuit expression
- 8ExampleRemove the consensus and check coverage
- 9ChallengeCount terminals as well as gates
- 10ExplanationEstablish a gate type’s universality
- 11ExampleConvert products to NAND outputs
- 12Key InsightRead cancellation at the connection
- 13ChallengeHandle a direct literal branch
- 14ExampleUse the dual route for a POS
- 15ExampleShare one intermediate output in XOR
- 16ChallengeRead a symbol and rebuild the function
- 17RecapMatch structure to function
Boolean Algebra and Logic Gates practice questions
Set 1: Simplify expressions and build gate networks10 Practice Questions
Question 1 of 10
Show answerHide answer
Question 2 of 10
Show answerHide answer
Question 3 of 10
Show answerHide answer
Question 4 of 10
Show answerHide answer
Question 5 of 10
Show answerHide answer
Question 6 of 10
Show answerHide answer
Question 7 of 10
Show answerHide answer
Question 8 of 10
Show answerHide answer
Question 9 of 10
Show answerHide answer
Question 10 of 10
Show answerHide answer
Set 2: Read functions and check their behavior10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 3: Connect tables, algebra, and implementation10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 4: Diagnose errors and transfer the methods10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Stuck on your own question? Homework Help
Key Terms
A
Absorption
Algebraic simplification
AND
AND-OR circuit
Associativity
B
Boolean function
Boolean variable
Bubble cancellation
Bubbled-input equivalent
Buffer
C
Canonical expansion
Canonical POS
Canonical SOP
Closure
Combining theorem
Complement
Consensus term
D
De Morgan’s laws
Duality
E
Equivalence
F
Factoring
Fan-out
Function complement
G
Gate count
Gate level
Gate-input count
Group complement
I
Idempotence
Identity element
Inversion bubble
Involution
L
Literal
Literal count
Logic gate
M
Maxterm
Minimal expression
Minterm
Multilevel circuit
N
NAND
NAND-NAND circuit
Negative logic
NOR
NOR-NOR circuit
O
OR
P
Parity
Parity bit
Perfect induction
Positive logic
Postulate
Product of sums
Product term
Product-of-maxterms notation
R
Redundant-literal theorem
Row index
S
Standard binary order
Sum of products
Sum term
Sum-of-minterms notation
T
Tied inputs
Truth table
Two-level circuit
U
Universal gate
V
Variable order
X
XNOR
XOR
- 1Boolean Algebra and Logic Gates
- 2Gate-Level Minimization
- 3Combinational Logic Circuits
- 4Synchronous Sequential Logic
- 5Registers and Counters
- 6Memory and Programmable Logic
- 7HDL and RTL Design
About this lesson
Make your own Study Materials
Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.