Gram-Schmidt Calculator
Turn any set of vectors into an orthogonal or orthonormal basis with the modified Gram-Schmidt process, showing every projection subtraction as a step.
Orthonormal basis
e1 = (0.707107, 0.707107, 0)
e2 = (0.408248, -0.408248, 0.816497)
e3 = (-0.57735, 0.57735, 0.57735)
Every pair of these vectors is perpendicular — the largest dot product between two different basis vectors is 5.77e-10, which is floating-point noise.
Step by step
v1 = (1, 1, 0)
Nothing to subtract — this is the first kept vector.
u = (1, 1, 0), ‖u‖ = 1.414214 → e = (0.707107, 0.707107, 0)
v2 = (1, 0, 1)
- − ((v2·u1) / (u1·u1)) u1 = − (0.5) · (1, 1, 0)
u = (0.5, -0.5, 1), ‖u‖ = 1.224745 → e = (0.408248, -0.408248, 0.816497)
v3 = (0, 1, 1)
- − ((v3·u1) / (u1·u1)) u1 = − (0.5) · (1, 1, 0)
- − ((v3·u2) / (u2·u2)) u2 = − (0.333333) · (0.5, -0.5, 1)
u = (-0.6667, 0.6667, 0.6667), ‖u‖ = 1.154701 → e = (-0.57735, 0.57735, 0.57735)
This is the modified Gram-Schmidt process: each projection is subtracted from the running vector rather than all at once from the original, which loses far less precision in floating point.
What is the Gram-Schmidt Calculator?
The ByteTools Gram-Schmidt Calculator converts a list of vectors into an orthogonal basis — and optionally normalises it to an orthonormal one — by repeatedly subtracting projections.
- Modified Gram-Schmidt for better floating-point accuracy than the classical form
- Toggle between an orthogonal basis and a normalised orthonormal one
- Every projection subtraction shown as an individual step
- Linearly dependent vectors detected and dropped instead of causing a divide-by-zero
- Verification tile showing the largest dot product between different basis vectors
- Handles up to 8 vectors of up to 8 components, entirely in your browser
How to use the Gram-Schmidt Calculator
- 1
Enter one vector per line, with components separated by spaces or commas.
- 2
Leave 'Normalise to unit length' ticked for an orthonormal basis, or untick it to see the orthogonal vectors before scaling.
- 3
Read the resulting basis, and check the max dot-product tile confirming the vectors really are perpendicular.
- 4
Expand the step-by-step panel to see each projection that was subtracted.
- 5
Copy the basis with the copy button.
About the Gram-Schmidt Calculator
The ByteTools Gram-Schmidt Calculator converts a list of vectors into an orthogonal basis — and optionally normalises it to an orthonormal one — by repeatedly subtracting projections. For each vector it removes the component lying along every basis vector already found, using uₖ = vₖ − Σ ((vₖ·uᵢ)/(uᵢ·uᵢ))uᵢ, then divides by the length to get a unit vector.
It uses the modified form of the algorithm, where each projection is subtracted from the running vector rather than all at once from the original. The two are algebraically identical but the modified version loses far less precision in floating point. Every subtraction is printed as its own line so you can follow — or check — the working step by step.
If a vector collapses to zero it means that vector was already in the span of the earlier ones, so the tool drops it and says so explicitly rather than dividing by zero. All computation happens in your browser; nothing is uploaded and nothing is stored.
Frequently asked questions
What does the Gram-Schmidt process do?
It takes a set of vectors that span a subspace and produces a new set spanning exactly the same subspace, but with every pair at right angles. Normalising each result to length 1 makes the set orthonormal, which turns many later calculations into simple dot products.
What is the difference between classical and modified Gram-Schmidt?
Classical subtracts all projections of the original vector at once; modified subtracts each projection from the partially updated vector. They give the same answer in exact arithmetic, but the modified version is significantly more accurate in floating point, so this calculator uses it.
What happens if my vectors are linearly dependent?
A dependent vector has no component outside the span of the earlier ones, so subtracting the projections leaves the zero vector. There is no way to normalise that, so the tool drops the vector and tells you it was dependent — which doubles as a dependency test.
Does the order of the vectors matter?
Yes. The first vector keeps its direction exactly, and each later one is adjusted against those before it, so reordering the input gives a different — but equally valid — orthonormal basis for the same subspace.
What is an orthonormal basis good for?
With an orthonormal basis, the coefficients of any vector are just its dot products with the basis vectors, no linear system needed. That underpins projections, least-squares fitting, Fourier analysis and the Q in QR decomposition.
Related tools
QR Decomposition Calculator
Factor a matrix into an orthogonal Q and upper-triangular R using Householder reflections, with an orthogonality check and least-squares solving.
Vector Projection Calculator
Project one vector onto another to get the vector projection, scalar projection, orthogonal rejection and the angle between, for 2D or 3D vectors.
Linear Independence Calculator
Test whether a set of vectors is linearly independent by comparing rank to vector count, and see the explicit relation when they turn out to be dependent.
Null Space (Kernel) Calculator
Solve A·x = 0 to get a basis for the null space, its dimension, and the general solution in parametric vector form — all in exact fractions.
Matrix Rank Calculator
Find the rank of any matrix by exact row reduction, then get the nullity from the rank-nullity theorem plus full row rank, column rank and singularity.