Step 1 — pehla axis banao.
Humein ek unit vector chahiye jo a1 ki taraf point kare:
u1=a1,q1=∥u1∥u1.Kyun?q1 hamaari pehli orthonormal direction hai; baaki sab cheezein iske against measure ki jaayengi.
Step 2 — jo already explain ho chuka hai use hataao.a2 ke liye, uska shadow (projection) q1 par subtract karo:
u2=a2−(q1⊤a2)q1,q2=∥u2∥u2.Kyun? Bacha hua u2, a2 ka woh hissa hai jo q1 ke perpendicular hai, isliye q2⊥q1.
Step k — saare pehle ke shadows subtract karo.uk=ak−∑i<k(qi⊤ak)qi,qk=∥uk∥uk.
Step — R padho. Har relation ko invert karo taaki original ak ko qi ke terms mein express kiya ja sake:
ak=rkk∥uk∥qk+∑i<krik(qi⊤ak)qi.
Toh ak mein qi ka coefficient hai
rik=qi⊤ak(i<k),rkk=∥uk∥,rik=0(i>k).
ak=∑irikqi ko saare k ke liye stack karna exactly matrix equation A=QR hai. ∎
min∥Ax−b∥ solve karo upar wale A ke saath aur b=(1,2,3).
QR kyun help karta hai.∥Ax−b∥2=∥QRx−b∥2. Kyunki Q length preserve karta hai, andar Q⊤ se multiply karo (full Q tak extend karo): minimizer satisfy karta hai
Rx=Q⊤b.Kyun?A=QR⇒A⊤Ax=A⊤b⇒R⊤Q⊤QRx=R⊤Q⊤b⇒R⊤Rx=R⊤Q⊤b. Invertible R⊤ cancel karo: Rx=Q⊤b. A ki koi squaring nahi → numerically stable.
R upper triangular kyun hai? → kyunki ak sirf q1…qk use karta hai.
Least-squares shortcut kya hai? → Rx=Q⊤b.
Q kya property guarantee karta hai? → Q⊤Q=I (length/angle preserving).
QR unique kya banata hai? → rkk>0.
Recall Feynman: 12 saal ke bacche ko samjhao
Socho tumhare paas teen thode tedhe arrows hain kaagaz par. Tum unhe ek saaf set of perpendicular arrows se describe karna chahte ho (jaise ek room ka corner: upar, daayein, aage). Pehle arrow 1 ko rakho, bas use length 1 tak shrink karo — yeh tumhari pehli clean direction hai. Arrow 2 ke liye, woh hissa mitao jo arrow 1 ki taraf point karta hai, aur jo bacha hua hai woh ek brand-new perpendicular direction mein point karta hai — use length 1 tak clean karo. Repeat karo. Saaf perpendicular arrows Q ke columns hain. "Har clean arrow ka kitna use kiya" ki instructions R banati hain. Unhe wapas multiply karo aur original tedhe arrows rebuild ho jaate hain: A=QR.