Hadamard Product Calculator
Our free linear algebra calculator solves hadamard product problems. Get worked examples, visual aids, and downloadable results.
Reviewed by Manoj Kumar, Mathematics Educator
Formula
(A * B)_ij = A_ij * B_ij (element-wise multiplication)
The Hadamard product multiplies corresponding entries of two same-sized matrices. Unlike standard matrix multiplication, it is commutative and requires identical dimensions. The sum of all entries in the Hadamard product equals the Frobenius inner product of the two matrices.
Worked Examples
Example 1: Basic 3x3 Hadamard Product
Problem:Compute the Hadamard product of A = [[1,2,3],[4,5,6],[7,8,9]] and B = [[9,8,7],[6,5,4],[3,2,1]].
Solution:C = A * B (element-wise):\nC[0][0] = 1*9 = 9, C[0][1] = 2*8 = 16, C[0][2] = 3*7 = 21\nC[1][0] = 4*6 = 24, C[1][1] = 5*5 = 25, C[1][2] = 6*4 = 24\nC[2][0] = 7*3 = 21, C[2][1] = 8*2 = 16, C[2][2] = 9*1 = 9\n\nC = [[9, 16, 21], [24, 25, 24], [21, 16, 9]]
Result:Hadamard product = [[9,16,21],[24,25,24],[21,16,9]] | Sum = 165 | Trace = 43
Example 2: Hadamard Product vs Matrix Product
Problem:Compare the Hadamard and standard matrix products of A = [[1,0],[0,1]] and B = [[2,3],[4,5]].
Solution:Hadamard product (element-wise):\nC = [[1*2, 0*3], [0*4, 1*5]] = [[2, 0], [0, 5]]\n\nStandard matrix product:\nAB = [[1*2+0*4, 1*3+0*5], [0*2+1*4, 0*3+1*5]] = [[2, 3], [4, 5]]\n\nFor the identity matrix, AB = B but A * B is a diagonal matrix with the diagonal of B.
Result:Hadamard: [[2,0],[0,5]] vs Standard: [[2,3],[4,5]] - very different results!
Frequently Asked Questions
What is the Hadamard product of two matrices?
The Hadamard product (also called the element-wise product or Schur product) is an operation that takes two matrices of the same dimensions and produces a matrix where each element is the product of the corresponding elements from the input matrices. For matrices A and B, the Hadamard product C = A * B has entries C_ij = A_ij * B_ij. Unlike standard matrix multiplication, which involves dot products of rows and columns, the Hadamard product simply multiplies matching positions. It was named after French mathematician Jacques Hadamard and is denoted by a circle with a dot inside or simply an asterisk in some notation systems.
How does the Hadamard product differ from standard matrix multiplication?
The Hadamard product and standard matrix multiplication are fundamentally different operations. Standard matrix multiplication (AB) involves dot products of rows of A with columns of B and requires the inner dimensions to match (columns of A = rows of B). The result can have different dimensions from the inputs. The Hadamard product requires both matrices to have exactly the same dimensions and simply multiplies corresponding entries. Standard multiplication is not commutative (AB is generally not equal to BA), while the Hadamard product is always commutative (A * B = B * A). The Hadamard product is also associative and distributes over addition.
What are the properties of the Hadamard product?
The Hadamard product has several important algebraic properties. It is commutative (A * B = B * A), associative ((A * B) * C = A * (B * C)), and distributes over addition (A * (B + C) = A * B + A * C). The identity element is the matrix of all ones (J), since A * J = A. The Hadamard product preserves positive semi-definiteness: if both A and B are positive semi-definite, then A * B is also positive semi-definite (Schur product theorem). It also satisfies the Oppenheim inequality: det(A * B) >= det(A) * product of diagonal entries of B, for positive semi-definite A and B.
What is the Frobenius inner product and how does it relate to the Hadamard product?
The Frobenius inner product of two matrices A and B is defined as the sum of all entries of their Hadamard product, or equivalently, trace(A^T * B). It measures the similarity between two matrices in the same way the dot product measures similarity between vectors. The Frobenius inner product equals the sum of all A_ij * B_ij. It induces the Frobenius norm: ||A||_F = sqrt(trace(A^T * A)) = sqrt(sum of squares of all entries). This connection between the Hadamard product and the Frobenius inner product is important in optimization, statistics, and machine learning where matrix similarity measures are needed.
References
Reviewed by Manoj Kumar, Mathematics Educator ยท Editorial policy