1.1.2 · AI-ML › Linear Algebra Essentials
Intuition The Big Picture
Ek vector ek list of numbers hai jiska ek geometric meaning bhi hota hai: ek arrow jo origin se kisi location ki taraf point karta hai, jisme direction aur magnitude dono hote hain. Do operations is duniya par raaj karti hain:
Addition = arrows ko tip-to-tail rakhna (ek displacement chalna, phir doosra).
Scalar multiplication = ek arrow ko stretch/shrink/flip karna.
AI-ML mein WHY matter karta hai: Har data point (ek image, ek word embedding, features ki ek row) ek vector hai. Neural networks sirf weighted sums hain — baar baar scalar multiplication aur vector addition. Agar ye do operations apni hain, toh linear algebra ka core apna hai.
R n mein ek vector ek ordered tuple v = ( v 1 , v 2 , … , v n ) hota hai. Hum ise column ki tarah likhte hain:
v = v 1 v 2 ⋮ v n
Geometrically yeh origin se point ( v 1 , … , v n ) tak ka arrow from the origin hota hai. Iska magnitude (length) ∥ v ∥ = v 1 2 + ⋯ + v n 2 hota hai.
Column kyun? Kyunki matrix–vector multiplication (baad ke chapters mein) aise define ki gayi hai ki ek matrix left se column par act karta hai. Abhi consistency rakhne se baad mein takleef nahi hogi.
Definition Vector Addition
u , v ∈ R n ke liye, component-by-component add karo:
u + v = u 1 + v 1 ⋮ u n + v n
Ek vector ek displacement represent karta hai. Agar u mujhe origin O se point A tak le jaata hai, aur v ek aur displacement hai, toh unhe add karne ke liye main A se v ke saath aage badhta hun, aur B par pahunchta hun.
Poore safar ka x -displacement = (u ka x-move) + (v ka x-move) = u 1 + v 1 .
Yahi logic har axis par lagti hai.
Isliye addition componentwise hi honi chahiye — yeh koi hat se nikali definition nahi hai, yeh "displacements har axis par independently accumulate hote hain" se forced hai.
Intuition Do geometric pictures
Tip-to-tail: v ko slide karo taaki uski tail u ki tip par baithe; sum woh arrow hai jo origin se final tip tak jaata hai.
Parallelogram: dono ko origin se draw karo; sum diagonal hai. (Same result kyunki addition commutative hai: u + v = v + u .)
Scaling ka matlab hai "same displacement c times karo." v do baar karna = v + v , jiske components 2 v 1 , … hain. Integers se reals tak continuity se extend karne par c v = ( c v 1 , … , c v n ) milta hai.
c v ki geometry
c > 1 : stretch. 0 < c < 1 : shrink. c = 0 : origin par collapse.
c < 0 : opposite direction mein flip, phir ∣ c ∣ se scale.
Definition Linear Combination
w = c 1 v 1 + c 2 v 2 + ⋯ + c k v k
ise linear combination kehte hain. Yahi expression ek neuron compute karta hai: ∑ i w i x i feature values ka ek linear combination hai (scalars ki tarah dekha jaaye) — ya weight columns ka.
Worked example Example 1 — Basic addition
u = [ 2 1 ] , v = [ − 1 3 ] . u + v nikalo.
u + v = [ 2 + ( − 1 ) 1 + 3 ] = [ 1 4 ]
Yeh step kyun? Har axis ko independently add karo — displacements x aur y mein alag-alag accumulate hote hain.
Worked example Example 2 — Scalar multiply + magnitude
Maano v = [ 3 4 ] , c = − 2 .
c v = [ − 6 − 8 ] . Length = 36 + 64 = 10 .
Check: ∣ c ∣∥ v ∥ = 2 ⋅ 9 + 16 = 2 ⋅ 5 = 10. ✓
Yeh step kyun? Formula ∥ c v ∥ = ∣ c ∣∥ v ∥ length predict karta hai bina root scratch se recompute kiye — ek fast sanity check.
Worked example Example 3 — Linear combination
2 [ 1 0 ] + 3 [ 0 1 ] = [ 2 3 ] .
Yeh step kyun? Plane mein har point axis vectors ka ek combination hai — isliye {( 1 , 0 ) , ( 0 , 1 )} ek basis hai. In dono ko scale karke aur add karke R 2 mein har jagah pahuncha ja sakta hai.
Worked example Example 4 — Forecast-then-Verify
Forecast: lo u = ( 2 , 0 ) , v = ( 0 , 2 ) . Guess: dono tips ka midpoint, toh ( 1 , 1 ) .
Verify: u + v = ( 2 , 2 ) ; uska aadha ( 1 , 1 ) hai. ✓
Why: 2 1 ( u + v ) hamesha tips ko join karne wale segment ka midpoint hota hai — ek fact jo baar baar kaam aayega (jaise embeddings average karna).
Common mistake "Magnitudes add karo toh sum ka magnitude milega."
Kyun sahi lagta hai: scalars ke liye ∣3∣ + ∣4∣ = 7 , toh zaroor ∥ u + v ∥ = ∥ u ∥ + ∥ v ∥ ?
Fix yeh hai: Yeh sirf tab true hai jab dono same direction mein point karen. Generally triangle inequality deta hai ∥ u + v ∥ ≤ ∥ u ∥ + ∥ v ∥ . Example: u = ( 3 , 0 ) , v = ( 0 , 4 ) : ∥ u + v ∥ = 5 , 7 nahi. Arrows partly cancel kar sakte hain.
− 1 se scale karne par length badal jaati hai."
Kyun sahi lagta hai: numbers negative ho gaye, toh "chhota" hona chahiye?
Fix yeh hai: ∥ − v ∥ = ∣ − 1∣∥ v ∥ = ∥ v ∥ . Sign direction flip karta hai, length nahi.
Common mistake "Alag sizes ke vectors add kar sakte hain."
Kyun sahi lagta hai: ( 1 , 2 ) + ( 3 ) mein lagta hai ki bas pad kar do.
Fix yeh hai: Addition ke liye same dimension chahiye — ek missing component ka koi x -axis partner nahi hota. Undefined operation hai yeh.
Recall Ek 12-saal ke bacche ko explain karo (reveal karne ke liye click karo)
Socho tum chal rahe ho. Ek vector ek instruction hai: "3 kadam east jao, 4 kadam north jao." Do instructions add karne ka matlab hai pehle wali walk karo, phir doosri — tum kahin pahunchte ho, aur woh final jagah sum hai. Scalar multiplication ek speed dial ki tarah hai: 2 se multiply karo = same direction mein do guni lambi walk; − 1 se multiply karo = same doori par ulta chalo. Bas itna hi hai — AI mein sab fancy cheezein sirf laakhon aisi walks ka addition hain.
Mnemonic Do rules yaad rakhne ke liye
"Add across, scale everyone."
Add across → components line up karo aur rows add karo.
Scale everyone → har component ko c se multiply karo.
Vector addition componentwise kyun honi chahiye?
∥ c v ∥ kya hai aur absolute value kyun?
∥ u + v ∥ = ∥ u ∥ + ∥ v ∥ equality ke saath kab hold karta hai?
Do vectors kaise add karte hain? Componentwise: ( u + v ) i = u i + v i ; geometrically tip-to-tail.
Vector addition componentwise kyun hai (first principles)? Har axis par displacements independently accumulate hote hain, isliye har coordinate alag add hota hai.
c v kya hai?Har component ko c se multiply karo: ( c v 1 , … , c v n ) ; arrow ko stretch/flip karta hai.
c v ki length ka formula?∥ c v ∥ = ∣ c ∣ ∥ v ∥ .
∥ c v ∥ mein c ki jagah ∣ c ∣ kyun?Length non-negative hoti hai; negative scalar direction flip karta hai lekin length ∣ c ∣ se scale hoti hai.
Vectors ke liye triangle inequality batao. ∥ u + v ∥ ≤ ∥ u ∥ + ∥ v ∥ , equality tab jab same direction ho.
Linear combination kya hota hai? c 1 v 1 + ⋯ + c k v k — vectors ka scaled sum; ek neuron ka core operation.
Do vectors add karne ke liye kya zaruri hai? Unka dimension same hona chahiye.
2 1 ( u + v ) ka geometric meaning?u aur v ki tips ko join karne wale segment ka midpoint.
Kya vector addition commutative hai? Haan: u + v = v + u (parallelogram = dono tip-to-tail orders ka same result).
Tip-to-tail and Parallelogram
Length scales by absolute c
Neural nets weighted sums