---
title: "Gram-Schmidt Orthogonalization Calculator — QR Decomposition"
description: "Apply the Gram-Schmidt process to orthogonalize a set of vectors into an orthonormal basis. Supports 2D, 3D, and 4D vectors with step-by-step projection subtraction. Used in QR decomposition, PCA, and least squares."
url: "https://worldcalculators.org/calculators/gram-schmidt/"
canonical: "https://worldcalculators.org/calculators/gram-schmidt/"
---

# Gram-Schmidt Orthogonalization

Apply the Gram-Schmidt process to orthogonalize a set of vectors into an orthonormal basis. Supports 2D, 3D, and 4D vectors with step-by-step projection subtraction. Used in QR decomposition, PCA, and least squares.

## Quick answer

Input vector v1

## Why Orthonormal Bases Matter

An orthonormal basis makes everything simpler. Projections become just dot products. Coordinates are found by simple dot products (no matrix inversion). Distances and angles are preserved. Numerical computations are more stable.

## Frequently Asked Questions

Classical Gram-Schmidt (as implemented here) can accumulate floating-point errors for nearly-dependent vectors. In practice, Modified Gram-Schmidt (MGS) and Householder reflections are preferred for numerical stability. MATLAB's qr() uses Householder; scipy.linalg.qr() defaults to LAPACK. For educational purposes and well-conditioned vectors, classical Gram-Schmidt is accurate.
Yes — the orthonormal basis produced depends on the order of the input vectors. The first output vector is always the normalization of the first input. Different orderings give different (but equally valid) orthonormal bases for the same subspace. If you want a specific orientation, choose your input order accordingly.

Source: https://worldcalculators.org/calculators/gram-schmidt/
Markdown mirror of the HTML page. Prefer this URL for RAG; the interactive calculator still lives on the HTML page.
