Matrix Decomposition Calculator (LU, QR, Cholesky, SVD)

Choose LU, Cholesky, QR or SVD, enter a matrix and get the factors with their working, an exact check where possible and copyable results.

Funziona nel tuo browser. I tuoi file non lasciano mai il dispositivo. Scopri come verificarlo

…

Come si usa

  1. 1
    Pick a factorization

    Choose the LU, Cholesky, QR or SVD tab.

  2. 2
    Enter the matrix

    Type it in the grid or paste rows as text.

  3. 3
    Set the options

    For LU choose zero-pivot swaps or partial pivoting.

  4. 4
    Read the factors

    See P, L, U or Q, R or U, Σ, V with the check result.

  5. 5
    Study the steps

    Follow each multiplier, pivot or projection in order.

  6. 6
    Copy or print

    Copy text or LaTeX, download CSV, or print the working.

Informazioni su questo strumento

A matrix factorization rewrites one matrix as a product of simpler ones, and each of the four classic factorizations answers a different question. LU splits a square matrix into a lower and an upper triangular factor, which is how computers solve linear systems and compute determinants. Cholesky is the fast, stable version of LU for symmetric positive definite matrices such as covariance matrices and stiffness matrices. QR writes a matrix as orthonormal columns times an upper triangular matrix and is the standard route to least squares. The singular value decomposition, UΣVᵀ, shows the rank, the 2-norm and the condition number of any rectangular matrix. Most online calculators return these factors as long decimals with no explanation. This one keeps LU and the LDLᵀ form of Cholesky in exact fractions, writes Cholesky and QR entries in exact square-root form such as √6/3, and lists each multiplier or projection used along the way. The SVD tab forms AᵀA exactly, prints its characteristic polynomial and reports singular values exactly when they are whole numbers or simple roots, while U and V come from a numeric Jacobi solver. Every result is multiplied back and compared with your matrix.

LU with a permutation

Elimination subtracts multiples of the pivot row from the rows below it. Each multiplier ℓij goes into L below the diagonal, and what remains is U. When a pivot is zero the tool swaps rows and records the swap in the permutation matrix P, so the identity it proves is PA = LU. You can also ask for partial pivoting, which always picks the largest available pivot the way numerical libraries do. The determinant follows at once: the product of U's diagonal, with a sign change for each swap.

Cholesky and LDLᵀ

For a symmetric matrix the tool computes d1, d2 and so on, the pivots of symmetric elimination. If one of them is zero or negative, the matrix is not positive definite and the tool tells you which leading minor fails. Otherwise it shows the unit lower factor L, the diagonal D and the Cholesky factor, which is L with column j multiplied by √dj.

QR by Gram-Schmidt

Each column of A loses its projections onto the earlier orthogonal vectors; the leftover vector is divided by its length to give a column of Q, and the coefficients fill R. Dependent columns are reported, because a thin QR with an invertible R does not exist for them.

SVD

The squares of the singular values are the eigenvalues of AᵀA. The tool shows AᵀA, its characteristic polynomial and those eigenvalues, then the numeric U, Σ and V, the rank, the 2-norm and the condition number.

Worked example

Choose LU and enter rows 2 1 1, 4 −6 0 and −2 7 2. The multipliers are ℓ21 = 2, ℓ31 = −1 and ℓ32 = −1, so L has rows 1 0 0, 2 1 0, −1 −1 1 and U has rows 2 1 1, 0 −8 −2, 0 0 1. No swap is needed, PA = LU checks exactly and det A = 2 × (−8) × 1 = −16. On the Cholesky tab, the matrix with rows 4 12 −16, 12 37 −43, −16 −43 98 gives pivots 4, 1 and 9 and the factor with rows 2 0 0, 6 1 0, −8 5 3. On the SVD tab, rows 3 2 2 and 2 3 −2 give det(λI − AᵀA) = λ³ − 34λ² + 225λ and singular values 5 and 3.

Limits

Sizes up to 8×8 are accepted. U and V in the SVD are numeric, so signs of paired columns may differ from a textbook while the product stays correct. This is a study and checking aid, not a replacement for LAPACK on large or badly conditioned problems.

Esempio svolto

LU of rows 2 1 1 / 4 −6 0 / −2 7 2: L rows 1 0 0, 2 1 0, −1 −1 1; U rows 2 1 1, 0 −8 −2, 0 0 1; det −16.

In breve

Domande frequenti

Which decomposition should I use?

Use LU to solve square systems and find determinants, Cholesky when the matrix is symmetric positive definite, QR for least squares and orthogonal bases, and SVD for rank, norms, conditioning and low-rank approximation.

Why does my LU have a P matrix?

When a zero appears where a pivot should be, rows must be swapped. P records those swaps, so the factorization reads PA = LU. Partial pivoting also swaps to get the largest pivot, which is more stable in floating point.

What does "not positive definite" mean for Cholesky?

One of the symmetric pivots came out zero or negative, so some leading principal minor is not positive. Such a matrix has no real Cholesky factor; use LU or LDLᵀ ideas instead.

Are the square roots exact?

Yes for Cholesky and QR. Each entry is shown as a fraction times a square root, such as 2√3/3. Switch to decimals for a rounded view.

Why are the SVD factors decimals?

Singular vectors usually involve roots of a cubic or higher polynomial, which have no tidy closed form. The tool still prints AᵀA and its characteristic polynomial exactly so you can follow the theory.

How do I know the answer is right?

Each tab multiplies the factors back. LU and LDLᵀ are checked exactly; QR and SVD report the largest difference from A, which should be around 10⁻¹⁵.

Completamente gratisNessun costo, nessuna registrazione
I file restano privatiTutto funziona nel tuo browser
Facile nella tua linguaDisponibile in molte lingue