# Defining Matrix using Numpy | Linear Algebra using Python

Linear Algebra using Python | Defining Matrix using Numpy: Here, we are going to learn how to define matrix using numpy in Python?
Submitted by Anuj Singh, on May 17, 2020

Linear algebra is the branch of mathematics concerning linear equations by using vector spaces and through matrices. Matrix is the key to linear algebra. All the linear algebra revolves around matrices. In previous tutorials, we defined the vector using the list and then with numpy. Defining a vector using a list is very fine and easy but it has some limitations. We can only define vectors through lists when there is only vector manipulation involved. As matrices are involved, then we have to use numpy.

Let's see how we can define a matrix using this library:

## Python code for Defining Matrix using Numpy

```# Linear Algebra Learning Sequence
# Defining a matrix using numpy

import numpy as np

# Use of np.array() to define a matrix
V1 = np.array([[1,2,3],[2,3,5],[3,6,8]])
V2 = np.array([[1,2],[3,4],[5,6]])

print("--The Matrix-- \n",V1)
print("--The Matrix-- \n",V2)
```

Output:

```--The Matrix--
[[1 2 3]
[2 3 5]
[3 6 8]]
--The Matrix--
[[1 2]
[3 4]
[5 6]]
```