# Multiply two matrices

Matrix multiplication is an operation between two matrices, which takes the dot product of rows and columns of the matrices to produce a new matrix. NumPy makes it flexible to calculate the product of two matrices by using various available methods. In this thread, we will discuss some techniques to multiply two matrices using NumPy.

#### 1. By "dot()" function:

The most straightforward method is to use NumPy’s `dot()` function, which performs matrix multiplication between two arrays. The NumPy `dot()` function is used to perform matrix multiplication or dot product between two arrays. The arrays must have compatible dimensions, where the number of columns in the first array must be equal to the number of rows in the second array

Here’s the example given below to gain better understanding:

#### 2. The "@" operator:

The `@` operator in NumPy is a shorthand notation for the `dot()` function. It is used to perform matrix multiplication or dot product between two arrays in the same way as the `dot()` function.

Here’s the example given below to get better concept:

#### 3. By "matmul()" function:

The NumPy `matmul()` function is used to perform matrix multiplication or dot product between two arrays. It is similar to the `dot()` function, but with some differences in how it handles input arrays with more than two dimensions
Here’s the example given below that demonstrates the use of `matmul()` function:

`Note:` The `matmul()` function can handle input arrays with more than two dimensions by broadcasting the arrays as necessary to perform the matrix multiplication. In contrast, the `dot()` function can only handle input arrays with up to two dimensions