Matrix of cofactors calculator
A matrix of cofactors collects the signed minor associated with every position in a square matrix.
Run — free
Runs in your browser. Free, unlimited — your data never leaves this page.
This calculator performs the complete process: it removes each row and column in turn, evaluates the resulting determinant, and applies the alternating positive and negative sign pattern. The response includes both the unsigned matrix of minors and the final cofactor matrix, making it useful for checking hand calculations, preparing an adjugate, or explaining exactly where every result came from.
From one matrix entry to one cofactor
Each cofactor belongs to a particular row and column of the original square matrix. To calculate the entry at row i and column j, remove that entire row and column. The determinant of the smaller matrix that remains is the corresponding minor. The calculator repeats that operation for every position, so a three-by-three input produces nine minors and nine cofactors. This is more informative than returning only a determinant because you can inspect the intermediate minor values individually. Enter the matrix as a nested array, with one inner array per row. Every row must contain the same number of values as there are rows, and every value must be a finite real number. Decimal values and numeric strings are accepted. The original matrix may be singular: cofactors are still defined even when its determinant is zero. A one-by-one matrix is also supported; its sole cofactor is one because deleting its row and column leaves the empty matrix, whose determinant is conventionally one.
Apply the alternating checkerboard signs
A minor becomes a cofactor only after multiplication by the sign determined by its position. Starting in the top-left corner, the signs alternate across each row and down each column: positive, negative, positive on the first row; negative, positive, negative on the second; and so on. In symbols, the cofactor C at position i,j equals negative one raised to i plus j, multiplied by the minor determinant M at that position. This calculator exposes both `minors_matrix` and `cofactor_matrix`, letting you distinguish determinant arithmetic from sign changes. That distinction is especially helpful when diagnosing a homework error: if the magnitude is wrong, review the smaller determinant; if only the sign is wrong, review the checkerboard. Rows and columns are processed in their original order, and no transpose is applied. The returned cofactor matrix is therefore the signed matrix requested directly, not the adjugate. To obtain the adjugate for an inverse formula, transpose the cofactor matrix afterward.
Read and verify the result
The response reports the matrix dimension in `size`, followed by matching square arrays for minors and cofactors. Compare entries at even checkerboard positions, including the top-left corner, to see that their signs are unchanged; entries at alternating positions should be negated. For an additional verification, expand the original determinant along any row: multiply each original entry in that row by the cofactor in the same position, then add the products. Repeating the calculation along another row should give the same determinant. Cofactor matrices also lead directly to the classical inverse method. Transpose the cofactor matrix to obtain the adjugate, then divide every adjugate entry by the original determinant when that determinant is nonzero. The implementation evaluates minor determinants with pivoted elimination, which avoids the explosive recursion of a literal Laplace expansion while preserving the mathematical definition of each cofactor. Output numbers are normalized to stable precision so tiny floating-point residue and negative zero do not obscure otherwise clean results.
What you can do with it
Check a linear algebra exercise
Compare every unsigned minor and signed cofactor with a handwritten expansion to locate arithmetic or checkerboard-sign mistakes.
Prepare an adjugate matrix
Compute the full cofactor matrix before transposing it as the next step in the classical adjugate and inverse method.
Teach cofactor expansion
Show learners how deleting different rows and columns produces minor determinants and how position changes each sign.
FAQ
What does it cost?
The API price is $0.002 per matrix. The browser calculator can run the same deterministic computation locally for free.
Is the cofactor matrix the same as the adjugate?
No. The adjugate is the transpose of the cofactor matrix. This capability returns the cofactor matrix without transposing it.
Can I use a singular matrix?
Yes. Every cofactor is defined for a square matrix even when the determinant of the original matrix is zero.
Why are both minors and cofactors returned?
The minors show the raw smaller determinants, while the cofactors show those values after the alternating signs are applied.
What happens for a 1x1 matrix?
Its cofactor matrix is [[1]]. The only minor is the empty matrix, whose determinant is defined as one.
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-of-cofactors \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"matrix":[[1,2,3],[0,4,5],[1,0,6]]}'const res = await fetch("https://api.kit.forhosting.com/algebra/matrix-of-cofactors", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"matrix": [
[
1,
2,
3
],
[
0,
4,
5
],
[
1,
0,
6
]
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/algebra/matrix-of-cofactors",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"matrix": [
[
1,
2,
3
],
[
0,
4,
5
],
[
1,
0,
6
]
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/algebra/matrix-of-cofactors", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"matrix":[[1,2,3],[0,4,5],[1,0,6]]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"matrix":[[1,2,3],[0,4,5],[1,0,6]]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/algebra/matrix-of-cofactors", 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": [
[
1,
2,
3
],
[
0,
4,
5
],
[
1,
0,
6
]
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "algebra.matrix_of_cofactors",
"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_n | 10 |
max_abs_entry | 1000000000000 |
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. |