← Back to challenges

Matrix Determinant

PythonHardmathalgorithmsalgebraarrays

Instructions

Create a function that returns the determinant of a given square matrix.

Examples

determinant([[3]]) ➞ 3

determinant([[1, 0], [5, 4]]) ➞ 4

determinant([[3, 0], [2, 2]]) ➞ 6

determinant([[4, 8, 6], [2, 4, 3], [6, 2, 1]]) ➞ 0

Notes

All inputs are square integer matrices.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.