Home »
Python »
Linear Algebra using Python
Determinant of Identity Matrix | Linear Algebra using Python
Linear Algebra using Python | Determinant of Identity Matrix: Here, we are going to learn about the determinant of identity matrix and its implementation in Python.
Submitted by Anuj Singh, on May 29, 2020
Prerequisites:
In linear algebra, the determinant is a scalar value that can be computed for a square matrix and represents certain properties of the matrix. The determinant of a matrix A is denoted det(A) or det A or |A|. The identity matrices have determinant one and this is one of the properties of the identity matrix. Using python library function, we will try to find the determinant of identity matrices.
Python code for demonstrating the determinant of identity matrix
# Linear Algebra Learning Sequence
# Determinant of Identity Matrix
import numpy as np
print(np.eye(4))
det_M = np.linalg.det(np.eye(4))
print("Determinant : ", det_M)
print("\n\n", np.eye(7))
det_M = np.linalg.det(np.eye(7))
print("Determinant : ", det_M)
Output:
[[1. 0. 0. 0.]
[0. 1. 0. 0.]
[0. 0. 1. 0.]
[0. 0. 0. 1.]]
Determinant : 1.0
[[1. 0. 0. 0. 0. 0. 0.]
[0. 1. 0. 0. 0. 0. 0.]
[0. 0. 1. 0. 0. 0. 0.]
[0. 0. 0. 1. 0. 0. 0.]
[0. 0. 0. 0. 1. 0. 0.]
[0. 0. 0. 0. 0. 1. 0.]
[0. 0. 0. 0. 0. 0. 1.]]
Determinant : 1.0