4.5.41 · D2 · HinglishLinear Algebra (Full)

Visual walkthroughLeast squares — normal equations, QR approach

2,653 words12 min read↑ Read in English

4.5.41 · D2 · Maths › Linear Algebra (Full) › Least squares — normal equations, QR approach


Step 1 — Vo vectors jo hamare paas hain

KYA. Humare paas kuch "measurements" hain jo ek lambi list of numbers mein stack ki gayi hain, aur ek machine jo unknown dials ko ek prediction mein badalta hai.

  • Ek vector bas ek arrow hai: numbers ki ek list jo kisi direction mein point bhi karta hai. ek point hai -dimensional space mein.
  • ek matrix hai: numbers ki ek rectangular grid jisme rows aur columns hain, likha jaata hai . "Tall" matlab unknowns (columns) se zyada equations (rows).
  • wo unknowns hain — wo dials jo hum twist kar sakte hain.

KYUN. Hum chahte hain exactly. Lekin jab equations dials se zyada hon, target aksar hit nahi ho sakta. Isliye "as close as possible" define karna zaroori hai chase karne se pehle.

PICTURE. Figure mein, (plum) space mein float kar raha hai. Jab hum dials twist karte hain, (orange) ki tip sirf ek flat sheet tak pahunch sakti hai — ko kabhi nahi chhoo sakti.

Figure — Least squares — normal equations, QR approach

Step 2 — actually kahan ja sakta hai? (column space)

KYA. ko uske columns mein split karo (har column khud -space mein ek arrow hai). Tab Yahan har term ek column-arrow ko ek dial number se scale karta hai aur unhe add karta hai. Dials twist karna columns ke saare possible mixtures ko sweep out karta hai.

  • Saare mixtures ka woh set column space hai — dekho Column Space and Rank. Yeh origin se guzarta hua ek flat sheet (ek subspace) hai.

KYUN. Chahe kuch bhi karein, isi sheet ke andar rehta hai. Isliye " ke sabse kareeb pahunchne wala point" matlab "sheet ka ke sabse kareeb point." Yeh ek algebra problem ko geometry problem mein badal deta hai.

PICTURE. Do columns (teal) aur (orange) ek tilted plane span karte hain. Har reachable prediction us plane par koi dot hai; uske upar hover kar raha hai.

Figure — Least squares — normal equations, QR approach

Step 3 — "Closest" matlab sabse chhota arrow — kaise measure karein?

KYA. Target aur prediction ke beech ka gap residual hai: Iski length Euclidean norm hai Square root ke andar har miss ko square kiya jaata hai (taaki signs cancel na ho sakein) aur sum kiya jaata hai — yeh bas Pythagoras hai dimensions mein.

Length ki jagah length square kyun minimise karein? Hum minimise karenge (square root chhod denge). YEH LEGAL AUR ACHHA KYUN HAI? Kyunki entries mein ek plain polynomial hai — ek smooth, gently curved bowl jiska minimum hum clean linear algebra se nikal sakte hain, bina koi square root uthaye. Aur kyunki squaring lengths par ek increasing function hai (), jo wahi length ko smallest banata hai woh uske square ko bhi smallest banata hai — square minimise karne se hum kuch nahi kho rahe.

PICTURE. Dekho residual arrow (plum) shrink aur swing karta hai jaise prediction dot plane par slide karta hai. Ek position hai jahan woh sabse chhota hai.

Figure — Least squares — normal equations, QR approach

Step 4 — Sabse chhota arrow wahi hai jo perpendicular ho

KYA. Claim: residual tab sabse chhota hota hai jab woh plane par perpendicular khada ho. Yeh Orthogonal Projection ke peeche ka key geometric fact hai.

KYUN. Suppose residual thoda sa bhi plane ke along jhuk jaaye. Tab woh jhukaa hua component ek aisi direction mein point karta hai jo hum actually reach kar sakte hain (woh ke andar hai). Prediction dot ko us direction mein thoda sa slide karo aur miss chhoti ho jaati hai — matlab hum minimum par nahi the. Ek hi arrow hai jise tum plane ke andar slide karke chhota nahi kar sakte — woh jo plane mein zero component rakhta hai — yaani seedha upar, perpendicular.

PICTURE. Do candidate residuals: ek tilted wala (abhi bhi chhota ho sakta hai, orange dashes) aur perpendicular winner (plum). Right-angle mark dikhata hai ki winner plane se par mil raha hai.

Figure — Least squares — normal equations, QR approach

Step 5 — "Perpendicular" ko equations mein badalna

KYA. "Plane ke perpendicular" matlab har spanning column ke perpendicular. Do arrows perpendicular hote hain jab unka dot product zero ho — dot product measure karta hai ki woh kitna line up karte hain; zero matlab bilkul line up nahi karte.

KYUN. Ek plane apne spanning arrows se completely pin down hota hai. Agar har column ke perpendicular hai, toh woh unke har mixture ke bhi perpendicular hai — poore plane ke. Isliye chhoti equations geometry ko exactly capture karti hain.

PICTURE. Residual aur dono ke saath simultaneously right angle banata hai — do right-angle marks.

Figure — Least squares — normal equations, QR approach

Step 6 — Equations stack karo: Normal Equations appear hoti hain

KYA. Saari dot-product equations ek line mein likhne ka matlab hai columns ko ki rows ke roop mein stack karna (transpose, ulta kiya hua taaki uske columns rows ban jaayein): ko subtraction par distribute karo:

Hum distribute kyun kar sakte hain? Kyunki matrix multiplication addition par distribute karta hai, — ek sum ko multiply karna waise hi hai jaise har piece ko multiply karo aur combine karo. Yahan yeh single perpendicularity statement ko "target part" aur "prediction part" mein split karne deta hai jise hum alag alag rearrange kar sakte hain. Ek term ko doosri taraf move karo:

Term by term: ek chhota square matrix hai (iska entry do columns ka dot product hai); ek chhota -vector hai (entry hai ). Humne ek tall impossible system ko ek short square solvable mein badal diya.

KYUN. Yeh ab equations hain unknowns mein — square, aur (jab columns independent hain) uniquely solvable.

PICTURE. Tall compact square mein collapse ho jaata hai; diagram shrink dikhata hai.

Figure — Least squares — normal equations, QR approach

Step 7 — QR shortcut (same answer, safer arithmetic)

KYA. banane ki jagah, factor karo (QR Factorization / Gram-Schmidt Process se), jahan ke orthonormal columns hain (, identity) aur upper triangular hai (diagonal ke neeche zeros). Normal equations mein substitute karo:

kyun cancel kar sakte hain. Full-column-rank ke thin (reduced) QR mein, matrix square hai, aur uske diagonal entries Gram–Schmidt ke dauran produce hue nonzero lengths hain — isliye aur invertible hai. Invertible matrices ka product invertible hota hai, isliye bhi invertible hai. Dono sides ko left mein multiply karna use legally hata deta hai:

Term by term: ke coordinates perfect right-angle frame mein read karta hai; ka triangular hona matlab last unknown akela nikal aata hai, phir next back-substitution se.

KYUN bother karein? Pehle, "safer" ka matlab kya hai? machine ko imagine karo jo space ko stretch karti hai: kuch directions ko bahut stretch karti hai aur kuch ko thoda. ki ek singular value aisi ek stretch factor hai — woh amount jitna ek particular unit input direction ko lengthens karta hai (sabse bada, , woh zyada se zyada hai jitna kabhi ek unit arrow ko stretch kar sakta hai; sabse chhota, , sabse kam). Condition number (dekho Condition Number) sabse badi aur sabse chhoti stretch ka ratio hai — ek single number jo measure karta hai matrix kitna rounding error amplify karta hai. Bada = touchy arithmetic. Normal equations ki dikkat yeh hai ki banana har singular value ko square kar deta hai (iske stretch factors hain), isliye : ek mildly touchy badly touchy ho jaata hai. QR kabhi nahi banata, isliye sensitivity par rehti hai — jabki identical deta hai.

PICTURE. ke messy tilted columns ke clean perpendicular axes mein seedhe ho jaate hain; square axes par project karna effortless hai.

Figure — Least squares — normal equations, QR approach

Step 8 — Har case, saaf split kiya gaya

KYA. Kuch chhootne na paaye isliye, do independent yes/no questions cross karo:

  • Independent columns? (full column rank vs rank-deficient) — decide karta hai ki invertible hai ya nahi.
  • Kya reachable hai? ( vs nahi) — decide karta hai ki sabse chhota residual exactly hai ya sirf nonzero.

Isse chaar boxes milte hain, sab covered:

reachable () unreachable ()
Independent columns Unique jo exactly solve karta hai; least squares exact solution reproduce karta hai. Unique ; healthy projection case.
Dependent columns Residual hai, lekin infinitely many ise dete hain — exact solutions ki puri flat family. Infinitely many minimisers jo saare ek hi nonzero best shadow share karte hain.

KYUN. Yeh chaar boxes mutually exclusive hain aur milke har possibility exhaust karte hain (columns independent ya nahi target reachable ya nahi), isliye koi reader aisa scenario nahi hit kar sakta jo humne skip kiya ho.

  • Zero degenerate limit (). Yeh "dependent columns" row mein baithta hai: prediction origin par stuck hai, residual bas hai, aur koi bhi ek minimiser hai. Fit karne ke liye kuch nahi.

Jab bhi koi row "infinitely many" kehti hai, sabse fair, canonical choice hai sabse chhota , jo Pseudoinverse (Moore-Penrose) deta hai.

PICTURE. Left: fat healthy plane, unique drop (independent columns). Right: collapsed thin plane, dial-settings ki puri line ek hi shadow par land karti hai (dependent columns).

Figure — Least squares — normal equations, QR approach

Ek-picture summary

Upar sab kuch ek gesture hai: ko perpendicularly reachable predictions ke plane par drop karo; us drop ka foot hai; drop-arrow residual hai.

Figure — Least squares — normal equations, QR approach

Neeche ka final schematic retelling ko ek flow mein distil karta hai: target → drop → foot → miss, with the two formulas hanging off it.

Figure — Least squares — normal equations, QR approach
Recall Feynman retelling — saara walkthrough plain words mein

Tum ek floating dot ko hit karne ki koshish kar rahe ho, lekin tumhari gun sirf ek tilted table top (column space) par fire kar sakti hai — dot uske upar hang kar rahi hai, pahunch se bahar. Isliye tum table par woh spot dhundhte ho jo dot ke sabse kareeb ho. Kaunsa spot? Dot se table tak seedha ek plumb line drop karo; jahan woh land kare woh tumhara best shot hai, aur plumb line khud miss hai (residual). "Seedha neeche" poora raaz hai: ek plumb line table ke right angles par khada hota hai, isliye uski miss un saari directions ke right angles par hai jinhe tum aim kar sakte the. "Har column ke right angles par" symbols mein likhna hai , jo tidy hokar ban jaata hai. QR wahi drop hai lekin cleaner measuring sticks ke saath (perfect right-angle axes ), isliye tumhara calculator arithmetic mein nahi fumble karta: . Aur agar table secretly sirf ek line hai (dependent columns), toh bahut saare aim-settings ek hi spot par land karte hain — tum sabse gentle wala choose karte ho.


Active Recall

Sabse chhota residual perpendicular kyun hota hai?
Residual ka koi bhi component jo plane ke andar lie karta hai, prediction ko slide karke remove kiya ja sakta hai, miss ko chhota karte hue — isliye minimum par residual ka in-plane component zero hota hai, yaani woh perpendicular hota hai.
"Residual ⊥ har column" ko ek matrix equation mein badlo.
, yaani .
ka matlab kya hai?
Woh input jo ko smallest banata hai ( ki smallest value nahi).
QR derivation mein kyun cancel kar sakte hain?
Full-rank ke thin QR mein, square hai nonzero diagonal ke saath, isliye invertible hai; toh invertible hai aur multiply karke hata sakte hain.
Singular value kya hoti hai, aur yahan kyun matter karti hai?
ka ek stretch factor; , aur banana har ko square kar deta hai, isliye .
Jab ke columns dependent hon toh kya hota hai?
singular ho jaata hai; infinitely many residual minimize karte hain, aur minimum-norm wala pseudoinverse se aata hai.