Characteristic polynomial calculator
Get the characteristic polynomial of any square matrix up to 12×12: the matrix with rows 2, 1 and 1, 2 gives λ² − 4λ + 3, with its trace of 4 and determinant of 3 shown as checks. 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.
You can send the matrix as nested arrays or as plain text rows, and you get the same deterministic answer every time. Non-square or non-numeric input is rejected with a clear error instead of silent nonsense.
What the characteristic polynomial actually tells you
The characteristic polynomial of a square matrix A, written p(λ) = det(λI − A), is the single most compact fingerprint a matrix has. Its roots are exactly the eigenvalues of A, counting multiplicity, so almost every question about spectral behavior — stability of a dynamical system, resonance frequencies of a structure, the long-run growth of a recurrence — begins by writing this polynomial down.
Two coefficients are famous in their own right: the coefficient of λⁿ⁻¹ is minus the trace of A, and the constant term is plus or minus the determinant, depending on whether the dimension is even or odd. The Cayley–Hamilton theorem adds that every matrix satisfies its own characteristic polynomial, which is the trick behind computing high matrix powers and matrix exponentials without diagonalizing. When you compute p(λ) by hand you expand a determinant with λ on the diagonal, which is error-prone beyond 2×2.
How the coefficients are computed
Instead of symbolically expanding det(λI − A) — which generates intermediate expression swell and is slow to do generically — the solver uses the Faddeev–LeVerrier recursion, a classical algorithm that recovers every coefficient with nothing but matrix multiplication and traces. Starting from the identity matrix, each step multiplies by A, takes the trace, and divides by minus the step index, yielding one new coefficient per iteration: n multiplications for an n×n matrix, O(n³) arithmetic overall.
The recursion is exact in exact arithmetic and well behaved in floating point for the modest sizes this tool accepts. Two independent checks ship with every answer: the second coefficient must equal minus the trace, and the last coefficient must equal the determinant up to sign, and both derived values are returned alongside the coefficient vector so you can sanity-check against your own computation.
Input format, errors and limits
You can send the matrix two ways. Every entry must be a finite number with absolute value up to 10¹², and the dimension is capped at 12×12 — above that, floating-point coefficient growth makes a generic numeric answer misleading and you should be using a dedicated computer algebra system anyway. Errors are never charged; only successful computations count against your usage.
What you can do with it
Feed a polynomial root finder
Get the coefficients of p(λ) programmatically and pass them to a root-finding step to obtain eigenvalues for matrices larger than the closed-form 2×2 case.
Check homework and textbook exercises
Verify a hand-computed characteristic polynomial for 3×3 or 4×4 matrices, with the trace and determinant checks confirming every coefficient.
Analyze linear dynamical systems
Extract the characteristic polynomial of a state matrix to study stability, since the root locations of p(λ) determine whether the system converges or diverges.
FAQ
What exactly is returned?
The coefficients of p(λ) = det(λI − A) as an array, leading coefficient first (always 1, since the polynomial is monic), plus the polynomial as a string, the trace, the determinant, and a step-by-step trace of the recursion.
Why was my matrix rejected?
The matrix must be square: every row must have exactly as many entries as there are rows.
Which algorithm is used?
The Faddeev–LeVerrier recursion, which computes each coefficient from matrix products and traces in O(n³) arithmetic, without symbolic determinant expansion.
Is my matrix stored anywhere?
No. The matrix is processed in memory and discarded; only the polynomial result is returned.
How do I get the eigenvalues from the polynomial?
Find its roots: they are exactly the eigenvalues of the matrix, counted with multiplicity. For λ² − 4λ + 3 the roots are 1 and 3, so those are the eigenvalues of the example matrix.
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/math/characteristic-polynomial \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"matrix":[[2,1],[1,2]]}'const res = await fetch("https://api.kit.forhosting.com/math/characteristic-polynomial", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"matrix": [
[
2,
1
],
[
1,
2
]
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/characteristic-polynomial",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"matrix": [
[
2,
1
],
[
1,
2
]
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/characteristic-polynomial", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"matrix":[[2,1],[1,2]]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"matrix":[[2,1],[1,2]]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/characteristic-polynomial", 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,
2
]
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.characteristic_polynomial",
"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.
Limits
max_abs | 1000000000000 |
max_dim | 12 |
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
The characteristic polynomial API takes a square matrix — up to 12×12 — and returns the coefficients of p(λ) = det(λI − A), leading coefficient first, computed with the Faddeev–LeVerrier recursion. It also returns the trace and determinant as built-in checks, and a human-readable polynomial string ready to paste into a report. It runs free in your browser on this page, and costs $0.002 per request when you call the API from your own code.
What the characteristic polynomial actually tells you
This endpoint does the expansion numerically and deterministically for any square matrix up to 12×12, and hands you the coefficients in a form you can feed straight into a root finder, a symbolic tool, or your own pipeline.
How the coefficients are computed
All numbers are rounded to a fixed twelve decimal places, which is what makes the free browser version and the paid API return byte-identical JSON on every machine.
Input format, errors and limits
API clients usually pass nested JSON arrays — an array of rows, each row an array of numbers — while the web form accepts pasted text with one row per line (or separated by semicolons) and entries separated by commas or spaces; both forms are validated identically. The matrix must be square: if any row has a different length than the row count, the request is rejected with an invalid_input error that says exactly which row is wrong, because a rectangular matrix has no characteristic polynomial in this sense. The endpoint is pure computation: nothing is stored, nothing is sent to a third party, and the same input always produces the same output.
Technical questions
What does it cost?
$0.002 per request. It is also free to run in your browser on this page — same code, same result.
Are the results exact?
For integer matrices of small size the coefficients are typically exact integers after rounding; all values are rounded to twelve decimal places so the browser and the API always agree byte for byte.