Modular arithmetic — definition, addition, multiplication, congruence
2.5.6· Maths › Number Theory (Intermediate)
Overview
Modular arithmetic ek aisi arithmetic hai jo ek certain value tak pahunchne ke baad "wrap around" karti hai — us value ko modulus kehte hain. Yeh clock arithmetic, cyclic patterns, cryptography, aur computer science hash functions ki mathematical foundation hai.

Core Concepts
Numbers ko infinite extend karne ki jagah, hum unhe unke remainder ke basis pe equivalence classes mein partition karte hain — jab unhe ek fixed number (modulus) se divide kiya jaata hai. Isse hum:
- Bade numbers ke calculations simplify kar sakte hain (cryptography mein yahi hota hai!)
- Divisibility mein patterns dhundh sakte hain
- Cyclic structures ke saath kaam kar sakte hain (week ke din, mahine, rotations)
Key insight: Modular arithmetic mein do numbers "same" hote hain agar woh modulus se divide karne par same remainder dete hain.
Equivalent definition: agar aur sirf agar aur , se divide karne par same remainder dete hain.
Iska matlab kya hai? aur ka difference ka ek multiple hai. Jab hum integers ko remainder ke basis pe groups mein divide karte hain, toh woh dono same "bucket" mein hote hain.
First Principles se:
1. Addition: Agar aur , toh:
Kyun?
- Hum jaante hain aur kisi integers ke liye
- Inhe add karo:
- Rearrange karo:
- Kyunki ek integer hai,
2. Multiplication: Agar aur , toh:
Kyun?
- Hamare paas hai aur
- Multiply karo:
- Expand karo:
- Factor karo:
- Therefore: , toh
3. Power Rule: Agar , toh:
Kyun? Multiplication rule ko baar repeatedly apply karo.
Solution:
- Method 1 (Difference): . Kyunki difference 5 ka multiple hai, haan.
- Method 2 (Remainder): (remainder 3), (remainder 3). Same remainder, haan.
Yeh kyun important hai: Dono numbers mod 5 mein "remainder 3" equivalence class mein hain.
Solution:
-
Step 1: Pehle har number ko reduce karo
- , toh
- , toh
- Yeh step kyun? Chhote numbers ke saath kaam karna aasaan hai, aur hum operate karne se pehle reduce kar sakte hain.
-
Step 2: Reduced numbers ko add karo
- Yeh step kyun? Addition rule se,
-
Step 3: Result
- , toh already standard form mein hai
- Yeh step kyun? Hum answer ko range mein chahte hain.
Answer:
Verification: . Remainder 5 hai. ✓
Solution:
-
Step 1: Har factor ko reduce karo
- , toh
- , toh
- Yeh step kyun? Chhote numbers ke saath kaam karne se overflow nahi hota aur calculation simplify ho jaati hai.
-
Step 2: Reduced numbers ko multiply karo
- Yeh step kyun? Multiplication rule se,
-
Step 3: Result ko reduce karo
- , toh
- Yeh step kyun? Final answer standard form mein hona chahiye.
Answer:
Verification: . Remainder 4 hai. ✓
Solution:
-
Step 1: Base ko reduce karo
- , toh
- Yeh step kyun? Agar base kisi simple cheez mein reduce ho jaaye, toh power trivial ban jaati hai.
-
Step 2: Power rule apply karo
- Yeh step kyun? Power rule se, congruence exponentiation ke under preserved rehti hai.
-
Step 3: Evaluate karo
- Yeh step kyun? 1 ki koi bhi power 1 hoti hai.
Answer:
Key insight: Base ko pehle reduce karna impossible-lagti calculations ko trivial bana sakta hai!
Kyun sahi lagta hai: Yeh actually kaam karta hai! Lekin bade numbers ke liye (jaise ), pehle poora sum calculate karna overflow ya unnecessary complexity cause kar sakta hai.
Fix: Pehle har operand ko reduce karo, phir operate karo. Yeh addition/multiplication rules ke zariye hamesha valid hai, aur zyada efficient hai.
Steel-man: "Calculate then reduce" approach mathematically correct hai, bas computationally inefficient hai. Modular arithmetic rules isliye exist karte hain taaki hum calculation ke dauran reduce kar sakein.
Kyun sahi lagta hai: Regular arithmetic mein hum dono sides ko same number se divide kar sakte hain.
Fix: Modular arithmetic mein division hamesha defined nahi hoti. Tum sirf se tabhi divide kar sakte ho jab ho (yaani aur coprime hain). Yahan , toh hum 6 se divide nahi kar sakte.
Sahi approach:
- Notice karo ki , jo 6 aur 9 dono ko divide karta hai
- Simplify karo: ban jaata hai
- Ab solve kar sakte hain: dono sides ko 2 ke modular inverse se multiply karo mod 5
Steel-man: Regular algebra ka intuition powerful hai, lekin modular arithmetic ke rules alag hain. Division valid hai ya nahi, yeh check karne ke liye hamesha gcd check karo.
Kyun sahi lagta hai: Programming mein, kuch languages negative remainders return karti hain.
Fix: Mathematics mein, hum hamesha result mein chahte hain. Negative numbers ko convert karo:
General rule: Agar tumhe negative result mile, tab tak ke multiples add karo jab tak na aa jaaye: jahan aisa choose karo ki result non-negative ho.
Recall Ek 12-saal ke bachche ko explain karo
Imagine karo tumhare paas ek circular track hai jisme 12 positions hain, 0 se 11 tak numbered (jaise clock face). Tum position 0 se start karte ho. Agar tum 5 steps forward lo, tum position 5 par ho. Agar tum 8 aur steps lo, tum 13 par hoge... lekin ruko, position 13 toh hai hi nahi! Tum wrap around karte ho: position 11 ke baad position 0 aata hai. Toh 13 wahi hai jahan position 1 hai (kyunki 13 - 12 = 1).
Yahi modular arithmetic hai! "12" ko modulus kehte hain — yahi woh point hai jahan tum wrap around karte ho. Do positions "same" hain agar woh circle par same spot hain.
Jab hum likhte hain, hum keh rahe hain "13 aur 1 ek 12-ghante ki clock par same position hain."
Cool part yeh hai: tum is circular track par add aur multiply kar sakte ho, aur sab kuch kaam karta hai! Agar tum position 5 par ho aur ek dost position 8 par hai, toh saath mein tum steps gaye, jo position 1 hai. Agar tum track par 5 baar jaate ho, har baar 8 steps lete hue, toh tum total steps lete ho, jo tumhe position 4 par land karta hai (kyunki ).
Reminder: ka matlab hai " aur ek -ghante ki clock par same time dikhate hain."
Properties of Congruence
Congruence modulo ek equivalence relation hai, yaani:
- Reflexive: (har number apne aap se congruent hai)
- Symmetric: Agar , toh
- Transitive: Agar aur , toh
Yeh kyun important hai: Yeh properties matlab hai ki congruence integers ko distinct equivalence classes mein partition karti hai (jinhein residue classes kehte hain). Har integer exactly ek class mein belong karta hai.
Modulus ke liye, exactly residue classes hoti hain: .
The Residue Classes
Modulus 5 ke liye, residue classes hain:
Har integer exactly inhi classes mein se ek mein hai. Hum likhte hain residue classes mod 5 ke set ke liye.
Connections
- Division Algorithm — remainders ki foundation
- GCD and LCM — determine karta hai kab modular division possible hai
- Fermats Little Theorem — modular exponentiation use karta hai
- Eulers Theorem — modular arithmetic use karke Fermat's theorem ko generalize karta hai
- Chinese Remainder Theorem — congruences ke systems solve karta hai
- Modular Inverses — modular arithmetic mein division
- RSA Cryptography — poori tarah bade primes ke saath modular arithmetic par built hai
- Linear Congruences — solve karna
- Quadratic Residues — kaun se numbers mod perfect squares hain
Practice Problems
- Verify karo ki dono definitions use karke
- compute karo pehle reduce karke
- efficiently find karo
- calculate karo (hint: pehle base reduce karo!)
- Prove karo ki agar , toh
- Saare find karo jaise ki
#flashcards/maths
What is the definition of congruence modulo n? :: Do integers aur congruent modulo hote hain (likha jaata hai ) agar unka difference ka multiple ho, yaani kisi integer ke liye.
What is the equivalent definition of congruence using remainders?
State the addition rule in modular arithmetic :: Agar aur , toh .
State the multiplication rule in modular arithmetic
Why can we reduce numbers before operating in modular arithmetic? :: Kyunki addition aur multiplication rules guarantee karte hain ki , aur similarly multiplication ke liye bhi. Isse calculations zyada efficient ho jaati hain.
What is the danger with division in modular arithmetic?
How do you handle negative numbers in modular arithmetic? :: Modulus ke multiples add karo jab tak result range mein na aa jaaye. For example, kyunki .
What are the three properties that make congruence an equivalence relation?
How many residue classes exist for modulus n?
What is the clock face analogy for modular arithmetic? :: Modular arithmetic ek clock ki tarah kaam karta hai: modulus value reach karne ke baad, 0 par wrap around ho jaata hai. Mod 12 ke liye, 11 ke baad 0 aata hai. Do numbers congruent hain agar woh clock par same position point karte hain.