Identity Matrix Property (I^k = I) | Linear Algebra using Python

Linear Algebra using Python | Identity Matrix Property (Ik = I): Here, we are going to learn about identity matrix property (Ik = I) and its implementation in Python.
Submitted by Anuj Singh, on May 26, 2020

Prerequisites:

In linear algebra, the identity matrix, of size n is the n × n square matrix with ones on the main diagonal and zeros elsewhere. It is denoted by I. Also known as the unit matrix because its determinant value is 1 irrespective of size. This is the key feature of an Identity matrix and it plays an important role in Linear Algebra.

The identity matrix has the property that, Multiplying k identity matrices gives an identity matrix (Ik = I).

Python code for identity matrix property (Ik = I)

# Linear Algebra Learning Sequence
# Identity Matrix Property (I^k = I)

import numpy as np

# identity Matrix 
I = np.eye(4)   
print("\n---I(4x4)---\n", I)

k = 14
Ik = I

for i in range(14):
    Ik = I*Ik

print('\n\n--- I^k ----\n', Ik)

Output:

---I(4x4)---
 [[1. 0. 0. 0.]
 [0. 1. 0. 0.]
 [0. 0. 1. 0.]
 [0. 0. 0. 1.]]


--- I^k ----
 [[1. 0. 0. 0.]
 [0. 1. 0. 0.]
 [0. 0. 1. 0.]
 [0. 0. 0. 1.]]


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.