using LinearAlgebra A = rand(4,4) Q,R = qr(A) round.(Q'Q, digits=0) round.(Q*Q', digits=0) A ≈ Q * R Q * R A A = rand(5,3) Q,R = qr(A) Q = Q[:,1:3] # make sure we have the first three columns Q R Q * R A A ≈ Q * R round.(Q'Q, digits=0) Q * Q'