Connect via MCP →

Enter Calculation

Matrix A (comma or space separated, row per line)

Matrix B

Formula

Advertisement

Results

Hadamard Product (A ∘ B)
5 12 21 32
Dimensions 2 × 2
Sum of all elements 70

What is the Hadamard Product?

The Hadamard product, also called the element-wise or Schur product, multiplies two matrices of identical dimensions entry by entry. Unlike standard matrix multiplication, it does not combine rows and columns — instead each output element is simply the product of the two values in the same position. It is written \(A \circ B\) and is widely used in machine learning, signal processing, and image manipulation.

Two grids combined element by element into a third grid
The Hadamard product multiplies matrices entry-by-entry, keeping the same dimensions.

How to Use This Calculator

Set the number of rows and columns, then type the values of Matrix A and Matrix B. Put one matrix row on each line, separating numbers with spaces or commas. The calculator returns the resulting matrix where every entry equals \(A_{ij} \times B_{ij}\), plus the sum of all resulting elements.

The Formula Explained

For two \(m \times n\) matrices A and B, the Hadamard product \(C = A \circ B\) is the \(m \times n\) matrix defined by $$\left(\text{A} \circ \text{B}\right)_{ij} = A_{ij} \cdot B_{ij}\qquad 1 \le i \le \text{Rows},\; 1 \le j \le \text{Cols}$$ Both matrices must share the same shape; there is no row–column dot product as in ordinary multiplication.

Advertisement

Worked Example

Let \(A = [[1, 2], [3, 4]]\) and \(B = [[5, 6], [7, 8]]\). Then $$A \circ B = [[1\times5, 2\times6], [3\times7, 4\times8]] = [[5, 12], [21, 32]].$$ The sum of all elements is \(5 + 12 + 21 + 32 = 70\).

Two example 2x2 matrices multiplied element-wise into a result matrix
Each output entry equals the product of the matching entries from A and B.

FAQ

How is it different from normal matrix multiplication? Matrix multiplication takes dot products of rows and columns and requires inner dimensions to match. The Hadamard product just multiplies aligned entries and requires identical dimensions.

What if my matrices are different sizes? The Hadamard product is only defined for equal-size matrices. This tool fills missing entries with 0 based on the dimensions you set.

Where is it used? Common in neural networks (e.g., gating, dropout masks), covariance computations, and pixel-wise image operations.

Last updated: