4.5.41 · D4 · HinglishLinear Algebra (Full)

ExercisesLeast squares — normal equations, QR approach

2,017 words9 min read↑ Read in English

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

Do master equations ka quick reminder jo tum baar baar use karoge:


Level 1 — Recognition

Problem 1.1

Inn systems mein se konsa zarurat hai least squares ki (exact solution guaranteed nahi), aur konsa ordinary square solve hai? Reason bhi batao.

(a) hai . (b) hai invertible. (c) hai lekin rank .

Recall Solution

Kya decide karta hai: least squares tall systems ke liye hai — unknowns se zyada equations — jahan column space mein nahi ho sakta.

  • (a) : tall (). Overdetermined → least squares use karo.
  • (b) invertible: square with an inverse → ordinary solve , exact.
  • (c) rank : square hai lekin rank-deficient (columns dependent hain). Koi unique inverse nahi; least squares phir bhi apply hota hai lekin unique nahi hoga — tum Pseudoinverse (Moore-Penrose) use karte. Toh: generalised sense mein least squares, minimum-norm solution.

Problem 1.2

Full-column-rank ke liye, bina derive kiye, normal equations aur projection matrix onto likh do.

Recall Solution

Normal equations: . Explicit solution: . Projection matrix: , jo satisfy karta hai (do baar project karna = ek baar project karna) aur (symmetric).


Level 2 — Application

Problem 2.1

Data -values ke liye best horizontal line (ek constant, koi slope nahi) fit karo. Normal equations use karke nikalo.

Recall Solution

Setup. Har point ko single constant se predict karna matlab jahan ek column of ones hai: Compute. , aur . Solve. . Matlab: best constant fit bas data ka average hai — ones ke column ke saath least squares mean hi hota hai. Yeh sabse simple Linear Regression hai.

Problem 2.2

Points ke liye fit karo. nikalo.

Recall Solution

Setup. Row kehti hai : compute karo (entries columns aur ke dot products hain): Solve . Row 1 ko karke row 2 se subtract karo: . Phir . Best line: . Figure dekho — miss-arrows line se seedha upar/neeche point karte hain.

Figure — Least squares — normal equations, QR approach

Level 3 — Analysis

Problem 3.1

Problem 2.2 ke liye, residual compute karo aur verify karo ki . Geometrically explain karo ki kya kehta hai.

Recall Solution

Predictions with : Residual : Orthogonality check karo: Dono zero hain, toh . ✓ Geometry: residual arrow ke har column ke perpendicular hai, isliye poore plane ke bhi perpendicular hai. Yahi Orthogonal Projection condition hai — us plane par ka shadow hai, aur seedha bahar jaane wala gap hai.

Problem 3.2

Condition number measure karta hai ki ek matrix input errors ko kitna amplify karta hai. Ek matrix diya hai jis mein hai, normal equations aur QR se solve karne mein error-amplification compare karo. Kisi par zyada trust karte ho aur kyun?

Recall Solution

Key fact: banane se condition number square ho jaata hai: .

  • Normal equations ek aisa system solve karte hain jahan govern karta hai.
  • QR seedha ke saath kaam karta hai, jiska conditioning se match karta hai.

Digits mein: double precision mein kareeban significant digits hote hain. digits kho dena (normal equations) matlab achhe digits bache; digits kho dena (QR) matlab bache. QR par trust karo — yeh kabhi nahi banata, isliye squaring se bachta hai. Condition Number aur QR Factorization dekho.


Level 4 — Synthesis

Problem 4.1

Problem 2.2 ko dobara solve karo, lekin is baar QR se. Columns par Gram-Schmidt Process se banao, phir solve karo. Confirm karo ki milte hain.

Recall Solution

Step 1 — pehla column normalise karo. , toh Step 2 — ka shadow ke along hatao. Overlap hai . Subtract karo: Iska length hai , toh . Step 3 — padho (construction se upper triangular): Step 4 — compute karo ke saath: Step 5 — back-substitute karo. Pehle neeche wali row: Upar wali row: , matlab , toh . Wahi answer kabhi banaya hi nahi. ✓

Problem 4.2

Algebraically show karo ki same equation hai jaise normal equations jab aur invertible ho.

Recall Solution

Normal equations se shuru karo aur substitute karo: Product ka transpose order reverse karta hai: . Toh left side hai . Kyunki ke orthonormal columns hain, (identity), jo drop ho jaata hai: invertible hai (full rank), toh bhi invertible hai; dono sides ko left mein se multiply karo: Yeh algebraically identical hain — QR bas usi tak pahunchne ka numerically safer raasta hai.


Level 5 — Mastery

Problem 5.1

Ek rank-deficient case. Maano (a) Show karo ki invertible nahi hai. (b) Explain karo ki mein kya gadbad hoti hai. (c) Projection phir bhi nikalo — yeh abhi bhi unique hai — aur minimum-norm bhi do.

Recall Solution

(a) Column 2 exactly column 1 hai, toh rank hai (columns dependent). Compute karo: Zero determinant ⇒ invertible nahi. (b) exist nahi karta, toh formula meaningless hai; normal equations ke infinitely many solutions hain (poori ek line), kyunki dependency direction ke along koi bhi shift ko unchanged chhod deta hai. (c) Column space single direction hai (kyunki dono columns uske multiples hain). ko par project karo: Yeh projection unique hai chahe nahi. Ek choose karne ke liye: koi bhi jahan hoga. Minimum-norm choice (via Pseudoinverse (Moore-Penrose)) minimise karta hai subject to ; use karna deta hai, aur indeed . ✓

Problem 5.2

Weighted least squares. Maano measurement 2, measurements 1 aur 3 se do baar reliable hai, toh tum residuals ko se weight karte ho aur minimise karte ho. Show karo ki yeh aur par ordinary least squares hai jahan , aur modified normal equations likho.

Recall Solution

Objective rewrite karo. ke saath, kyunki har component ko scale karta hai aur squares sum karta hai. Yeh exactly ordinary least squares hai data matrix aur target ke saath. Normal equations par apply karo: Kyunki diagonal hai (symmetric), , toh ke saath: Matlab: trustworthy points (, toh ) fit ko apni taraf char guna zyada khainchte hain. Yeh weighted Linear Regression ka bridge hai.


Recall Pure page ke liye ek-line self-check

Kya tum memory se (1) ek line fit ke liye setup kar sakte ho, (2) normal equations se solve kar sakte ho, (3) usi problem ko QR se solve kar sakte ho, (4) verify kar sakte ho, aur (5) explain kar sakte ho kyun QR normal equations se conditioning mein better hai? Agar sab paanch ke liye haan, toh yeh topic tumhara hai.