# Comparing Minimum from Matrices | Linear Algebra using Python

Linear Algebra using Python | Comparing Minimum from Matrices: Here, we are going to learn about the comparing minimum from matrices and its implementation in Python.
Submitted by Anuj Singh, on June 08, 2020

Prerequisites:

Learn: how to find the minimum value from comparison of each element in two matrices using an inbuilt function in the numpy library?

Syntax:

```numpy.minimum(Matrix_M1, Matrix_M2)
```

Return:

A matrix of same dimension with given matrix containing minimum value at each entry among both matrices.

## Python code for comparing minimum from matrices

```# Linear Algebra Learning Sequence
# Minimum Value Comparing

import numpy as np

M = np.array([[2,3,4], [4,4,8], [4,8455,7], [4,8,99] ])
MM = np.array([[2,3,46], [4,44,8], [4,8,7], [4,8,9] ])

print("\n\n---Matrix A---\n", M)
print("\n\n---Matrix B---\n", MM)
print('\n\n---minimum value comparasion : ', np.minimum(M,MM))
```

Output:

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

---Matrix B---
[[ 2  3 46]
[ 4 44  8]
[ 4  8  7]
[ 4  8  9]]

---minimum value comparasion :  [[2 3 4]
[4 4 8]
[4 8 7]
[4 8 9]]
```

Preparation

What's New

Top Interview Coding Problems/Challenges!