Advanced maths

Gram–Schmidt orthogonal and orthonormal basis calculator

Build an exact orthogonal basis, identify dependent columns and separately display approximate unit-length vectors.

Your numbers

One row per line or semicolon. Separate entries with spaces or commas. Up to 6 rows and 6 columns; integers, decimals up to 6 places, or fractions such as -2/3. Basis vectors are columns.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Try it, understand it

Explore the result

Keep exact residuals separate from numerical unit vectors.

Worked example comparison
ExampleOutputWhat to notice
Two independent columnsBasis dimension2Both orthogonal directions are retained before normalization.
A dependent second columnBasis dimension1The second residual is zero and is skipped.
Two directions in three dimensionsBasis dimension2The ambient dimension can exceed the number of independent columns.

Check your understanding

Does orthogonal alone mean unit length?

No. Orthonormal also requires length one.

Can a zero residual be normalized?

No. It has no direction to scale to unit length.

Behind the numbers

How this calculation works

Process input columns in order. Subtract their projections onto the already retained orthogonal vectors. Keep a nonzero residual as the next direction; skip a zero residual because it adds no direction. The result is an exact orthogonal basis, without unit-length normalization. Divide each retained nonzero residual by its Euclidean length to display an approximate orthonormal basis. Exact rational vectors and normalized decimal approximations are kept separate.

THE FORMULAuⱼ = vⱼ − Σᵢ<ⱼ [(vⱼ · uᵢ)/(uᵢ · uᵢ)] uᵢ

A worked example

For columns (1,1) and (1,0), the retained vectors are (1,1) and (1/2,−1/2). Their dot product is zero and their squared norms are 2 and 1/2.

Good to know

Exact rational matrices up to 6 × 6. Entries are bounded to ±1,000,000, integer fraction denominators to 1,000,000 and decimal input to 6 places. Intermediate fractions have a size limit. No complex entries, symbolic expressions, measurement uncertainty or numerical-conditioning analysis. Ordered vectors are entered as matrix columns.

Orthogonal and orthonormal are different output requirements

The 2×2 SVD calculator performs a different factorization, separating orthogonal factors and nonnegative singular values and checking reconstruction.

Orthogonal vectors have zero pairwise dot products. Orthonormal vectors additionally have unit length. The tool first retains exact rational orthogonal residuals, then divides each retained vector by its Euclidean length to provide a separate numerical orthonormal approximation.

A vector such as (1,1) has squared length two, so its unit version is (1/√2,1/√2). Those normalized components need not be rational even when all input coordinates are rational. Printing approximate unit vectors as if they were exact fractions would hide that distinction.

Dependent vectors add no new direction

Each input column is processed in order and has its projections onto the retained directions removed. If the residual is zero, that input was already in the span of earlier retained columns and is skipped. Dividing that zero residual by its length would be undefined.

Input order affects which orthogonal basis is produced, even though the retained span is the same. The basis and dimension finder can separately identify independent original columns. This real Euclidean model does not introduce complex conjugation, statistical uncertainty or a guarantee of stability for measured nearly dependent data.

A few questions, answered

Does the page now include unit vectors?

Yes. Exact unnormalized vectors and approximate normalized vectors are displayed in separate columns.

Why skip a dependent column?

Its residual is zero, so it adds no independent direction and cannot be normalized.

Are normalized components always exact rational numbers?

No. Their lengths can involve irrational square roots, so the normalized display is approximate.

Find your calculator

Start typing to explore the library.