Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Hadamard Product (element-wise)


Symbolic visualization of A ⊙ B = C, cell by cell. Not to be confused with standard matrix multiplication.

Dimensions (shared by A and B)?The Hadamard product (denoted A ⊙ B) multiplies element-by-element: each entry of the result is the product of the corresponding entries of the two operands. It requires them to have the same shape — the result keeps that same shape. The same idea applies to vectors and to matrices. Note: this is NOT the standard matrix product A × B, which pairs rows with columns and has different shape requirements; the Hadamard product just pairs entries.
A, B2×3
A2×3
a1,1
a1,2
a1,3
a2,1
a2,2
a2,3
⊙
B2×3
b1,1
b1,2
b1,3
b2,1
b2,2
b2,3
=
C2×3
?
?
?
?
?
?
Step 1 / 8

Step explanations

1Hadamard product (element-wise)
Both A and B are 2×3. To compute C = A ⊙ B, pair up each cell of A with its counterpart in B and multiply them. The result C has the same shape.
Identical shapes required - the opposite of what standard matrix multiplication asks for. Learn more about the opening scene · how it differs from AB














Key Terms

Hadamard product — the element-wise product of two matrices of the same shape, denoted A⊙BA \odot B. Each entry of the result is the product of the corresponding entries: ci,j=ai,j⋅bi,jc_{i,j} = a_{i,j} \cdot b_{i,j}.

Schur product — alternative name for the Hadamard product.

Element-wise (pointwise) operation — an operation applied independently to each pair of corresponding entries; the result at (i,j)(i,j) depends only on the inputs at (i,j)(i,j).

Same-shape requirement — both operands must have identical dimensions. A 2×32 \times 3 matrix cannot be Hadamard-multiplied with a 3×23 \times 2.

Standard matrix product — the row-by-column product A×BA \times B, a different operation with different shape rules and a different result.

⊙\odot symbol — the circle-dot operator, the standard notation distinguishing the Hadamard product from A×BA \times B or ABAB.

Getting Started with the Visualizer

Set the shape, then watch A⊙B=CA \odot B = C build one cell at a time.

• Use the Dimensions steppers to set the shared shape of AA and BB (1 to 5 in each direction)
• Hover the ? icon for a full explanation of the Hadamard product and how it differs from the standard matrix product
• Press play on the scene player or step manually with the back and next buttons
• Adjust speed and use the step log on the right to scroll through completed cells

There is no operation toggle — the Hadamard product is a single operation, fully determined by the shape of the operands.

Reading the Scene Player

Each scene focuses on one cell of CC and combines highlights with arrows.

• The active cell in AA is highlighted primary, the matching cell in BB as secondary, and the destination cell in CC as accent
• Two curved arrows flow from ai,ja_{i,j} and bi,jb_{i,j} into ci,jc_{i,j}, making the data flow explicit
• Each filled cell of CC shows its symbolic content ai,j⋅bi,ja_{i,j} \cdot b_{i,j}
• The step log on the right keeps a record of every completed cell

By the final scene, every cell of CC contains its symbolic product and the operation is complete.

The Opening Scene: Two Matrices, Same Shape

The player starts with AA and BB side by side and CC empty on the right, all three 2×32 \times 3 at the default dimensions.

The setup looks exactly like the addition tool's, and that is not a coincidence: the Hadamard product has the same precondition and the same output shape. Only the operation applied to each pair differs.
A2×3a1,1a1,2a1,3a2,1a2,2a2,3⊙B2×3b1,1b1,2b1,3b2,1b2,2b2,3=C2×3??????
Opening scene, frozen

A and B at 2×3 with C empty. The same setup as matrix addition - identical shapes in, identical shape out - which is exactly what standard multiplication does not require.

Getting the precondition right matters more here than anywhere else in this section, because the operation shares a name with something that requires the opposite. Standard matrix multiplication needs the inner dimensions to agree — an m×nm \times n times an n×pn \times p — and produces an m×pm \times p result. The Hadamard product needs the shapes to be identical and returns that same shape.

