Accumulated QR factorization identity Created 2026-09-24 Updated 2026-09-24
Let
Then
Thus is a QR decomposition of the matrix power . In particular, the first columns of span the same subspace as the first columns of whenever those columns are independent.
André-Louis Cholesky developed his calculation in the setting of geodetic adjustment: measured angles and lengths must satisfy geometric relations, while corrections should be small. The manuscript reproduced in Claude Brezinski's study is titled Sur la résolution numérique des systèmes d’équations linéaires and ends with the date 2 December 1910 at Vincennes. The manuscript reports a 56-equation calculation adjusting altitudes in an Algerian triangulation network. Its date establishes when this written account existed, rather than an exact invention date.[ref]
A related algebraic reason for the method's usefulness is that normal equations involve a Gram matrix. If a real matrix has linearly independent columns, then
so is a positive-definite matrix. That gives the structure needed by a Cholesky decomposition. The historical adjustment problem instead produces from independent constraint rows; the same argument applies to its transpose. In numerical least squares, explicitly forming normal equations squares the condition number of a full-column-rank design matrix; a QR decomposition can therefore be preferable for accuracy. Indeed, the extreme singular values give . The factorization remains useful when a positive-definite matrix is already the natural input.
Cholesky factor 2026-10-31
For a real symmetric positive-definite matrix, the lower triangular matrix with positive diagonal in its Cholesky decomposition is its lower Cholesky factor; is the corresponding upper factor. If a full-column-rank matrix has a reduced QR decomposition with positive diagonal of , then , so is the upper Cholesky factor of .
Gram-Schmidt process Created 2026-09-24 Updated 2026-10-14
The Gram-Schmidt process turns a finite ordered family of linearly independent vectors in an inner product space over the real numbers into an orthonormal basis of their linear span. It keeps every successive linear span, so the first new vectors describe exactly the same directions as the first inputs. Its idea is geometric: remove the orthogonal projection onto directions already found, then divide the remaining vector by its norm. This makes a complicated basis easier to use without changing the vector subspace it describes.[ref]
Start with and . At step , use the previously obtained orthonormal set to define
The sum is the orthogonal projection onto a finite-dimensional subspace , and is the orthogonal projection residual. Linear independence ensures : otherwise would already be a linear combination of earlier inputs. If the input family is linearly dependent, use only the retained orthonormal vectors in the sum and omit an input whenever its remainder is the zero vector; do not divide by zero. The retained outputs still form an orthonormal basis of the original linear span, but their number can be smaller than .
For a short verification, orthonormality makes every earlier inner product vanish:
Also is minus a linear combination of earlier vectors, while is plus that same linear combination. These two inclusions, followed by division by a nonzero norm, give
The argument also works in an inner product space over the complex numbers with the existing inner product convention, linear in the first argument: the coefficients remain . With the convention linear in the second argument, write instead.
For a first picture, take and in with the ordinary dot product. Then
Subtracting the diagonal component leaves an orthogonal direction; dividing by its norm makes its length one. If the second input were instead, its orthogonal projection would be the entire input and , revealing linear dependence.
For a full three-dimensional calculation, use the ordinary dot product and the input vectors
The first two steps give
At the third step, the inner products are and . Consequently
The three numerator vectors have pairwise dot products and squared Euclidean norms . Thus the displayed outputs are indeed an orthonormal basis, and the three nonzero remainders also confirm linear independence of the inputs. Keeping the removed coefficients produces the QR decomposition below.
An immediate reward is a reusable orthogonal projection: once an orthonormal basis of a vector subspace is known, any vector has
For the linear span of just the first two inputs in the three-dimensional example, gives . Its orthogonal projection residual is , visibly in the missing orthogonal direction. This is the geometry behind the linear least-squares problem.
The formulas above describe exact arithmetic. With floating-point arithmetic, subtracting an orthogonal projection nearly equal to the input can leave a small remainder; dividing by its small norm can magnify existing roundoff error. The Classical Gram-Schmidt and Modified Gram-Schmidt arrangements agree in exact arithmetic but can give different rounded results. Exact linear dependence and a small computed remainder therefore require different judgments in a numerical implementation.[ref]
Generate a real -by- matrix with independent entries having the standard normal distribution. Take its QR decomposition with positive diagonal in the upper triangular matrix factor, . The orthogonal matrix has normalized Haar measure on the full orthogonal group . If a numerical factorization returns , set and return . The signs are nonzero almost surely: successively drawn Gaussian columns have probability zero of lying in the proper linear subspace spanned by earlier columns.
For correctness, every fixed orthogonal matrix preserves the standard Gaussian column density and column independence, so and have the same probability distribution. The positive-diagonal QR decomposition is unique: two decompositions would give an orthogonal matrix that is also an upper triangular matrix with positive diagonal, hence the identity. Therefore and has a left-invariant probability law. Uniqueness of normalized Haar measure on the compact group identifies that law. Each determinant sign has probability by reflection invariance.
Apply the preceding Householder reflection to the columns of
The first column becomes and the second becomes :
Thus an orthogonal matrix multiplying an upper triangular matrix reconstructs . The zero below the diagonal came from a geometric operation that preserves Euclidean norms and inner products.
Figure 1.
A single Householder reflection makes a two-column matrix upper triangular
. Both columns are reflected by the same orthogonal transformation. The first lands on the first coordinate axis; the second retains a nonzero second component. The intermediate triangular factor has a negative first diagonal entry. Details.
Our positive-diagonal convention for QR decomposition is obtained by a sign adjustment. With , put
Then and . The intermediate sign chooses an orientation for a basis vector; the adjustment makes the diagonal positive.
For a larger matrix, the next Householder reflection acts only on the lower rows of the remaining columns, retaining the zeros already created. Store its defining vector and apply instead of forming a dense reflection matrix. This links a simple mirror operation to efficient QR decomposition, including least-squares solutions.
LQ decomposition 2026-10-31
An LQ decomposition factors a real matrix into a lower trapezoidal matrix and an orthogonal matrix . Transposing a QR decomposition of proves existence. Equivalently, right Householder transformations clear the part of each row beyond its diagonal while preserving earlier zeros. This factorization is useful for underdetermined systems, complementing the role of QR decomposition in overdetermined systems.
Matrix decomposition 2026-10-14
A matrix decomposition expresses a matrix as a matrix product of factors with simpler structure. An LU decomposition uses triangular factors, a QR decomposition uses an orthogonal matrix and a triangular factor, and a singular value decomposition separates input directions, stretching factors and output directions. The factorization is an identity; the chosen structure determines what it helps compute.
For an original two-by-two example,
The outer factors are a lower triangular matrix and an upper triangular matrix, each with unit diagonal as in a unit triangular matrix; the middle factor is a diagonal matrix. Their matrix product is , and the final diagonal entry is the Schur complement of the first entry . This is the scalar version of the factorization under block elimination.
To solve , solve with the three factors in their displayed order from left to right: first the lower triangular factor, then the diagonal factor, then the upper triangular factor. The intermediate vectors are and , giving the concise answer . A new right-hand side uses the same factors. This is why Reusing LU factors for multiple right-hand sides is useful: factorization records work that otherwise would be repeated, while forward substitution and back substitution apply it cheaply.[ref]
Different decompositions reveal different features. A Cholesky decomposition uses positive definiteness of a symmetric matrix, while a singular value decomposition also applies to rectangular matrices and exposes matrix rank. The existence and numerical behaviour of the factors depend on their own hypotheses; for example, an unpivoted LU decomposition can fail when a chosen pivot element is zero even though the matrix is an invertible matrix.
Minimizing gives the displayed equations by differentiation. Equivalently, the regression residual satisfies : it is orthogonal to every column of the design matrix. If has full column rank, the minimizer is unique and the fitted values are the orthogonal projection of onto its column space. A rank-deficient design matrix can give multiple coefficient vectors, while the projected fitted vector is still unique.
For an intercept and one predictor, put and . The equations give and , provided . In the five-point example in linear regression, , , and , giving and .
The normal equations describe the mathematical optimum, but explicitly forming and inverting can amplify numerical problems. A QR decomposition computes the same least-squares solution through orthogonal coordinates; a singular value decomposition also exposes nearly dependent columns. This connects statistical fitting to numerical linear algebra and the choice of a stable algorithm. [ref]
Orthogonal coordinate reduction of a subspace Created 2026-10-03 Updated 2026-10-14
For a full-column-rank matrix , extend the thin QR decomposition to an orthogonal matrix . Then
so maps the column space of onto the first coordinate directions. Successive Householder transformations construct the same reduction without first forming a full orthogonal basis.
Suppose three measurements constrain two unknowns:
The linear system asks for , , and , which are incompatible. A least-squares solution makes a balanced compromise. The matrix has full column rank, so
The fitted output and residual are
Thus the two direct measurements are each overshot by one, and the measured sum is undershot by one. The residual has Euclidean norm and is orthogonal to the column space, the plane in output coordinates .
Figure 1.
The pseudoinverse projects inconsistent data onto the attainable output plane
. For , the closest attainable output is . The segment between them is the residual , perpendicular to the column space. The drawing is an orthonormal two-dimensional slice of output space; the attainable plane intersects this slice in the blue straight line. Details.
For any perturbation , the orthogonality of to gives
Since the kernel of is trivial, every nonzero increases the residual. The least-squares solution is unique in this example. The formula using is convenient for these small exact calculations; an actual numerical computation can use a QR decomposition or singular value decomposition to avoid the extra conditioning cost of the least-squares normal equations. For full column rank, the squared singular values of are the eigenvalues of , so its condition number in the Euclidean norm is . [ref]
Full column rank makes positive definite: for nonzero , . Let be its unique upper-triangular Cholesky decomposition with positive diagonal. Defining gives
Thus the skinny QR decomposition exists. If is another such decomposition, orthonormality gives . Cholesky uniqueness forces , and then . Therefore the skinny factorization with positive diagonal is unique. This is the thin QR factorization from Cholesky decomposition; no inverse of the rectangular is assumed.
First write with . Direct multiplication gives
The inner product of its two columns is
If is orthogonal this is zero, and positivity of the bracket forces . The first column must then have length one, so . Thus , , and .
For the general QR decomposition, apply the Gram-Schmidt process to the ordered columns of the invertible real matrix . At stage , subtract projections onto the already chosen orthonormal vectors to get ; independence of the columns gives . Set . The matrix with columns is orthogonal, and
is upper triangular. Its diagonal entry is strictly positive. This proves with the required properties.
Now suppose in dimension . Substitution of gives
The matrix is orthogonal, as are and , so this matrix and are orthogonal. Regard as upper triangular in blocks, with invertible diagonal blocks . The inverse is upper triangular in the same blocks, by solving the triangular block equations; multiplication by block diagonal preserves this pattern. Thus is block upper triangular.
An orthogonal block upper-triangular matrix is block diagonal. Indeed its first two columns are supported in the first two rows and are orthonormal, so span that first coordinate plane. Orthogonality of every subsequent column to them makes its first two entries zero. The remaining lower-right matrix is orthogonal; iterate this argument. Therefore with each orthogonal. The rule for diagonal blocks of products of block upper-triangular matrices gives
Each is itself an upper-triangular real matrix with positive diagonal. The first calculation gives . Consequently , whence . Finally is a product of matrices commuting with , so . We have proved
This is positive-diagonal QR decomposition preserves a complex structure; the positivity convention is important in the two-dimensional step.
Let denote the columns. The Gram-Schmidt process begins with , so
The second column has and residual
This residual has norm , giving and .
For the third column the orthogonal projections are and . Subtracting them gives
Its norm is , so and . Thus the requested thin QR decomposition is
The three displayed columns have pairwise zero inner products and unit norms; direct multiplication gives .
A full QR decomposition of a real by matrix with writes
where is an orthogonal by matrix and is upper triangular by . In the full-column-rank case is invertible. Equivalently the reduced factorization is with . Householder transformations can construct the full factorization.
Let with . Since orthogonal transformations preserve the Euclidean norm,
Therefore the linear least-squares problem has the full-rank solution
Back substitution solves this triangular system without forming . If the matrix is rank deficient, use a rank-revealing pivoted factorization and minimize over its independent columns; the minimizer need not be unique. The original PDF minimizes over ; the converted TeX's minimization over is a transcription error.
Use closest points on two line segments as a small constrained convex optimization problem. Write the two line segments as
and put . Minimize the squared Euclidean distance ; minimizing its square also minimizes the distance. Compute the dot products
For nonzero, nonparallel directions, an interior minimum must satisfy the two derivative equations
Their determinant is , so the stationary candidate is
Retain this candidate only when both parameters lie in the unit interval.
The other possibilities are on the boundary. Define . Minimizing the same quadratic on each of the four edges gives these candidates by orthogonal projection onto a line segment:
Evaluate at every retained candidate and choose the smallest. The resulting are the required closest points. The quadratic is convex because it is the squared norm of an affine map. A minimum in the interior is stationary, and a minimum on the boundary minimizes one of these edge restrictions, so the list is exhaustive. Ties correspond to multiple equally valid answers.
Handle degenerate line segments before dividing: if and , set and ; if and , set and ; if both vanish, use the two endpoints. For exactly parallel directions, . The distance depends on a single linear combination of ; any interior minimizing level line reaches the boundary, so the four edge candidates still include a minimum.
For nearly parallel directions, compare with the scale , and solve the interior least-squares problem using QR decomposition or singular value decomposition if necessary. A small determinant should trigger a stable solve, not arbitrary rejection of a possibly valid interior solution. In particular, do not merely clip both coordinates of the infinite-line solution: the dot product couples the two parameters, and changing one changes the optimum for the other.
The first matrix column is already the unit vector , so the first QR elimination needs no reflection. In the remaining three coordinates, the second column is , with norm three. To map it to , use the Householder transformation
It is symmetric and orthogonal and satisfies . Extend it to . The QR decomposition and transformed right side are
For the lower right-side block, , so its transformed value is .
Orthogonality preserves the least-squares residual norm. Thus the first two squared residual terms can and must be set to zero, while the last two are independent of the unknowns:
The minimum squared residual is . The solution is unique since the triangular factor has nonzero diagonal entries. No normal equations are used.
Choose the Givens rotation convention in which equals the identity outside rows and columns , and has block
in those coordinates. It is an orthogonal matrix. For any chosen column , write , and . If , take , . Then the new entries are and . If both entries vanish, take . This proves the requested elimination for each chosen ; the angle is allowed to depend on , and one angle need not eliminate an entire arbitrary row.
For the given matrix, use first for , obtaining
Use the same cosine and sine for . It makes
This is already upper triangular, including the zero entry, and every leading nonzero row entry is positive. Thus the requested QR decomposition is
The orthogonal matrix property follows from the two rotations, and direct multiplication verifies .
Each plane rotation satisfies . Hence is an orthogonal matrix and is an upper triangular matrix. Multiplication by gives the QR decomposition
The zero-pair cases already handled make this construction valid for every real matrix, including rank-deficient matrices. Orthogonality follows from the product identity, not from any invertibility assumption on .
For a full-column-rank matrix, a thin QR decomposition has , where and is nonsingular upper triangular. Extend to an orthogonal matrix . Orthogonality gives
Thus the unique least-squares solution satisfies , with residual norm . In a rank-deficient problem is singular and uniqueness needs separate treatment.
A Givens rotation is the identity except for the rows/columns , whose block is with . Its transpose times itself has that block equal to the identity, so it is orthogonal. Choose in rows two and three. Then
Back substitution in the first three rows gives
The fourth row of the rotated residual is the unavoidable value , while the other three rows vanish. Thus this rotation also directly exhibits the least-squares optimality.