In order to avoid $A^TA$'s bad condition we decompose $A$ into $A = QR$ , $Q \in \mathbb{R}^{n*m} $ , $R \in \mathbb{R}^{m*m} $ , $Q^TQ = I$ . But in my textbook it says that $$ min||r||_2^2 = min||b - Ax||_2^2 = min||Q^Tb - Rx||_2^2 $$
And proceeds to say that the best solution is the $x$ so that $$ Q^Tb - Rx = 0 $$ $$ \iff x = R^{-1}Q^Tb $$
Doesn't that mean though that $$ x = R^{-1}Q^Tb \iff QRx = b \iff Ax = b $$
So what happened here? Is R reversible only when the system is not overdetermined? I'm a little bit confused. Thank you!