UNIHIVE

Study Hub UNIPORT CSC 180.1

CSC 180.1 · Introduction to Computer Science and BASIC Programming

Boolean algebra and logic gates

Logic values, AND, OR and NOT, truth tables, the laws of Boolean algebra, De Morgan's laws and simple circuits.

Our notes

2 min read

Logic values

Boolean algebra (George Boole, 1854) works with two values: 1 (true) and 0 (false). It describes computer circuits.

Basic operations

ABA AND B (A·B)A OR B (A+B)NOT A (A′)
00001
01011
10010
11110

Other gates

  • NAND = NOT (A AND B): 0 only when both are 1.
  • NOR = NOT (A OR B): 1 only when both are 0.
  • XOR (exclusive OR, A ⊕ B): 1 when the inputs differ.
  • XNOR: 1 when the inputs are the same.

NAND and NOR are universal gates: any circuit can be built from either alone.

Laws

LawAND formOR form
IdentityA·1 = AA+0 = A
NullA·0 = 0A+1 = 1
IdempotentA·A = AA+A = A
ComplementA·A′ = 0A+A′ = 1
CommutativeA·B = B·AA+B = B+A
DistributiveA·(B+C) = A·B + A·CA + B·C = (A+B)·(A+C)
AbsorptionA·(A+B) = AA + A·B = A
De Morgan(A·B)′ = A′ + B′(A+B)′ = A′·B′

Also double negation: (A′)′ = A.

Simplification example

Simplify X = A·B + A·B′.
X = A·(B + B′) (distributive) = A·1 (complement) = A.
Check with a truth table: when A = 1, one of the two terms is 1; when A = 0 both are 0 ✓.

Writing an expression from a truth table

Take each row where the output is 1, write the AND of the inputs (complementing those that are 0), then OR the terms (sum of products). For XOR: output 1 at (0,1) and (1,0), so A ⊕ B = A′·B + A·B′.

A useful circuit: the half adder

Adds two bits: Sum = A ⊕ B, Carry = A·B. Check: 1 + 1 gives Sum 0, Carry 1 (binary 10) ✓. Two half adders and an OR gate make a full adder.

Exams usually ask

  • Draw the symbols and truth tables of the gates.
  • State and prove (by truth table) De Morgan's laws.
  • Simplify Boolean expressions and draw the circuit.

Common mistake

Writing (A·B)′ = A′·B′. De Morgan's law changes the operation: (A·B)′ = A′ + B′.

Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.

Read

Watch

We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.

All CSC 180.1 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.