Gram–Schmidt Formula and Output Convention
The input vectors are the columns of matrix A = [a₁ … aₙ]. The output columns q₁ … qₙ are orthonormal and span the same subspace.
Remove projections
uₖ = aₖ − Σⱼ<ₖ (qⱼᵀaₖ)qⱼEach subtraction removes the component pointing along an earlier basis vector.
Normalize
qₖ = uₖ / ‖uₖ‖Dividing by the Euclidean norm makes each new basis vector have length 1.
QR factorization
A = QR, QᵀQ = IR is upper triangular and stores projection coefficients plus the residual norms on its diagonal.
How to Use the Calculator
- Choose the coordinate dimension and number of vectors. A set cannot contain more independent vectors than its dimension.
- Enter each vector as a column of
A, or paste the whole matrix. For example, the first column containsa₁. - Select Orthonormalize vectors. The columns of
Qare the resulting orthonormal basis. - Review
R, the projection steps, and both error checks. Copy the summary or download the matrices as CSV if needed.
Worked 3D Example
Start with a₁ = (1,1,0), a₂ = (1,0,1), and a₃ = (0,1,1). First, q₁ = (1/√2, 1/√2, 0). Removing the projection of a₂ onto q₁ gives a direction proportional to (1,−1,2), so q₂ = (1,−1,2)/√6. The third normalized residual is q₃ = (−1,1,1)/√3.
Same span
The new vectors are linear combinations of the originals, and A = QR reconstructs every original column.
Easy check
The basis is orthonormal when every qᵢ·qᵢ = 1 and every distinct pair has qᵢ·qⱼ = 0, subject to rounding.
Common Gram–Schmidt Problems
Dependent input vectors
If a vector lies in the span of earlier vectors, its residual is zero and cannot be normalized. Remove the redundant vector or choose an independent set.
Vectors entered as rows
This page treats columns as vectors. If your source lists one vector per row, transpose it before entry.
Rounding too early
Rounded projection coefficients can spoil later dot products. This calculator keeps full double precision internally and rounds only the display.
Gram–Schmidt FAQs
What does Gram–Schmidt orthonormalization calculate?
It replaces linearly independent vectors with mutually perpendicular unit vectors that span exactly the same subspace.
What is the difference between orthogonal and orthonormal?
Distinct orthogonal vectors have dot product zero. An orthonormal set is orthogonal and every vector also has Euclidean norm 1.
Why did the calculator report a dependent vector?
After earlier projections were removed, too little of that vector remained to create a reliable new direction. It is zero, dependent, or numerically indistinguishable from the span of earlier vectors at double precision.
What are the Q and R matrices?
Q contains the orthonormal basis vectors as columns. R is upper triangular and records how to combine those columns to reconstruct A.
Why use modified Gram–Schmidt?
It updates the residual after every projection, which generally preserves orthogonality better than evaluating the classical formula in its direct computational order. Re-orthogonalization can improve difficult cases further.
Can Gram–Schmidt change the order of the basis?
Yes. The process works from left to right, so reordering input vectors can produce a different orthonormal basis, although the final span remains the same for an independent set.
Are my vector entries private?
Yes. The calculation, clipboard text, and CSV file are created in your browser. This calculator’s code does not transmit or save the entered values.
Calculation Notes
Last reviewed: August 4, 2026 by the Starlight Tools editorial team.
Inputs must be finite and no larger than 10¹⁰⁰ in magnitude. Dimensions are limited to 8 so the complete working stays readable. Dependence is assessed relative to each vector’s original norm and JavaScript double-precision arithmetic; severely ill-conditioned inputs may require specialist numerical software or higher precision.
