Skip to content
Justice Tech School

Determinant and Inverse

np.linalg.det and np.linalg.inv work on square matrices. A matrix with zero determinant has no inverse.

Example
import numpy as np
a = np.array([[4, 7], [2, 6]])
print(round(np.linalg.det(a), 3))
inv = np.linalg.inv(a)
print(np.round(a @ inv, 3))

Result

10.0
[[ 1. -0.]
 [-0.  1.]]

Exercise

Find the determinant.

np.linalg.(a)

Quiz Test

What does a zero determinant mean?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.