just reverse process here For example, Given, M = [1.177 -0.0372159 -0.00193271 ; -0.000159094 1.25581 0.0460427 ; 0.115352 0.0235739 0.993045 ; ] If we do qr decomposition directly, we will have >> [R,K] = qr(M) R = -0.9952 0.0020 -0.0975 0.0001 -0.9998 -0.0216 -0.0975 -0.0215 0.9950 K = -1.1826 0.0349 -0.0949 0 -1.2561 -0.0674 0 0 0.9873 Anyway, we can use RQ, we reverse the cols, then transpose M another_M = [-0.00193271 0.0460427 0.993045 ; -0.0372159 1.25581 0.0235739 ; 1.177 -0.000159094 0.115352 ; ] then [another_K another_R] = rq(another_M) another_R = [-0.097518 -0.021568 0.995 ; -0.00196984 0.999767 0.0214782 ; -0.995232 0.000134525 -0.0975378 ; ] another_K = [0.987275 0.0673646 -0.0949297 ; 0 1.2561 0.034908 ; 0 0 -1.18264 ; ] We transpose another_R, then reverse the cols. We will have R. R = -0.9952 -0.0020 -0.0975 0.0001 0.9998 -0.0216 -0.0975 0.0215 0.9950 We transpose another_K...