# Matrix determinant

`matrix-determinant` · version 1.0.0 · Vectors & matrices · free, no key needed

Compute the determinant of a small square finite-number matrix.

**Use when you need to: matrix determinant · det of a square matrix.**

## Supported

- matrix determinant
- det of a square matrix

## Not supported

- non-square matrices
- matrices larger than 12x12
- symbolic/exact-rational determinant

## Behavior

- Input matrix is a square NxN array of finite JSON numbers, N from 1 to 12, magnitude bounded to at most 1000000.
- Computed via Gaussian elimination with partial (largest-magnitude) pivoting in IEEE-754 double precision, accumulating the product of pivots with a sign flip per row swap.
- Results for small integer-valued matrices are typically exact; floating-point rounding can appear for larger, fractional, or ill-conditioned matrices.
- If, at any elimination step, every remaining candidate pivot in a column is exactly 0, the determinant is exactly 0 (the input matrix is singular).
- A result of -0 is normalized to 0.

## Input

- `matrix` (array of array of number, required): min items 1; max items 12

## Output

- `result` (number, required)

## Limits

- max dim: 12
- max abs value: 1000000

## Example

Request input:

```json
{
  "matrix": [
    [
      1,
      2
    ],
    [
      3,
      4
    ]
  ]
}
```

Response:

```json
{
  "result": {
    "result": -2
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "matrix-determinant",
  "version": "1.0.0",
  "input": {
    "matrix": [
      [
        1,
        2
      ],
      [
        3,
        4
      ]
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/matrix-determinant/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"matrix":[[1,2],[3,4]]}'
```

The machine-readable contract is at [/v1/tools/matrix-determinant/versions/1.0.0](/v1/tools/matrix-determinant/versions/1.0.0).

### CLI

```sh
node cli.mjs run matrix-determinant 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Matrix inverse](/tools/matrix-inverse): Compute the inverse of a small square finite-number matrix.
- [Matrix scale](/tools/matrix-scale): Multiply every entry of a finite-number matrix by a scalar.
- [Matrix trace](/tools/matrix-trace): Compute the trace (sum of diagonal entries) of a square finite-number matrix.
- [Matrix vector multiply](/tools/matrix-vector-multiply): Multiply an MxN finite-number matrix by a length-N finite-number vector, producing a length-M vector.
- [Vector outer product](/tools/vector-outer-product): Compute the outer product of two finite-number vectors, producing a matrix.
- [Matrix add](/tools/matrix-add): Add two equal-shape finite-number matrices elementwise.
