Skip to content
Math

Hadamard Product Calculator (Element-wise Matrix Multiplication)

Enter two matrices of the same size and this calculator instantly computes their Hadamard product, also called the element-wise or Schur product. Each entry of the result is simply the product of the two corresponding entries from the input matrices. Choose a matrix size from 1x1 up to 4x4, type your values as comma-separated rows, and get the full result with step-by-step working and key properties.

Your details

Both matrices must have the same number of rows and columns.
Enter each row separated by a semicolon (;) and values within a row separated by commas. Example for 2x2: "1, 2; 3, 4".
Must have the same dimensions as Matrix A. Example for 2x2: "5, 6; 7, 8".
Hadamard Product (A o B)
[[5, 12], [21, 32]]

The element-wise product matrix, C where c_ij = a_ij * b_ij.

Frobenius Norm of A5.4772
Frobenius Norm of B13.1909
Frobenius Norm of A o B40.4228
Commutative check (B o A)[[5, 12], [21, 32]]
Number of entries4
||A||_F5.4772
||B||_F13.1909
||A o B||_F40.4228

Hadamard product computed: A o B = [[5, 12], [21, 32]]

  • The Hadamard product multiplies 4 corresponding entry pairs to produce the result matrix.
  • Frobenius norms: ||A||_F = 5.4772, ||B||_F = 13.1909, ||A o B||_F = 40.4228.
  • The ratio ||A o B||_F / (||A||_F * ||B||_F) = 0.5595, which is always at most 1 by the Schur product theorem.
  • Because the Hadamard product is commutative, swapping A and B gives the identical result.

Next stepUse the step-by-step panel below to see each individual multiplication, or try a different matrix size to explore larger products.

Formula

(AB)ij=AijBij,ABFAFBF(A \circ B)_{ij} = A_{ij} \cdot B_{ij}, \quad \|A \circ B\|_F \leq \|A\|_F \cdot \|B\|_F

Worked example

Let A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]]. Then (A o B)[1][1] = 1*5 = 5, [1][2] = 2*6 = 12, [2][1] = 3*7 = 21, [2][2] = 4*8 = 32. Result: [[5, 12], [21, 32]]. Frobenius norm of result = sqrt(25 + 144 + 441 + 1024) = sqrt(1634) approximately 40.42.

What is the Hadamard product?

The Hadamard product of two matrices A and B, written A o B (or A with a small circle), is computed by multiplying the entries that sit in the same position: the entry in row i, column j of the result equals the entry in row i, column j of A times the entry in the same position of B. Both matrices must have identical dimensions; you cannot take the Hadamard product of a 2x3 matrix and a 3x2 matrix, for instance. The operation is also called the element-wise product, the entrywise product, or the Schur product after Issai Schur, who studied it in the early twentieth century. The term "Hadamard product" honors the French mathematician Jacques Hadamard.

How the Hadamard product differs from standard matrix multiplication

Standard matrix multiplication (also written AB or A*B) requires the number of columns of A to equal the number of rows of B, and each entry of the result is the dot product of a row of A with a column of B. The result can have completely different dimensions from either input. In contrast, the Hadamard product requires A and B to be identically sized, and the result is the same size as the inputs. Standard multiplication is generally not commutative (AB can differ from BA), but the Hadamard product is always commutative: A o B = B o A. In practice, standard multiplication is used to transform vectors and compose linear maps, while the Hadamard product is used when you want to apply a pointwise scaling or mask - common tasks in signal processing, statistics, and the internal computations of neural networks.

Where the Hadamard product appears in practice

Neural networks use the Hadamard product heavily. LSTM gates apply it when combining the cell state with a forget or input gate vector, and attention mechanisms scale value vectors pointwise. In image processing, multiplying a pixel matrix by a binary mask matrix selects a region of interest without any change to selected pixel values. In statistics, the Hadamard product of a covariance matrix with a correlation-like weight matrix is used in certain shrinkage estimators. In quantum computing, Hadamard matrices (related but distinct) are applied to qubits, but the product of two such matrices can be computed element-wise. Signal windowing in the frequency domain multiplies a time-domain signal vector by a window function vector element-by-element.

