Skip to content
Related Articles

Related Articles

numpy.linalg.det() Method in Python

View Discussion
Improve Article
Save Article
  • Last Updated : 29 Jul, 2021
View Discussion
Improve Article
Save Article

In NumPy, we can compute the determinant of the given square array with the help of numpy.linalg.det(). It will take the given square array as a parameter and return the determinant of that.

Syntax: numpy.linalg.det() 
Parameter: An square array. 
Return: The determinant of that square array.

Example 1:

Python




import numpy as np
from numpy import linalg as LA
 
 
array1 = np.array([[1, 2], [3, 4]])
 
# Original 2-d array
print(array1)
 
# Determinant of the said 2-D array
print(np.linalg.det(array1))

Output:

[[1 2]
 [3 4]]
-2.0000000000000004

Example 2:

Python




import numpy as np
from numpy import linalg as LA
 
 
array1 = np.array([[1, 2, 3], [3, 4, 1], [3, 2, 1]])
 
# Original 2-d array
print(array1)
 
# Determinant of the said 2-D array
print(np.linalg.det(array1))

Output:

[[1 2 3]
 [3 4 1]
 [3 2 1]]
-15.999999999999998
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!