Matrices.org

Hadamard Product Calculator

Calculate the Hadamard product of two matrices by multiplying corresponding elements. Enter matrices A and B to compute A ⊙ B, inspect each element-wise multiplication, and copy or download the resulting matrix.

Free calculator Element-wise multiplication Step-by-step calculations Linear algebra

Enter Your Matrices

Both matrices must have exactly the same number of rows and columns. The default example is ready to calculate.

Matrix A

Matrix B

Reset

Each matrix supports dimensions from 1 × 1 to 10 × 10. Applying dimensions preserves existing values wherever possible.

What Is the Hadamard Product?

The Hadamard product is a matrix operation that multiplies corresponding elements of two matrices. It is also known as the element-wise product or Schur product.

For two matrices A and B with the same dimensions, their Hadamard product is written as A ⊙ B. Each element of the result is the product of the elements in the same row and column of the input matrices.

A = [aij],   B = [bij]

A ⊙ B = [aijbij]

Unlike ordinary matrix multiplication, the Hadamard product does not calculate row-column dot products. It simply multiplies entries at matching positions.

Worked Example

Consider the following two 2 × 3 matrices:

Matrix A

[ 1   2   3 ]
[ 4   5   6 ]

Matrix B

[ 7   8   9 ]
[ 2   3   4 ]

Multiply the entries at each corresponding position:

A ⊙ B =
[ 1×7   2×8   3×9 ]
[ 4×2   5×3   6×4 ]
71627
81524

The final matrix is [[7, 16, 27], [8, 15, 24]]. For example, the element in row 2, column 1 is 4 × 2 = 8. The matrix dimensions remain 2 × 3.

Calculate Your Own Product

Hadamard Product vs. Matrix Multiplication

These two operations both involve multiplication, but they follow different rules and solve different mathematical problems.

Property Hadamard Product Ordinary Multiplication
Notation A ⊙ B AB
Dimension requirement Same dimensions Inner dimensions must match
Calculation Corresponding entries multiply Rows multiply columns using dot products
Output dimensions Same as A and B Rows of A by columns of B
Typical use Element-wise operations and masks Linear transformations and systems

For example, multiplying two 2 × 3 matrices using the Hadamard product produces a 2 × 3 matrix. Ordinary matrix multiplication of those same two matrices is undefined because the inner dimensions, 3 and 2, do not match.

Properties of the Hadamard Product

Commutativity

A ⊙ B = B ⊙ A. Reversing the order of the two matrices does not change the result.

Associativity

(A ⊙ B) ⊙ C = A ⊙ (B ⊙ C), provided all three matrices have matching dimensions.

Distributivity over addition

A ⊙ (B + C) = (A ⊙ B) + (A ⊙ C) whenever the matrix dimensions are compatible.

Identity element

The all-ones matrix J of the appropriate dimensions satisfies A ⊙ J = A. The all-zeros matrix produces an all-zeros result when multiplied element-wise by any compatible matrix.

Relation to diagonal matrices

The Hadamard product is not generally ordinary matrix multiplication. Its entries are calculated independently, which makes it useful for applying element-wise weights, masks, and filters.

Applications of the Hadamard Product

1. Machine learning and neural networks

Element-wise multiplication is used in neural-network gates, attention mechanisms, feature weighting, and operations involving matrices or tensors of matching shapes.

2. Digital image processing

An image matrix can be multiplied element by element by a mask or weighting matrix to suppress selected pixels or adjust individual values.

3. Statistics

The Hadamard product appears in covariance calculations, element-wise data transformations, and statistical models involving structured matrices.

4. Numerical computing

Scientific programs use element-wise operations to apply weights, combine arrays, and perform numerical transformations without calculating matrix multiplication.

Frequently Asked Questions

What is a Hadamard product calculator?

It is a tool that multiplies corresponding elements of two matrices with matching dimensions and displays the resulting matrix.

Do matrices need the same dimensions?

Yes. The Hadamard product requires the two matrices to have identical row and column counts.

How do you calculate the Hadamard product by hand?

Multiply the entry in row i, column j of matrix A by the entry in row i, column j of matrix B. Repeat this for every position.

Is the Hadamard product the same as the dot product?

No. The Hadamard product produces a matrix by multiplying corresponding entries. A vector dot product produces a scalar by summing products of corresponding entries.

Is the Hadamard product commutative?

Yes. For compatible matrices, A ⊙ B equals B ⊙ A because ordinary scalar multiplication is commutative at each position.

Does the Hadamard product change the matrix dimensions?

No. The output has exactly the same dimensions as the two input matrices.

Can matrices contain negative or decimal numbers?

Yes. This calculator accepts positive numbers, negative numbers, decimals, and zero.

Can I download the result?

Yes. Use the Download CSV button to save the calculated matrix in a spreadsheet-compatible format.

Related Matrix Calculators

Explore other matrix operations on Matrices.org.