ForHosting KIT · Math

Polar decomposition calculator

The matrix with rows (2, 1) and (0, 3) splits into a rotation U and a symmetric stretch P, so that A = U P. Enter a square matrix up to 16 by 16 to get both factors, the singular values and a residual check. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon

Polar decomposition factors a square real matrix A as the product of an orthogonal matrix U and a unique symmetric positive-semidefinite matrix P, written A = U P. The stretch factor P is the matrix square root of A-transpose times A; the orthogonal factor U is the nearest rotation-or-reflection to A in the Frobenius norm and comes from the left and right singular vectors. Continuum-mechanics codes recover a rotation from a deformation gradient this way; robotics and computer-graphics pipelines extract a rigid motion from a linear map; numerical analysts project a computed matrix back onto SO(n) or O(n).

What A = U P means and how both factors are unique

The right polar decomposition of a real square matrix A is the factorization A = U P in which U is orthogonal (U-transpose times U equals the identity) and P is symmetric and positive-semidefinite. The stretch factor P is unique for every square A: it is the unique positive-semidefinite square root of the Gram matrix A-transpose A. When A is invertible the orthogonal factor is unique as well and equals A times the inverse of P.

When A is singular U is still a closest orthogonal matrix to A in the Frobenius norm, obtained from a singular-value decomposition A = W Σ V-transpose by the product U = W V-transpose, while P equals V Σ V-transpose. Geometrically U is a rotation or a rotation composed with a reflection, and P stretches along an orthonormal set of axes by the singular values of A.

That is why continuum mechanics writes a deformation gradient as R U (or V R) and why the orthogonal Procrustes problem is solved by the polar factor of a cross-covariance. The left polar decomposition A = P_left U uses the same orthogonal factor and the square root of A A-transpose; this calculator returns the right form A = U P, which is the convention most textbooks and production codes adopt.

For a one-by-one matrix the factors collapse to the sign of the entry and its absolute value, with sign of zero taken as plus one. For an already orthogonal matrix the stretch is the identity and U equals A. For an already symmetric positive-semidefinite matrix the orthogonal factor is the identity and P equals A.

Those three checks are the fastest way to confirm an implementation before you trust a general three-by-three deformation gradient from a simulation dump.

Where polar decomposition is useful

Classrooms and linear-algebra notebooks use a polar decomposition calculator so students can check that U-transpose U equals the identity and that P equals P-transpose with non-negative eigenvalues, without standing up a full computer-algebra system for a three-by-three homework matrix. Continuum-mechanics and finite-element post-processors recover a rotation tensor from a deformation gradient F by reading the orthogonal factor and a stretch tensor from the positive factor, which is exactly the right polar decomposition F = R U taught in every continuum course.

Robotics, computer vision, and graphics pipelines solve the orthogonal Procrustes problem — find the rotation nearest a computed three-by-three map — by taking the polar factor of that map, which is cheaper and more stable on an edge worker than assembling an explicit dense SVD library. Control and identification codes that must project a nearly orthogonal matrix back onto O(n) after a noisy update do the same projection in one call. Failed validation does not consume balance.

Keep n at most sixteen, pin the rounded factors in tests, and you get reproducible U and P for homework, LMS plugins, and edge workers without importing a dense-linear-algebra library of your own.

Deformation gradient to rotation and stretch

Split a continuum-mechanics deformation gradient F = R U into an orthogonal rotation and a unique positive-semidefinite stretch for post-processing or constitutive checks.

Nearest orthogonal matrix (Procrustes)

Project a noisy square map onto O(n) by reading the orthogonal polar factor, the unique closest rotation-or-reflection in the Frobenius norm.

Classroom and notebook checks

Let students submit an n-by-n matrix and verify U-transpose U = I, P = P-transpose, and A = U P against textbook methods.

What happens if the matrix is singular?

Polar decomposition still exists. P remains the unique PSD square root of A-transpose A.

How is polar decomposition different from SVD or QR?

SVD writes A = W Σ V-transpose with two orthogonals and a diagonal. Polar decomposition folds that into A = U P with one orthogonal and one PSD stretch (U = W V-transpose, P = V Σ V-transpose). QR uses a triangular factor, not a PSD one.

What do the two factors mean geometrically?

U is a rotation, or a rotation combined with a reflection, and P stretches space along perpendicular axes by the singular values. Applying P first and then U reproduces the original matrix.

Is this the right or the left polar decomposition?

The right one, A = U P, which most textbooks use. The left form writes the stretch on the left of U, built from A times its transpose, and it shares the same orthogonal factor.

How can I check the result?

Multiply U by its transpose and you should get the identity, and P should equal its own transpose. The residual of A minus U P, shown with the result, should be zero or extremely close to it.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/math/polar-decomposition

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/math/polar-decomposition \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"matrix":[[2,1],[0,3]]}'
{
  "matrix": [
    [
      2,
      1
    ],
    [
      0,
      3
    ]
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.polar_decomposition",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_n16
max_abs_entry1000000000000000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

This endpoint accepts an n-by-n array of finite numbers, runs a deterministic Jacobi singular-value decomposition with no network and no randomness, and returns both factor matrices plus the singular values, det(U), a residual of A minus U P, and an invertibility flag. A non-square or non-numeric payload fails with invalid_input and is not billed.

Input contract, Jacobi SVD path, and response shape

An optional integer precision between zero and fifteen (default ten) sets the decimal places used when rounding every numeric field in the response. Internally the solver builds the Gram matrix G = A-transpose A, runs a cyclic Jacobi eigen-decomposition of G to obtain G = V Λ V-transpose, takes singular values as the square roots of the clamped eigenvalues, forms P = V diag(σ) V-transpose, builds left singular vectors W by mapping each right vector through A and dividing by its singular value, completes the kernel with modified Gram-Schmidt against the standard basis, and sets U = W V-transpose. POST a JSON body whose required field matrix is a square array of rows of finite numbers: n rows, each with exactly n columns, with n at least one and at most sixteen. Aliases a, A, and mat are accepted. Missing matrix, a non-array, a jagged or rectangular layout, empty rows, non-finite entries, entries larger than ten to the fifteen in magnitude, or n above the published limit all fail with invalid_input naming the field; those failures are not billed. The response echoes n, the parsed matrix, the orthogonal factor, the positive-semidefinite factor, the descending singular values, det_orthogonal (plus or minus one for a well-conditioned U), a boolean is_invertible, the Frobenius residual of A minus U P, the precision used, and a short formula string. Pair the two factor matrices with your own plot if you need a picture; this endpoint returns numbers only and does not emit step-by-step prose beyond the formula field.

How do I compute the polar decomposition of a square matrix?

Send a square array of finite numbers in matrix (aliases a, A, mat). The API returns orthogonal U and positive-semidefinite P so that A = U P, plus singular values, det(U), and a Frobenius residual.

What if the input is not a square numeric matrix?

The task fails with invalid_input. Rectangular, jagged, empty, missing, or non-numeric payloads are rejected and are not billed.

What does the polar decomposition calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →