- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

In this tutorial, we are going to learn how to multiply two matrices using the **NumPy** library in Python. It's straightforward with the **NumPy** library.

It has a method called **dot** for the matric multiplication. You can install the NumPy library with the following command.

pip install numpy

Let's see the steps involved in the program.

Import the NumPy library.

Initialize the matrices.

Multiply the matrices with numpy.dot(matrix_1, matrix_2) method and store the result in a variable.

Print the result.

See the below code.

# importing the module import numpy # initializing the matrices matrix_1 = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] matrix_2 = [ [7, 8, 9], [4, 5, 6],[1, 2, 3] ] # multiplying the two matrices result = numpy.dot(matrix1, matrix2) # printing the result print(result)

If you execute the above program, you will get the following results.

[[ 18 24 30] [ 54 69 84] [ 90 114 138]]

If you have any doubts in the tutorial, mention them in the comment section.

- Related Questions & Answers
- Multiplication of two Matrices in Single line using Numpy in Python
- Multiplication of two Matrices using Java
- How to Multiply Two Matrices using Python?
- How to Add Two Matrices using Python?
- Python program multiplication of two matrix.
- Python program to multiply two matrices
- How can Tensorflow be used to add two matrices using Python?
- How can Tensorflow be used to multiply two matrices using Python?
- How to multiply two matrices using pointers in C?
- Program for subtracting two matrices.
- C++ Program to Check Multiplicability of Two Matrices
- Add two vectors using broadcasting in Numpy
- Java program to add two matrices.
- Java program to subtract two matrices.
- Java program to multiply two matrices.

Advertisements