The columns of the matrix must be linearly independent in order to preform QR factorization. Note: this uses Gram Schmidt orthogonalization which is numerically unstable. Alternate algorithms include modified Gram Schmidt, Givens rotations, and Householder reflections.