numpy.linalg.det() Method in Python

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 deteminant of that square array.

Example 1:



Python

filter_none

edit
close

play_arrow

link
brightness_4
code

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))

chevron_right


Output:

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

Example 2:

Python

filter_none

edit
close

play_arrow

link
brightness_4
code

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))

chevron_right


Output:

[[1 2 3]
 [3 4 1]
 [3 2 1]]
-15.999999999999998
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.