Processing math: 100%

Matrix Determinant

The determinant of a matrix is a scalar value computed from a square matrix that gives us some very useful information. For example, it can tell us whether an inverse of a matrix exists. If the determinant of a matrix is zero, there is no inverse for a matrix. This also tells us useful information about solving linear equations.

Given matrix A such that:

A=(abcd)

then

det(A)=det([abcd])=adbc

Implementation in Numpy

The numpy.linalg.det method returns the determinant of a matrix

import numpy as np

A = np.array([3, 5, 1, 2, 5, 3, 3, 2, 1]).reshape(3,3)
A
array([[3, 5, 1], [2, 5, 3], [3, 2, 1]])
np.linalg.det(A)
21.00000000000001