Numpy ndarray.dot() function | Python Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The numpy.ndarray.dot() function computes the dot product of two arrays. It is widely used in linear algebra, machine learning and deep learning for operations like matrix multiplication and vector projections.Example: Python import numpy as np a = np.array([1, 2, 3]) b = np.array([4, 5, 6]) result = np.dot(a, b) print(result) Output32 Understanding the Dot ProductIf both inputs are 1D arrays, dot() computes the inner product, resulting in a scalar.If either input is an N-dimensional array, dot() performs matrix multiplication.If one input is a scalar, dot() performs element-wise multiplication.Syntax : numpy.ndarray.dot(arr, out=None) Parameters:arr (array_like) : The input array for the dot product.out (ndarray, optional): Output argument (stores the result).Returns:A scalar, vector or matrix depending on input shape.Code ImplementationCode #1 : Using numpy.ndarray.dot() for Matrix Multiplication Python import numpy as geek arr1 = geek.eye(3) arr = geek.ones((3, 3)) * 3 gfg = arr1.dot(arr) print(gfg) Output[[3. 3. 3.] [3. 3. 3.] [3. 3. 3.]] Code #2 : Performing Multiple Dot Products Python import numpy as geek arr1 = geek.eye(3) arr = geek.ones((3, 3)) * 3 gfg = arr1.dot(arr).dot(arr) print(gfg) Output[[27. 27. 27.] [27. 27. 27.] [27. 27. 27.]] In this article, we explored the numpy.ndarray.dot() function, which computes the dot product of two arrays. We demonstrated its application using identity matrices and uniform arrays, highlighting its significance in matrix operations and numerical computing. Comment More info S sanjoy_62 Follow Improve Article Tags : Machine Learning Python-numpy Python numpy-ndarray python Explore Machine Learning BasicsIntroduction to Machine Learning8 min readTypes of Machine Learning13 min readWhat is Machine Learning Pipeline?7 min readApplications of Machine Learning3 min readPython for Machine LearningMachine Learning with Python Tutorial5 min readNumPy Tutorial - Python Library3 min readPandas Tutorial6 min readData Preprocessing in Python4 min readEDA - Exploratory Data Analysis in Python6 min readFeature EngineeringWhat is Feature Engineering?5 min readIntroduction to Dimensionality Reduction4 min readFeature Selection Techniques in Machine Learning6 min readSupervised LearningSupervised Machine Learning7 min readLinear Regression in Machine learning15+ min readLogistic Regression in Machine Learning11 min readDecision Tree in Machine Learning9 min readRandom Forest Algorithm in Machine Learning5 min readK-Nearest Neighbor(KNN) Algorithm8 min readSupport Vector Machine (SVM) Algorithm9 min readNaive Bayes Classifiers7 min readUnsupervised LearningWhat is Unsupervised Learning5 min readK means Clustering â Introduction6 min readHierarchical Clustering in Machine Learning6 min readDBSCAN Clustering in ML - Density based clustering6 min readApriori Algorithm6 min readFrequent Pattern Growth Algorithm5 min readECLAT Algorithm - ML3 min readPrincipal Component Analysis(PCA)7 min readModel Evaluation and TuningEvaluation Metrics in Machine Learning9 min readRegularization in Machine Learning5 min readCross Validation in Machine Learning7 min readHyperparameter Tuning7 min readML | Underfitting and Overfitting5 min readBias and Variance in Machine Learning10 min readAdvanced TechniquesReinforcement Learning8 min readSemi-Supervised Learning in ML5 min readSelf-Supervised Learning (SSL)6 min readEnsemble Learning8 min readMachine Learning PracticeTop 50+ Machine Learning Interview Questions and Answers15+ min read100+ Machine Learning Projects with Source Code [2025]6 min read Like