For anyone stumbling upon this, the best way to apply an element-wise multiplication of n np.ndarray of shape (d, ) is to first np.vstack them and apply np.prod on the first axis:

>>> import numpy as np
>>>
>>> arrays = [
...   np.array([1, 2, 3]),
...   np.array([5, 8, 2]),
...   np.array([9, 2, 0]),
... ]
>>>
>>> print(np.prod(np.vstack(arrays), axis=0))
[45 32  0]
Answer from choucavalier on Stack Overflow
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.multiply.html
numpy.multiply — NumPy v2.2 Manual
Equivalent to x1 * x2 in terms of array broadcasting. ... >>> x1 = np.arange(9.0).reshape((3, 3)) >>> x2 = np.arange(3.0) >>> np.multiply(x1, x2) array([[ 0., 1., 4.], [ 0., 4., 10.], [ 0., 7., 16.]])
🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-multiply-in-python
numpy.multiply() in Python - GeeksforGeeks
July 11, 2025 - The numpy.multiply() is a numpy function in Python which is used to find element-wise multiplication of two arrays or scalar (single value).
Discussions

Elementwise multiplication of several arrays in Python Numpy - Stack Overflow
Coding some Quantum Mechanics routines, I have discovered a curious behavior of Python's NumPy. When I use NumPy's multiply with more than two arrays, I get faulty results. In the code below, i hav... More on stackoverflow.com
🌐 stackoverflow.com
python - Multiplication of two arrays in numpy - Stack Overflow
A third approach is to insert a new axis in one the arrays and then multiply, although this is a little more verbose: >>> (x[:, np.newaxis] * y).T array([[3, 6], [4, 8]]) For those interested in performance, here are the timings of the operations, from quickest to slowest, on two arrays of ... More on stackoverflow.com
🌐 stackoverflow.com
How to multiply two arrays of matrices in Python?
you need to use numpy for anything like this, except if it's some homework or you're just interested in seeing how it'd work in pure python More on reddit.com
🌐 r/learnpython
9
1
July 25, 2023
Element-wise multiply arrays with different axes [numpy]

Are you using arrays? If yes, you're in luck because the '*' is element by element multiplication and not matrix multiplication. Therefore:

import numpy as np

A = np.array([5, 4, 3, 2, 1])
B = np.array([[ 123.,    4.,    0.,    0.,    0.],
                    [   0.,    0.,    0.,   45.,    0.],
                    [   0.,    0.,  100.,   -5.,    0.]])

C = np.tile(A, (M, 1)) * B

D = A * B 

And as result you get:

>>> C
array([[ 615.,   16.,    0.,    0.,    0.],
       [   0.,    0.,    0.,   90.,    0.],
       [   0.,    0.,  300.,  -10.,    0.]])
>>> D
array([[ 615.,   16.,    0.,    0.,    0.],
       [   0.,    0.,    0.,   90.,    0.],
       [   0.,    0.,  300.,  -10.,    0.]])

And if you're working with matrices, use multiply() to have element-wise multiplication (which is what you're trying to do)

https://docs.scipy.org/doc/numpy-dev/user/numpy-for-matlab-users.html#array-or-matrix-which-should-i-use