Frobenius norms and the Schur product theorem

The Frobenius norm of a matrix is the square root of the sum of the squares of all its entries, the matrix analogue of the Euclidean length of a vector. For the Hadamard product, the Schur product theorem guarantees that if both A and B are positive semidefinite, their Hadamard product is also positive semidefinite. For Frobenius norms, the inequality ||A o B||_F <= ||A||_F * ||B||_F always holds. This calculator shows the Frobenius norms of A, B, and the result so you can verify this inequality directly with your own values.

Key properties of the Hadamard product

PropertyFormulaNotes
CommutativityA o B = B o AOrder of operands does not matter
AssociativityA o (B o C) = (A o B) o CGrouping does not matter
DistributivityA o (B + C) = (A o B) + (A o C)Distributes over matrix addition
IdentityA o J = AJ is the all-ones matrix of the same size
Zero matrixA o 0 = 00 is the zero matrix of the same size
Norm inequality||A o B||_F <= ||A||_F * ||B||_FFrobenius norm sub-multiplicativity
Rank inequalityrank(A o B) <= rank(A) * rank(B)Always holds for finite-rank matrices
Scalar factor(c*A) o B = c * (A o B)Scalar pulls out of either operand

All properties hold for real-valued (and complex-valued) matrices of the same dimensions.

Frequently asked questions

Can I compute the Hadamard product of two vectors?

Yes. A vector is just a matrix with one row (row vector) or one column (column vector). Select a size such as 1x4 for row vectors or 4x1 for column vectors, enter your values in the same format, and the calculator multiplies them element-by-element. The result is a vector of the same shape.

What size matrices does this calculator support?

This calculator handles any rectangular matrix from 1x1 up to 4x4, including non-square shapes like 2x3 or 3x2. Select the row and column count from the size menu, then enter the entries for both matrices. Both matrices must be the same size.

Why is the Hadamard product also called the Schur product?

The operation was studied in detail by the mathematician Issai Schur in the early 1900s in the context of positive semidefinite matrices, which is why the result in that special case is often called the Schur product theorem. The name "Hadamard product" comes from Jacques Hadamard, who made foundational contributions to matrix theory around the same time. Both names refer to the same element-wise multiplication.

Is the Hadamard product the same as the Kronecker product?

No. The Kronecker product (also called the tensor product) of an m x n matrix A with a p x q matrix B produces a large mp x nq block matrix where each entry of A is replaced by that scalar multiplied by the entire matrix B. The Hadamard product keeps exactly the same dimensions and just multiplies matching entries. They are related: the Kronecker product of two diagonal matrices shares entries with the Hadamard product of their diagonals, but the operations are generally very different.

What happens if the two matrices have different sizes?

The Hadamard product is only defined when both matrices have exactly the same number of rows and the same number of columns. If the sizes differ, the operation is undefined and this calculator will show an empty result. Make sure both Matrix A and Matrix B have the same number of entries as the selected size, or choose a different size from the menu.

How is the Hadamard product used in neural networks?

In long short-term memory (LSTM) units and gated recurrent units (GRU), the gate outputs are combined with state vectors using the Hadamard product. For example, the forget gate vector (entries between 0 and 1) is multiplied element-by-element with the cell state vector to selectively erase parts of the memory. In attention mechanisms, learned weight vectors are applied pointwise to value vectors. In all these cases, the Hadamard product acts as a learnable, position-specific scaling.

Sources

Written by Dr. Rajiv Menon, PhD Applied Mathematician · Bengaluru, India

Applied mathematician bridging algebraic theory and computational tools for students, engineers, and everyday problem-solvers.

Search 3,500+ calculators

Loading search…