3.1.4Boolean Algebra & Logic Gates

Boolean variables and operations (AND, OR, NOT)

1,946 words9 min readdifficulty · medium

What is a Boolean variable?

WHAT we are studying: three fundamental operations —

  • NOT (¬, overbar, !) — takes 1 input.
  • AND (∧, ·, &) — takes 2+ inputs.
  • OR (∨, +, |) — takes 2+ inputs.

WHY only three? Because these three are functionally complete: any logic function whatsoever can be written using only NOT, AND, OR. Everything else (NAND, XOR…) is just shorthand built from these.


Deriving each operation from meaning (not memorising)

NOT — "the opposite"

HOW we build its truth table — a Boolean variable has only 2 values, so we only need 2 rows:

AA A\overline{A}
0 1
1 0

AND — "all must be true"

HOW we build the table — 2 inputs ⇒ 22=42^2 = 4 rows:

AA BB ABA \cdot B
0 0 0
0 1 0
1 0 0
1 1 1

OR — "at least one is true"

AA BB A+BA + B
0 0 0
0 1 1
1 0 1
1 1 1
Figure — Boolean variables and operations (AND, OR, NOT)

Order of operations (precedence)

So A+BC\overline{A} + B \cdot C means (A)+(BC)(\overline{A}) + (B \cdot C).


Worked Examples


Common Mistakes (Steel-manned)


Active Recall

Recall Quiz yourself (click to reveal)
  • How many values can a Boolean variable take? → Two: 0 and 1
  • AND of 11 and 00? → 0
  • OR of 11 and 00? → 1
  • 0\overline{0}? → 1
  • Precedence order? → NOT, then AND, then OR
  • Why is OR not plain addition? → ==because 1+11+1 must stay =1=1, it saturates==
Recall Feynman: explain to a 12-year-old

Imagine light switches. NOT is a naughty switch that always does the opposite of what you press. AND is a strict teacher: you get a sticker only if you did homework AND cleaned your room — miss one, no sticker. OR is a kind grandma: she gives you ice cream if it's hot OR if you're happy — either reason works. That's all a computer really does, millions of times a second, super fast.


Flashcards

How many values can a Boolean variable hold?
Exactly two: 0 or 1 (false/true).
What are the three fundamental Boolean operations?
NOT (1 input), AND, OR (2+ inputs).
Truth-table result of AND when inputs are 1 and 0?
0 (AND needs all inputs = 1).
Truth-table result of OR when inputs are 1 and 0?
1 (OR needs at least one input = 1).
What is A\overline{A} when A=1A=1?
0 (NOT flips the value).
Why is Boolean OR written with + but not ordinary addition?
Because it saturates: 1+1 = 1, staying within {0,1}.
Formula for AND using arithmetic on 0/1 values?
AB=A×BA\cdot B = A \times B (any zero factor gives 0).
Formula for OR that keeps output in {0,1}?
A+B=A+BAB=max(A,B)A+B = A + B - A\cdot B = \max(A,B).
Precedence order of Boolean operators?
NOT first, then AND, then OR.
How many rows in a truth table with n Boolean inputs?
2n2^n rows.
Why are AND, OR, NOT special together?
They are functionally complete — every logic function can be built from them.
Correct simplification of A+B\overline{A+B}?
AB\overline{A}\cdot\overline{B} (De Morgan), NOT A+B\overline{A}+\overline{B}.

Connections

Concept Map

motivates

acted on by

includes

includes

includes

formula 1 minus A

formula min or product

formula max

builds

combined via

Boolean variable 0 or 1

Physical wire voltage or none

Boolean operations

NOT flips value

AND all inputs 1

OR at least one 1

Functionally complete

NAND XOR etc

Precedence NOT then AND then OR

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Boolean algebra ka core idea simple hai: yahan har variable sirf do value le sakta hai — 0 ya 1, matlab OFF ya ON. Computer ke andar ek wire par ya to voltage hai ya nahi, beech ka kuch nahi hota. Isliye humein aisa maths chahiye jo sirf "haan/na" samjhe, aur wahi Boolean algebra hai.

Teen basic operations yaad rakho. NOT matlab ulta kar do — 1 ko 0, 0 ko 1. AND bahut strict hai: output tabhi 1 milega jab saare inputs 1 hon (jaise ATM: card bhi ho AND PIN bhi sahi ho). OR thoda generous hai: koi ek bhi input 1 ho to output 1 (jaise chhata chahiye agar baarish OR barf ho). AND ko multiply (.) aur OR ko plus (+) se likhte hain, par dhyaan rakho — OR mein 1+1 = 1 hota hai, 2 nahi, kyunki value {0,1} ke bahar nahi ja sakti.

Precedence bhi normal maths jaisa hi hai: pehle NOT, phir AND, phir OR. Confusion ho to brackets laga do. Sabse common galti yehi hoti hai ki log 1+1=2 likh dete hain ya NOT(A+B) ko galat todte hain — asli rule De Morgan hai: A+B=AB\overline{A+B} = \overline{A}\cdot\overline{B}.

Yeh chhoti si cheez matter kyun karti hai? Kyunki inhi teen operations se hi processor, memory, calculator, sab kuch banta hai. Jab tumhe ye teen truth tables mooh-zabani yaad ho jaayen, to aage ke logic gates, circuits, sab aasan lagenge. 80/20 rule: bas teen tables + precedence + De Morgan pakad lo, aadha chapter clear.

Go deeper — visual, from zero

Test yourself — Boolean Algebra & Logic Gates

Connections