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

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.