# Matrix Determinant Calculator

> Computes the determinant of a 2×2, 3×3 or 4×4 matrix by Laplace (cofactor) expansion along the first row, and reports whether the matrix is singular, its trace and its rank.

- Calculator id: `matrix-determinant` · Category: Math (`math`) · Tool name: `calculate_matrix_determinant`
- Canonical page: https://tttkmbb.com/math/matrix-determinant · This document: https://tttkmbb.com/math/matrix-determinant.md · JSON definition: https://tttkmbb.com/math/matrix-determinant.json

## Purpose

Computes the determinant of a 2×2, 3×3 or 4×4 matrix by Laplace (cofactor) expansion along the first row, and reports whether the matrix is singular, its trace and its rank.

**Use when:** You need the determinant of a small square matrix, want to check whether it is invertible, or need its rank or trace.

**Do not use when:** You need the inverse matrix itself (use matrix-inverse), want to solve equations (use linear-system), or the matrix is larger than 4×4.

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `matrix` | number_list |  | required | All entries row by row: 4 values for 2×2, 9 for 3×3, 16 for 4×4. [[1, 2], [3, 4]] is entered as 1, 2, 3, 4. |
| `size` | integer |  | optional | Matrix dimension n (2, 3 or 4). Optional: inferred from the number of entries when omitted. (min 2, max 4) |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `determinant` | number |  | det(A) by cofactor expansion along the first row. |
| `is_singular` | boolean |  | true when the determinant is 0 (the matrix has no inverse). |
| `expansion` | string |  | The first-row expansion with the numbers filled in, e.g. '1·4 − 2·3 = -2'; for 3×3 and 4×4 each term shows the entry times its minor. |
| `trace` | number |  | Sum of the diagonal entries. |
| `rank` | integer |  | Number of linearly independent rows (Gaussian elimination). |
| `size` | integer |  | Dimension n of the matrix. |

## Formula

`2×2: det = a·d − b·c; n×n: det = Σ_j (−1)^(1+j) · a_1j · M_1j, where M_1j is the determinant of the matrix without row 1 and column j (Laplace expansion)`

## Data Sources

- Wikipedia – Determinant — https://en.wikipedia.org/wiki/Determinant (reference, retrieved 2026-09-24)
- Wikipedia – Laplace expansion — https://en.wikipedia.org/wiki/Laplace_expansion (reference, retrieved 2026-09-24)
- Wolfram MathWorld – Determinant — https://mathworld.wolfram.com/Determinant.html (reference, retrieved 2026-09-24)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/matrix-determinant?matrix=…`
- `POST https://tttkmbb.com/api/v1/calculate/matrix-determinant` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/matrix-determinant · OpenAPI operationId `calculate_matrix_determinant` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "matrix-determinant", "inputs": {…}}`

## Example

- [[1, 2], [3, 4]]: inputs `{"matrix":[1,2,3,4],"size":2}` → `{"determinant":-2,"is_singular":false,"expansion":"1·4 − 2·3 = -2","trace":5,"rank":2,"size":2}`
- [[6, 1, 1], [4, -2, 5], [2, 8, 7]]: inputs `{"matrix":[6,1,1,4,-2,5,2,8,7]}` → `{"determinant":-306,"is_singular":false,"expansion":"6·(-54) − 1·(18) + 1·(36) = -306","trace":11,"rank":3,"size":3}`

```
GET https://tttkmbb.com/api/v1/calculate/matrix-determinant?matrix=1%2C2%2C3%2C4&size=2
```

## Limitations

You need the inverse matrix itself (use matrix-inverse), want to solve equations (use linear-system), or the matrix is larger than 4×4. All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**What does a zero determinant mean?**

The rows (and columns) are linearly dependent: the matrix has no inverse, and the linear system it represents has no unique solution. The rank output shows how many independent rows remain.

**Is the result exact?**

For integer entries the cofactor expansion uses only integer multiplications and additions, so the determinant is exact as long as intermediate products stay below 2^53.

## Related

- [Matrix Inverse Calculator](https://tttkmbb.com/math/matrix-inverse.md) — Inverse and adjugate of the same matrix.
- [System of Linear Equations Solver](https://tttkmbb.com/math/linear-system.md) — Cramer's rule uses these determinants to solve equations.
- [Vector Calculator](https://tttkmbb.com/math/vector-operations.md) — The 3D cross product is a 3×3 determinant.
