Identity Matrix Transpose Property | Linear Algebra using Python

Linear Algebra using Python | Identity Matrix Transpose Property: Here, we are going to learn about the identity matrix transpose property 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, transpose of identity matrix gives identity matrix (IT = I).

Method 1:

Syntax:
    M = numpy.eye(n)
    transpose_M = M.T 
Parameter: 
    dimension of the matrix n
Return: 
    MT

Method 2:

Syntax:
    M = numpy.eye(n)
    transpose_M = numpy.transpose(M)
Input Parameter: 
    dimension of the matrix n
Return: 
    MT

Python code for identity matrix transpose property

# Linear Algebra Learning Sequence
# Transpose using different Method

import numpy as np

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

# Transposing the Matrix g
print('\n\nTranspose as I.T----\n', I.T)
print('\n\nTranspose as np.tanspose(I)----\n', np.transpose(I))

if I.T.all() == I.all():
    print("Transpose is eqaul to I")

Output:

---Matrix I---
 [[1. 0. 0. 0.]
 [0. 1. 0. 0.]
 [0. 0. 1. 0.]
 [0. 0. 0. 1.]]


Transpose as I.T----
 [[1. 0. 0. 0.]
 [0. 1. 0. 0.]
 [0. 0. 1. 0.]
 [0. 0. 0. 1.]]


Transpose as np.tanspose(I)----
 [[1. 0. 0. 0.]
 [0. 1. 0. 0.]
 [0. 0. 1. 0.]
 [0. 0. 0. 1.]]
Transpose is eqaul to I





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.