Gram-Schmidt and QR

Subtracting from each vector its shadows on the ones already straightened leaves a piece perpendicular to all of them with the same span, so any basis can be made orthonormal, and the weights used make $A = QR$.

From Linear Algebra.