Matrix A & vector b

Requested formula: u = (AᵀA)⁻¹Aᵀb and b_proj = A u. The engine checks rank(A) = n before dividing, because AᵀA is invertible exactly when A has full column rank.

A must be m × n with m ≥ n and rank(A) = n. Fractions such as 3/4 and finite decimals are exact. b is a column vector entered on one line separated by spaces, tabs or commas.

Solution & Projection

Coefficient vector u — 2 entries in R^2

1/2
7/6

u = (AᵀA)⁻¹Aᵀb measures how much of each column of A the fit uses. This is a vector of coefficients, not a point of R^3.

Projected vector b_proj = A u — 3 entries in R^3

7/6
5/3
13/6

b_proj = A(AᵀA)⁻¹Aᵀb lives in the column space of A; it is the closest point of that subspace to b.

SHAPE OF A3 × 2
rank(A)2
det(AᵀA)6
‖b − b_proj‖²1/6

Residual b − b_proj

-1/6
1/3
-1/6

Observed b

1
2
2
✓Aᵀ(b − b_proj) = 0 — the residual is orthogonal to every column of A
✓AᵀA u = Aᵀb — the normal equations hold for this u
✓A u recomputed from u reproduces b_proj
✗b is not in the column space of A; the residual of minimum length is shown above

Workings

Help & Limits

The least-squares solution solves the normal equations AᵀA u = Aᵀb. When A has full column rank that solution is unique and equals u = (AᵀA)⁻¹Aᵀb; the projection of b onto the column space is b_proj = A u, and the residual is orthogonal to every column of A.

Rank failure is reported, not worked around: if rank(A) < n then det(AᵀA) = 0, the inverse does not exist and there are infinitely many minimisers. This tool does not offer a pseudoinverse or a family of minimizers; remove the dependent column(s) instead. Your input is preserved so you can edit it.

Documented limits: A may have at most 8 rows and 8 columns, and each entry may have at most 40 digits in its numerator or denominator. Exceeding either limit reports a structured error and preserves your input.

Stored state: the raw text of A and b only. u, b_proj, AᵀA, the inverse and every verification flag are recomputed from the validated input whenever the page loads.