Matrix determinant calculator
Enter a square matrix and get its determinant: rows 2, 1 and 1, 3 give 5, so the matrix is invertible. You also see the sign, the absolute value and whether it is singular. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Runs in your browser. Free, unlimited — your data never leaves this page.
The determinant of a square matrix is a single scalar that encodes volume scaling, orientation, and invertibility for linear maps. For a one-by-one matrix it is simply the entry; for two-by-two it is the familiar ad minus bc product of the diagonals; for three-by-three the classical Laplace cofactor expansion along a row recovers the same polynomial that Sarrus diagrams illustrate in textbooks; for larger orders a stable LU factorization with partial pivoting multiplies the diagonal of U and multiplies by the sign of the row permutation. This calculator accepts a nested array of finite real numbers, verifies that every row has the same length equal to the number of rows, and returns the cleaned determinant together with its absolute value, sign, a singularity flag, the method used, and a short formula string. Non-square inputs, empty matrices, NaN, Infinity, and oversized grids are rejected with a clear validation error instead of a silent wrong answer.
How the determinant is computed
Begin with an n by n array of finite real numbers. The capability first checks that the structure is rectangular and square: every row must be an array whose length equals the number of rows. For n equals one the determinant is the single entry.
For n equals two the closed form multiplies the main diagonal and subtracts the product of the anti-diagonal. For n equals three the engine expands along the first row using two-by-two minors with alternating signs, which is exactly the Laplace cofactor expansion taught in linear algebra courses and is algebraically identical to the Sarrus diagram for real three-by-three matrices.
For n greater than or equal to four the engine factors a working copy of A into a unit lower-triangular L and an upper-triangular U after partial pivoting: at step k it swaps the current row with the row that holds the largest absolute entry in column k, records each swap as a sign flip, then eliminates below the pivot. If a pivot is numerically zero the matrix is treated as singular and the determinant is returned as zero.
Otherwise the product of the diagonal entries of U, multiplied by the accumulated permutation sign, is the determinant. Entries may arrive as numbers or numeric strings; NaN and Infinity fail validation.
Where matrix determinants show up in real work
Secondary-school and college linear algebra courses constantly assign cofactor drills, two-by-two area interpretations, and singularity checks before inversion; a single trusted oracle that returns det, sign, and method speeds grading and demo setup. Programming contest problems and interview warm-ups often ask whether a matrix is invertible, whether a parallelepiped volume is positive, or whether a change-of-basis matrix preserves orientation, and engineers need a numeric determinant rather than a silent NaN from an unchecked product.
Computer graphics and robotics compute signed volumes of tetrahedra and oriented bases, and a zero determinant flags a degenerate configuration before a later inverse blows up. Statistics and least-squares pipelines inspect Gram or covariance blocks for near-singularity as a cheap preflight before a more expensive factorization. If you later need matrix inverse, eigenvalues, rank, systems of linear equations, or symbolic determinants over polynomials, treat those as separate search intents and landings rather than overloading this determinant calculator page.
What you can do with it
Homework and exam answer keys
Generate det(A), singularity flags, and method labels for textbook 2×2, 3×3, and small n×n sets so teachers and auto-graders share one ground truth.
Invertibility and orientation checks
Test whether a change-of-basis or Jacobian matrix is singular and whether it preserves orientation via sign(det) before inversion or coordinate transforms.
Volumes and geometric degeneracy
Compute signed parallelepiped volumes from edge matrices and flag zero-volume degenerate configurations in graphics, CAD, and robotics pipelines.
FAQ
What methods does this matrix determinant calculator use?
Closed 1×1 and 2×2 formulas, Laplace cofactor expansion along the first row for 3×3, and LU factorization with partial pivoting for n ≥ 4. The response includes a method field so you can see which path ran.
What happens if the matrix is not square?
The determinant is only defined for square matrices; jagged rows or unequal row versus column counts are rejected with a message that names the failing row.
How do I know if the matrix is singular?
A numerically vanishing pivot during LU also yields determinant zero. Singular matrices are not invertible.
What is the maximum matrix size?
n ≤ 32. Larger dense factorizations are outside the free parse path; classroom and contest sizes are fully covered.
What does it cost?
The browser tool is free and runs locally.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/algebra/matrix-determinant \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"matrix":[[2,1],[1,3]]}'const res = await fetch("https://api.kit.forhosting.com/algebra/matrix-determinant", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"matrix": [
[
2,
1
],
[
1,
3
]
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/algebra/matrix-determinant",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"matrix": [
[
2,
1
],
[
1,
3
]
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/algebra/matrix-determinant", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"matrix":[[2,1],[1,3]]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"matrix":[[2,1],[1,3]]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/algebra/matrix-determinant", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"matrix": [
[
2,
1
],
[
1,
3
]
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "algebra.matrix_determinant",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
How the determinant is computed
Empty matrices and dimensions above thirty-two are rejected because the empty case is a edge convention that confuses beginners and large dense factorizations do not belong on a free parse Worker path. All arithmetic is deterministic floating-point code with no random seeds, no wall-clock timestamps, no network calls, and no model drift, so identical matrices always produce identical JSON.
What you send and what you get back
Every row must have the same length, and that length must equal the number of rows so the matrix is square. Classic textbook checks include the two-by-two matrix with rows two one and one three whose determinant is five, the three-by-three identity with determinant one, a singular matrix with a repeated row whose determinant is zero, and larger random-looking integer matrices whose LU product matches hand calculation. Send one required field named matrix: either a nested JSON array of rows of finite numbers, such as two comma one then one comma three for the classic two-by-two case, or a JSON string encoding the same nested array. Missing matrix, non-array shapes, jagged rows, non-numeric cells, NaN, Infinity, empty grids, and dimensions larger than thirty-two by thirty-two fail with invalid_input and are not charged. On success the response echoes the cleaned matrix with stable twelve-significant-digit rounding, the integer dimension n, the determinant as a number, abs_determinant, sign, is_singular, method as one of closed_1x1, closed_2x2, cofactor_expansion, or lu_partial_pivot, pivots counting row swaps on the LU path, and a short formula string describing the identity used. Pricing for successful API calls is the published base of $0.002 per item; validation failures do not consume prepaid balance.
Where matrix determinants show up in real work
Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.