So A⊙BA \odot B is defined here where ABAB is not: two 2×32 \times 3 matrices cannot be multiplied in the standard sense at all, since 3≠23 \neq 2.

One Cell at a Time

Each step highlights a cell of AA, the cell in the same position of BB, and the destination in CC, then writes the plain product ai,j⋅bi,ja_{i,j} \cdot b_{i,j} into it.

The frozen picture below is a step partway through the 2×32 \times 3 run: some cells of CC already hold their product, one pair is being multiplied, and the rest are placeholders.
A2×3a1,1a1,2a1,3a2,1a2,2a2,3⊙B2×3b1,1b1,2b1,3b2,1b2,2b2,3=C2×3a1,1·b1,1a1,2·b1,2a1,3·b1,3a2,1·b2,1??
Mid-sweep, frozen

One cell of A, the cell in the same position of B, and the destination in C. Two numbers multiplied, no row or column involved.

Compare this sweep against standard matrix multiplication and the difference is stark. There, a single output entry consumes an entire row of AA and an entire column of BB, and is a sum of products. Here, an output entry consumes exactly two numbers and is a single product.

That is why the Hadamard product is cheap — mnmn multiplications against the roughly mnpmnp of the standard product — and why it parallelises trivially. Nothing in one cell depends on anything in another.

The Completed Element-wise Product

The final scene fills every cell, so CC reads ci,j=ai,j bi,jc_{i,j} = a_{i,j} \, b_{i,j} throughout, at the same 2×32 \times 3 shape it started with.

Written that way, the Hadamard product is to multiplication what matrix addition is to addition: the underlying arithmetic applied entry by entry, with no mixing across positions.
A2×3a1,1a1,2a1,3a2,1a2,2a2,3⊙B2×3b1,1b1,2b1,3b2,1b2,2b2,3=C2×3a1,1·b1,1a1,2·b1,2a1,3·b1,3a2,1·b2,1a2,2·b2,2a2,3·b2,3
Completed product, frozen

All six cells filled with the plain product of the two entries above, and C still 2×3. No mixing across positions at any point.

The properties follow from the entries, as they did for addition. It is commutative, A⊙B=B⊙AA \odot B = B \odot A — which standard matrix multiplication emphatically is not — and associative, and it distributes over matrix addition. Its identity is the all-ones matrix, not the identity matrix II: multiplying element-wise by II would zero out everything off the diagonal.

That last point is the cleanest illustration that the two products are genuinely different operations wearing similar notation. An element-wise inverse exists only when every entry of AA is non-zero, and is found by reciprocating each entry — nothing like a matrix inverse, which needs a non-zero determinant and mixes every entry into every other.

Choosing Dimensions

The dimension steppers control the shape shared by all three matrices.

• Start with a small shape like 2×22 \times 2 or 2×32 \times 3 to see each cell pairing clearly
• Increase to 4×44 \times 4 or 5×55 \times 5 to see the operation scale — total scenes equal m×nm \times n
• Symbolic cell contents in CC shrink automatically when the shape is large, so ai,j⋅bi,ja_{i,j} \cdot b_{i,j} stays readable at 5×55 \times 5
• Square (n×nn \times n) and rectangular (m×nm \times n, m≠nm \neq n) shapes follow identical rules

The shape of CC is forced to match the shared shape of AA and BB — no separate control needed.

What the Hadamard Product Is

The Hadamard product is the element-wise product of two matrices of the same shape. For m×nm \times n matrices AA and BB:

C=A⊙B,ci,j=ai,j⋅bi,jC = A \odot B, \quad c_{i,j} = a_{i,j} \cdot b_{i,j}


Each entry of CC depends only on the matching pair of entries in AA and BB — no row or column interaction. The result CC has the same m×nm \times n shape as the operands.

