In short, the formulas for R^-1 for QR decomposition done by hand is valid for m = n. However, for m < n, you would need to replace A^-1 with a left inverse of A. Of course, if your calculator can compute inverses for you, then you'll just want to compute R^-1 = (Q^T * A)^-1 directly, unless you need a left inverse of A for some other reason. In more detail: If m < n, then Q^T is not Q^-1, but it is still a left inverse of Q because the columns of Q are orthornormal. Therefore, Q^T * A = R is still true like it is in case m = n: Q^T * A = Q^T * Q * R = I_m * R = R. R^-1 = A^-1 * Q, true for m = n, is technically undefined if m < n because then A is not square and so does not have a true inverse. However, A will still have a left inverse---let's call it B---and B * Q will still be a left inverse of R: B * Q * R = B * A = I_m. Since R is square, B * Q is also the true inverse of R.