# Product of a Matrix and its Inverse Property | Linear Algebra using Python

Linear Algebra using Python | Product of a Matrix and its Inverse Property: Here, we are going to learn about the inverse of a matrix and its implementation in Python.
Submitted by Anuj Singh, on June 04, 2020

Prerequisites:

In linear algebra, an nxn square matrix A can be called as invertible if its inverse exists. Notice that, there cannot be a non-square matrix whose inverse exists. In this tutorial, we are going to check and verify one of the properties of Invertible Matrices.

A.A-.1 = I

## Python code to find the product of a matrix and its inverse property

```# Linear Algebra Learning Sequence
# Inverse Property A.AI = I  [AI = inverse of A]

import numpy as np

M = np.array([[2,3,4], [4,4,8], [4,8,7]])
print("---Matrix A---\n", M)

MI = np.linalg.inv(M)
print('\n\nInverse of A (AI) as ----\n', MI)

pro = np.dot(MI,M)
print('\n\nProduct of Matrix A with its Inverse : A * AI = I \n\n', pro)
```

Output:

```---Matrix A---
[[2 3 4]
[4 4 8]
[4 8 7]]

Inverse of A (AI) as ----
[[-9.    2.75  2.  ]
[ 1.   -0.5   0.  ]
[ 4.   -1.   -1.  ]]

Product of Matrix A with its Inverse : A * AI = I

[[1. 0. 0.]
[0. 1. 0.]
[0. 0. 1.]]
```

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