The Hadamard product is the multiplicative analogue of matrix addition: both are element-wise, both require matched shapes, both preserve dimensions. It contrasts sharply with the standard matrix product A×BA \times B, which mixes rows with columns and changes shape.

For comprehensive theory, see matrix operations.

Hadamard vs Standard Matrix Multiplication

These two operations share the word "multiplication" but are fundamentally different.

• Notation: A⊙BA \odot B (Hadamard) vs ABA B or A×BA \times B (standard)
• Shape requirement: identical shapes (Hadamard) vs inner dimensions match (standard, m×km \times k times k×nk \times n)
• Result shape: same as operands (Hadamard) vs m×nm \times n (standard)
• Computation: pairwise product per cell (Hadamard) vs sum of row-column products (standard)
• Commutativity: commutative (Hadamard) vs generally non-commutative (standard)

For the standard product, see matrix multiplication. The two are confused often enough that the Hadamard product is sometimes spelled out as "element-wise product" to avoid ambiguity.

Key Properties

The Hadamard product satisfies the algebraic properties one would expect from an element-wise multiplication.

• Commutativity: A⊙B=B⊙AA \odot B = B \odot A
• Associativity: (A⊙B)⊙C=A⊙(B⊙C)(A \odot B) \odot C = A \odot (B \odot C)
• Distributivity over addition: A⊙(B+C)=A⊙B+A⊙CA \odot (B + C) = A \odot B + A \odot C
• Identity: the all-ones matrix JJ acts as identity: A⊙J=AA \odot J = A
• Scalar pull-out: (kA)⊙B=k(A⊙B)(kA) \odot B = k(A \odot B)
• Transpose: (A⊙B)T=AT⊙BT(A \odot B)^T = A^T \odot B^T

These properties mirror ordinary scalar multiplication exactly — which is unsurprising, since the operation is just scalar multiplication applied entry by entry.

Where the Hadamard Product Appears

The Hadamard product shows up wherever data lives in matrix form but the operation needs to be local.

• Machine learning: masking, gating in LSTMs and GRUs, attention weights applied element-wise
• Image processing: pointwise filters and masks applied to pixel grids
• Statistics: covariance scaling, weighted moment computations
• Numerical linear algebra: preconditioners and diagonal scaling can be expressed as Hadamard products
• Signal processing: windowing and apodization

The common thread: the matrix shape carries spatial or indexing structure, but the operation itself should not mix rows or columns.

Worked Example

Take AA and BB as 2×32 \times 3 matrices:

A=(123456),B=(789012)A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix}, \quad B = \begin{pmatrix} 7 & 8 & 9 \\ 0 & 1 & 2 \end{pmatrix}


Then C=A⊙BC = A \odot B is computed cell by cell:

C=(1⋅72⋅83⋅94⋅05⋅16⋅2)=(716270512)C = \begin{pmatrix} 1 \cdot 7 & 2 \cdot 8 & 3 \cdot 9 \\ 4 \cdot 0 & 5 \cdot 1 & 6 \cdot 2 \end{pmatrix} = \begin{pmatrix} 7 & 16 & 27 \\ 0 & 5 & 12 \end{pmatrix}


Compare with the standard product A×BA \times B: it is undefined here because AA is 2×32 \times 3 and BB is also 2×32 \times 3 — the inner dimensions (33 and 22) do not match. The Hadamard product has no such restriction beyond matching shapes.

Common Mistakes

The Hadamard product is simple, but a few recurring mistakes appear.

• Confusing it with the standard matrix product — by far the most common; check the notation (⊙\odot vs juxtaposition) and the shape rules
• Trying to Hadamard-multiply matrices of different shapes — there is no broadcasting rule in the strict mathematical definition
• Assuming the result is a different shape — A⊙BA \odot B has the same shape as both operands, unlike standard multiplication
• Using ⋅\cdot or ×\times for the Hadamard product — these notations strongly suggest the standard product and cause confusion
• Forgetting the operation is commutative — unlike standard matrix multiplication, A⊙B=B⊙AA \odot B = B \odot A always holds