Advertisement

Hadamard product calculator

Set matching dimensions for two matrices, then enter both row by row. The Hadamard product multiplies entries in the same position instead of combining rows and columns.

Calculator

Hadamard product
5, 12; 21, 32
Trace of the result
37.00000000

Advertisement

How this calculator works

The Hadamard product, also called the entrywise product, requires matrices of the same shape. Each output entry is the product of the corresponding entries of the two inputs. It is different from ordinary matrix multiplication, which sums products across a row and a column. The Hadamard product is commutative and distributes over matrix addition.

Formula

(A o B)ij = Aij Bij, where the small circle denotes the Hadamard product.

Worked example

The Hadamard product of the matrices with rows 1, 2; 3, 4 and 5, 6; 7, 8 is 1x5, 2x6; 3x7, 4x8, which gives rows 5, 12; 21, 32. Its trace is 5 + 32 = 37.

Advertisement

Frequently asked questions

What is the difference from ordinary matrix multiplication?

Ordinary multiplication sums products of a row of A with a column of B. The Hadamard product multiplies only entries that sit in the same row and column.

Do the matrices need matching dimensions?

Yes. The entrywise product needs both matrices to have the same number of rows and columns, just like matrix addition.

Does the Hadamard product have an identity?

Yes, the all-ones matrix of the same shape. Multiplying any matrix entry by entry with all ones returns the original matrix.

Sources

Advertisement