1.1.3 · HinglishHow Computers Work

Boolean algebra — AND, OR, NOT, XOR, NAND, NOR operations

1,669 words8 min readRead in English

1.1.3 · Coding › How Computers Work


KAUNSI hai har operation

YE symbols ( aur ) kyun?

Kyunki ye arithmetic ki tarah behave karte hain. multiplication jaisa kaam karta hai: . addition jaisa kaam karta hai sivaaye ke (ye saturate ho jaata hai, 1 se aage overflow nahi kar sakta). Yahi analogy poori wajah hai ise algebra kyun kehte hain.


KAISE padhein har gate ko — truth tables

Truth table har possible input combination ke liye output list karta hai. inputs ke saath rows hoti hain.

AND OR XOR NAND NOR
0 0 0 0 0 1 1
0 1 0 1 1 1 0
1 0 0 1 1 1 0
1 1 1 1 0 0 0

NOT (ek input): , .

Figure — Boolean algebra — AND, OR, NOT, XOR, NAND, NOR operations

Formulas scratch se derive karna

XOR ka formula yaad nahi karte — tum use banate ho. "Inputs kab alag hote hain?" Ya () ya (). Har English word ko algebra mein translate karo:

  • " aur "
  • " aur "
  • "ya...ya"

Ye step kyun? Truth table ki har row jahan output = 1 hota hai, ek AND-term (minterm) banta hai; hum un sab terms ko OR karte hain. Ise Sum of Products (SOP) kehte hain aur isse tum kisi bhi truth table ka formula derive kar sakte ho.


Worked examples



Recall Feynman: ek 12-saal ke bacche ko samjhao

Light switches socho. AND do switches ek line mein hain — bulb sirf tab jalta hai jab dono on hon. OR do switches side by side hain — koi ek bulb jalaa deta hai. NOT ek ulta switch hai: dabaao aur light band ho jaati hai. XOR woh hallway waali trick light hai — koi bhi switch hilao aur wo change ho jaati hai, to on sirf tab hoti hai jab switches disagree karein. NAND/NOR bas AND/OR ke "opposite-day" versions hain. Itne saare toy switches wire karo aur tumne literally computer ka brain bana liya.


Flashcards

When is A AND B equal to 1?
Sirf tab jab A aur B dono 1 hon.
When is A OR B equal to 1?
Jab kam se kam ek input 1 ho (inclusive OR; 1+1=1).
What does XOR output 1 for?
Jab do inputs alag hon (A≠B).
Formula for XOR in terms of AND/OR/NOT?
.
State De Morgan's laws.
aur .
How do you make NOT from a single NAND?
Dono inputs ek saath jodo: .
Why is NAND called a "universal" gate?
Ye akela NOT, AND, OR — aur isliye koi bhi circuit bana sakta hai.
Difference between OR and XOR at inputs 1,1?
OR 1 deta hai, XOR 0 deta hai.
What is NAND of A and B?
— pehle AND, phir NOT.
Simplify .
.
How many rows in a truth table with n inputs?
.

Connections

Concept Map

includes

includes

includes

includes

negated gives

negated gives

defines outputs of

defines outputs of

minterms build

derives formula

swaps AND and OR via

via De Morgan

Boolean algebra 0 and 1

NOT flips bit

AND both 1

OR at least one 1

XOR inputs differ

NAND

NOR

Truth tables 2^n rows

Sum of Products

De Morgan Laws