More on reddit.com
🌐 r/learnpython
5
9
February 23, 2016
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.multiply.html
numpy.multiply — NumPy v2.4 Manual
The * operator can be used as a shorthand for np.multiply on ndarrays. >>> x1 = np.arange(9.0).reshape((3, 3)) >>> x2 = np.arange(3.0) >>> x1 * x2 array([[ 0., 1., 4.], [ 0., 4., 10.], [ 0., 7., 16.]])
🌐
w3resource
w3resource.com › python-exercises › numpy › basic › numpy-basic-exercise-59.php
NumPy: Multiply two given arrays of same size element-by-element - w3resource
August 28, 2025 - By applying element-wise multiplication, the program generates a new array containing the products of the corresponding elements from the two input arrays, facilitating various computational tasks such as linear algebra operations or data transformations. ... # Importing the NumPy library with an alias 'np' import numpy as np # Creating two NumPy arrays 'nums1' and 'nums2' containing 2x3 matrices nums1 = np.array([[2, 5, 2], [1, 5, 5]]) nums2 = np.array([[5, 3, 4], [3, 2, 5]]) # Printing the contents of 'nums1' array print("Array1:") print(nums1) # Printing the contents of 'nums2' array print("Array2:") print(nums2) # Performing element-wise multiplication of arrays 'nums1' and 'nums2' using np.multiply() # This operation multiplies corresponding elements of the two arrays print("\nMultiply said arrays of same size element-by-element:") print(np.multiply(nums1, nums2))
🌐
Medium
medium.com › @whyamit101 › different-ways-to-multiply-arrays-in-numpy-65aa2522e265
Different Ways to Multiply Arrays in NumPy | by why amit | Medium
February 9, 2025 - Key Tip: For this to work, your arrays need to have the same shape. If they don’t, NumPy will throw an error unless it can broadcast them. (More on broadcasting in a moment!) You might be wondering: What’s the difference between matrix multiplication and element-wise multiplication? Well, matrix multiplication involves rows and columns interacting to produce a single matrix. This is particularly useful in linear algebra or machine learning tasks. ... # Define two 2D arrays (matrices) matrix1 = np.array([[1, 2], [3, 4]]) matrix2 = np.array([[5, 6], [7, 8]]) # Matrix multiplication using @ result = matrix1 @ matrix2 print("Matrix multiplication using @:\n", result) # Matrix multiplication using np.dot() result_dot = np.dot(matrix1, matrix2) print("Matrix multiplication using np.dot():\n", result_dot)
🌐
Programiz
programiz.com › python-programming › numpy › methods › multiply
NumPy multiply() (With Examples)
numpy.multiply(array1, array2, out=None) The multiply() function takes following arguments: array1 and array2 - two input arrays to be multiplied element-wise · out (optional) - the output array where the result will be stored · Note: array1 and array2 must have the same shape unless one ...
Find elsewhere
🌐
DigitalOcean
digitalocean.com › community › tutorials › numpy-matrix-multiplication
NumPy Matrix Multiplication: Methods and Examples | DigitalOcean
August 4, 2022 - The result is the same as the matmul() function for one-dimensional and two-dimensional arrays. import numpy as np arr1 = np.array([[1, 2], [3, 4]]) arr2 = np.array([[5, 6], [7, 8]]) arr_result = np.dot(arr1, arr2) print(f'Dot Product of arr1 and arr2 is:\n{arr_result}') arr_result = np.dot(arr2, ...
🌐
Sharp Sight
sharpsight.ai › blog › numpy-multiply
How to Use the Numpy Multiply Function - Sharp Sight
November 12, 2021 - As you might have guessed, the Numpy multiply function multiplies matrices together. You can use np.multiply to multiply two same-sized arrays together. This computes something called the Hadamard product.
🌐
Vultr Docs
docs.vultr.com › python › third-party › numpy › multiply
Python Numpy multiply() - Multiply Array Elements | Vultr Docs
November 18, 2024 - The numpy.multiply() function is essential for performing efficient element-wise multiplication of arrays in Python using the NumPy library. Whether you are working with scalars and arrays or two different-sized matrices, numpy.multiply() supports ...
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.multiply.html
numpy.multiply — NumPy v2.1 Manual
Equivalent to x1 * x2 in terms of array broadcasting. ... >>> x1 = np.arange(9.0).reshape((3, 3)) >>> x2 = np.arange(3.0) >>> np.multiply(x1, x2) array([[ 0., 1., 4.], [ 0., 4., 10.], [ 0., 7., 16.]])
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › numpy element wise multiplication
NumPy Element Wise Multiplication - Spark By {Examples}
March 27, 2024 - The NumPy multiply() function can be used to compute the element-wise multiplication of two arrays with the same shape, as well as multiply an array with
🌐
NumPy
numpy.org › doc › 2.0 › reference › generated › numpy.multiply.html
numpy.multiply — NumPy v2.0 Manual
The * operator can be used as a shorthand for np.multiply on ndarrays. >>> x1 = np.arange(9.0).reshape((3, 3)) >>> x2 = np.arange(3.0) >>> x1 * x2 array([[ 0., 1., 4.], [ 0., 4., 10.], [ 0., 7., 16.]])
🌐
Educative
educative.io › blog › numpy-matrix-multiplication
NumPy matrix multiplication: Get started in 5 minutes
April 30, 2026 - There are three main ways to perform NumPy matrix multiplication: np.dot(array a, array b): returns the scalar or dot product of two arrays
🌐
Medium
medium.com › @heyamit10 › numpy-multiply-in-python-7914322b2888
numpy.multiply() in Python. If you think you need to spend $2,000… | by Hey Amit | Medium
February 8, 2025 - Multiplying Arrays of Different Shapes (Broadcasting) You might be wondering, “What happens when arrays don’t have the same shape?” · Don’t worry — NumPy handles this beautifully with a feature called broadcasting.
🌐
AskPython
askpython.com › home › numpy multiply – illustrated in a simple way
NumPy multiply - Illustrated in a Simple Way - AskPython
February 16, 2023 - Here, we created a vector or a 1-D array having 3 elements and a 2-D array or matrix of size 2×3 i.e. having 2 rows and 3 columns. In the following lines, the function np.multiply(a,b) is called by passing a and b as arguments where a is the vector and b is the matrix. In this situation, NumPy performs broadcasting.