# Triangular decomposition of a Gram matrix

The triangular decomposition of a Gram matrix as a method for finding the QR decomposition of a square matrix $A$ works only if the non-singularity of the original matrix is guaranteed. The method consists of three parts: 1. Construction of the Gram matrix $A^*A$ for the columns of the original matrix. 2. Finding the Cholesky decomposition $R^*R$ of the Gram matrix $A^*A$. 3. Calculation of the unitary matrix $Q=AR^{-1}$ by using, for instance, the modified back substitution.