qr decomposition and the gram-schmidt procedure let be an matrixwhere thenthere exists matrix rnxp satisfying qq and an upper triangular matrix pxp such that qr this is the qr decomposition for real-valued matrices when has full column ranksuch decomposition can be obtained via the gram-schmidt procedurewhich constructs an orthonormal basis { of the column space of spanned by { }in the following way (see also figure ) take /ka let be the projection of onto span { that isp hu now take ( )/ka this vector is perpendicular to and has unit length let be the projection of onto span { that isp hu +hu now take ( )/ka this vector is perpendicular to both and and has unit length continue this process to obtain - figure illustration of the gram-schmidt procedure at the end of the procedurea set { of orthonormal vectors are obtained consequentlyas result of theorem aj ha ui ui { = ri pgram-schmidt