Section HP  Hadamard Product

From A First Course in Linear Algebra
Version 2.12
© 2004.
Licensed under the GNU Free Documentation License.
http://linear.ups.edu/

This section is contributed by Elizabeth Million.

You may have once thought that the natural definition for matrix multiplication would be entrywise multiplication, much in the same way that a young child might say, “I writed my name.” The mistake is understandable, but it still makes us cringe. Unlike poor grammar, however, entrywise matrix multiplication has reason to be studied; it has nice properties in matrix analysis and additionally plays a role with relative gain arrays in chemical engineering, covariance matrices in probability and serves as an inertia preserver for Hermitian matrices in physics. Here we will only explore the properties of the Hadamard product in matrix analysis.

Definition HP
Hadamard Product
Let A and B be m × n matrices. The Hadamard Product of A and B is defined by {\left [A ∘ B\right ]}_{ij} ={ \left [A\right ]}_{ij}{\left [B\right ]}_{ij} for all 1 ≤ i ≤ m, 1 ≤ j ≤ n.

(This definition contains Notation HP.)

As we can see, the Hadamard product is simply “entrywise multiplication”. Because of this, the Hadamard product inherits the same benefits (and restrictions) of multiplication in . Note also that both A and B need to be the same size, but not necessarily square. To avoid confusion, juxtaposition of matrices will imply the “usual” matrix multiplication, and we will use “” for the Hadamard product.

Example HP
Hadamard Product
Consider

\eqalignno{ A = \left [\array{ 1&0&6\cr 3&π &5 } \right ] & &B = \left [\array{ 3&13&i\cr {1\over 3}& 2 &4 } \right ] & & & & }

Then

\eqalignno{ A ∘ B & = \left [\array{ (1)(3)&(0)(13)&(6)(i) \cr 3({1\over 3}) & (π)(2) &(5)(4) } \right ] & & \cr & = \left [\array{ 3& 0 &6i\cr 1&2π &20 } \right ]. & & }

Now we will explore some basics properties of the Hadamard Product.

Theorem HPC
Hadamard Product is Commutative
If A and B are m × n matrices then A ∘ B = B ∘ A.

Proof   The proof follows directly from the fact that multiplication in is commutative. Let A and B be m × n matrices. Then

\eqalignno{ {\left [A ∘ B\right ]}_{ij} & ={ \left [A\right ]}_{ij}{\left [B\right ]}_{ij} & &\text{@(a href="#definition.HP")Definition HP@(/a)} & & & & \cr & ={ \left [B\right ]}_{ij}{\left [A\right ]}_{ij} & &\text{@(a href="fcla-jsmath-2.12li69.html#property.CMCN")Property CMCN@(/a)} & & & & \cr & ={ \left [B ∘ A\right ]}_{ij} & &\text{@(a href="#definition.HP")Definition HP@(/a)} & & & & }

With equality of each entry of the matrices being equal we know by Definition ME that the two matrices are equal.

Definition HID
Hadamard Identity
The Hadamard identity is the m × n matrix Jmn defined by {\left [Jmn\right ]}_{ij} = 1 for all 1 ≤ i ≤ m, 1 ≤ j ≤ n.

(This definition contains Notation HID.)

Theorem HPHID
Hadamard Product with the Hadamard Identity
Suppose A is an m × n matrix. Then A ∘ Jmn = Jmn ∘ A = A.

Proof  

\eqalignno{ {\left [A ∘ Jmn\right ]}_{ij} & ={ \left [Jmn ∘ A\right ]}_{ij} & &\text{@(a href="#theorem.HPC")Theorem HPC@(/a)} & & & & \cr & ={ \left [Jmn\right ]}_{ij}{\left [A\right ]}_{ij} & &\text{@(a href="#definition.HP")Definition HP@(/a)} & & & & \cr & = (1){\left [A\right ]}_{ij} & &\text{@(a href="#definition.HID")Definition HID@(/a)} & & & & \cr & ={ \left [A\right ]}_{ij} & &\text{@(a href="fcla-jsmath-2.12li69.html#property.OCN")Property OCN@(/a)} & & & & }

With equality of each entry of the matrices being equal we know by Definition ME that the two matrices are equal.

Definition HI
Hadamard Inverse
Let A be an m × n matrix and suppose {\left [A\right ]}_{ij}≠0 for all 1 ≤ i ≤ m, 1 ≤ j ≤ n. Then the Hadamard Inverse, \widehat{A} , is given by {\left [\widehat{A}\right ]}_{ij} = {({\left [A\right ]}_{ij})}^{−1} for all 1 ≤ i ≤ m, 1 ≤ j ≤ n.

(This definition contains Notation HI.)

Theorem HPHI
Hadamard Product with Hadamard Inverses
Let A be an m × n matrix such that {\left [A\right ]}_{ij}≠0 for all 1 ≤ i ≤ m, 1 ≤ j ≤ n. Then A ∘\widehat{ A} =\widehat{ A} ∘ A = Jmn.

Proof  

\eqalignno{ {\left [A ∘\widehat{ A}\right ]}_{ij} & ={ \left [\widehat{A} ∘ A\right ]}_{ij} & &\text{@(a href="#theorem.HPC")Theorem HPC@(/a)} & & & & \cr & ={ \left [\widehat{A}\right ]}_{ij}{\left [A\right ]}_{ij} & &\text{@(a href="#definition.HP")Definition HP@(/a)} & & & & \cr & = {({\left [A\right ]}_{ij})}^{−1}{\left [A\right ]}_{ ij} & &\text{@(a href="#definition.HI")Definition HI@(/a), }{\left [A\right ]}_{ij}≠0 & & & & \cr & = 1 & &\text{@(a href="fcla-jsmath-2.12li69.html#property.MICN")Property MICN@(/a)} & & & & \cr & ={ \left [Jmn\right ]}_{ij} & &\text{@(a href="#definition.HID")Definition HID@(/a)} & & & & }

With equality of each entry of the matrices being equal we know by Definition ME that the two matrices are equal.

Since matrices have a different inverse and identity under the Hadamard product, we have used special notation to distinguish them from what we have been using with “normal” matrix multiplication. That is, compare “usual” matrix inverse, {A}^{−1}, with the Hadamard inverse \widehat{A}, and the “usual” matrix identity, {I}_{n}, with the Hadamard identity, Jmn. The Hadamard identity matrix and the Hadamard inverse are both more limiting than helpful, so we will not explore their use further. One last fun fact for those of you who may be familiar with group theory: the set of m × n matrices with nonzero entries form an abelian (commutative) group under the Hadamard product (prove this!).

Theorem HPDAA
Hadamard Product Distributes Across Addition
Suppose A, B and C are m × n matrices. Then C ∘ (A + B) = C ∘ A + C ∘ B.

Proof  

\eqalignno{ {\left [C ∘ (A + B)\right ]}_{ij} & ={ \left [C\right ]}_{ij}{\left [A + B\right ]}_{ij} & &\text{@(a href="#definition.HP")Definition HP@(/a)} & & & & \cr & ={ \left [C\right ]}_{ij}({\left [A\right ]}_{ij} +{ \left [B\right ]}_{ij}) & &\text{@(a href="fcla-jsmath-2.12li30.html#definition.MA")Definition MA@(/a)} & & & & \cr & ={ \left [C\right ]}_{ij}{\left [A\right ]}_{ij} +{ \left [C\right ]}_{ij}{\left [B\right ]}_{ij} & &\text{@(a href="fcla-jsmath-2.12li69.html#property.DCN")Property DCN@(/a)} & & & & \cr & ={ \left [C ∘ A\right ]}_{ij} +{ \left [C ∘ B\right ]}_{ij} & &\text{@(a href="#definition.HP")Definition HP@(/a)} & & & & \cr & ={ \left [C ∘ A + C ∘ B\right ]}_{ij} & &\text{@(a href="fcla-jsmath-2.12li30.html#definition.MA")Definition MA@(/a)} & & & & }

With equality of each entry of the matrices being equal we know by Definition ME that the two matrices are equal.

Theorem HPSMM
Hadamard Product and Scalar Matrix Multiplication
Suppose α ∈ ℂ, and A and B are m × n matrices. Then α(A ∘ B) = (αA) ∘ B = A ∘ (αB).

Proof  

\eqalignno{ {\left [αA ∘ B\right ]}_{ij} & = α{\left [A ∘ B\right ]}_{ij} & &\text{@(a href="fcla-jsmath-2.12li30.html#definition.MSM")Definition MSM@(/a)} & & & & \cr & = α{\left [A\right ]}_{ij}{\left [B\right ]}_{ij} & &\text{@(a href="#definition.HP")Definition HP@(/a)} & & & & \cr & ={ \left [αA\right ]}_{ij}{\left [B\right ]}_{ij} & &\text{@(a href="fcla-jsmath-2.12li30.html#definition.MSM")Definition MSM@(/a)} & & & & \cr & ={ \left [(αA) ∘ B\right ]}_{ij} & &\text{@(a href="#definition.HP")Definition HP@(/a)} & & & & \cr & = α{\left [A\right ]}_{ij}{\left [B\right ]}_{ij} & &\text{@(a href="fcla-jsmath-2.12li30.html#definition.MSM")Definition MSM@(/a)} & & & & \cr & ={ \left [A\right ]}_{ij}α{\left [B\right ]}_{ij} & &\text{@(a href="fcla-jsmath-2.12li69.html#property.CMCN")Property CMCN@(/a)} & & & & \cr & ={ \left [A\right ]}_{ij}{\left [αB\right ]}_{ij} & &\text{@(a href="fcla-jsmath-2.12li30.html#definition.MSM")Definition MSM@(/a)} & & & & \cr & ={ \left [A ∘ (αB)\right ]}_{ij} & &\text{@(a href="#definition.HP")Definition HP@(/a)} & & & & }

With equality of each entry of the matrices being equal we know by Definition ME that the two matrices are equal.

Subsection DMHP: Diagonal Matrices and the Hadamard Product

We can relate the Hadamard product with matrix multiplication by considering diagonal matrices, since A ∘ B = AB if and only if both A and B are diagonal (Citation!!!). For example, a simple calculation reveals that the Hadamard product relates the diagonal values of a diagonalizable matrix A with its eigenvalues:

Theorem DMHP
Diagonalizable Matrices and the Hadamard Product
Let A be a diagonalizable matrix of size n with eigenvalues {λ}_{1},\kern 1.95872pt {λ}_{2},\kern 1.95872pt {λ}_{3},\kern 1.95872pt \mathop{\mathop{…}},\kern 1.95872pt {λ}_{n}. Let D be a diagonal matrix from the diagonalization of A, A = SD{S}^{−1}, and d be a vector such that {\left [D\right ]}_{ii} ={\left [d\right ]}_{i} = {λ}_{i} for all 1 ≤ i ≤ n. Then

\eqalignno{ {\left [A\right ]}_{ii} & ={ \left [S ∘ {({S}^{−1})}^{t}d\right ]}_{ i} &\text{for all }1 ≤ i ≤ n. & & & & }

That is,

\left [\array{ {\left [A\right ]}_{11} \cr {\left [A\right ]}_{22} \cr {\left [A\right ]}_{33} \cr \mathop{\mathop{⋮}} \cr {\left [A\right ]}_{nn} } \right ] = S∘{({S}^{−1})}^{t}\left [\array{ {λ}_{1} \cr {λ}_{2} \cr {λ}_{3} \cr \mathop{\mathop{⋮}}\cr {λ}_{ n} } \right ]

Proof  

\eqalignno{ {\left [S ∘ {({S}^{−1})}^{t}d\right ]}_{ i} & ={ \mathop{∑ }}_{k=1}^{n}{\left [S ∘ {({S}^{−1})}^{t}\right ]}_{ ik}{\left [d\right ]}_{k} & &\text{@(a href="fcla-jsmath-2.12li31.html#definition.MVP")Definition MVP@(/a)} & & & & \cr & ={ \mathop{∑ }}_{k=1}^{n}{\left [S ∘ {({S}^{−1})}^{t}\right ]}_{ ik}{λ}_{k} & &\text{Definition of }d & & & & \cr & ={ \mathop{∑ }}_{k=1}^{n}{\left [S\right ]}_{ ik}{\left [{({S}^{−1})}^{t}\right ]}_{ ik}{λ}_{k} & &\text{@(a href="#definition.HP")Definition HP@(/a)} & & & & \cr & ={ \mathop{∑ }}_{k=1}^{n}{\left [S\right ]}_{ ik}{\left [{S}^{−1}\right ]}_{ ki}{λ}_{k} & &\text{@(a href="fcla-jsmath-2.12li30.html#definition.TM")Definition TM@(/a)} & & & & \cr & ={ \mathop{∑ }}_{k=1}^{n}{\left [S\right ]}_{ ik}{λ}_{k}{\left [{S}^{−1}\right ]}_{ ki} & &\text{@(a href="fcla-jsmath-2.12li69.html#property.CMCN")Property CMCN@(/a)} & & & & \cr & ={ \mathop{∑ }}_{k=1}^{n}{\left [S\right ]}_{ ik}{\left [D\right ]}_{kk}{\left [{S}^{−1}\right ]}_{ ki} & &\text{Definition of }D & & & & \cr & ={ \mathop{∑ }}_{j=1}^{n}{ \mathop{∑ }}_{k=1}^{n}{\left [S\right ]}_{ ik}{\left [D\right ]}_{kj}{\left [{S}^{−1}\right ]}_{ ji} & &{\left [D\right ]}_{kj} = 0\text{ for all }k\mathrel{≠}j & & & & \cr & ={ \mathop{∑ }}_{j=1}^{n}{\left [SD\right ]}_{ ij}{\left [{S}^{−1}\right ]}_{ ji} & &\text{@(a href="fcla-jsmath-2.12li31.html#theorem.EMP")Theorem EMP@(/a)} & & & & \cr & ={ \left [SD{S}^{−1}\right ]}_{ ii} & &\text{@(a href="fcla-jsmath-2.12li31.html#theorem.EMP")Theorem EMP@(/a)} & & & & \cr & ={ \left [A\right ]}_{ii} & &\text{@(a href="fcla-jsmath-2.12li30.html#definition.ME")Definition ME@(/a)} & & & & }

With equality of each entry of the matrices being equal we know by Definition ME that the two matrices are equal.

We obtain a similar result when we look at the singular value decomposition of square matrices (see exercises).

Theorem DMMP
Diagonal Matrices and Matrix Products
Suppose A, B are m × n matrices, and D and E are diagonal matrices of size m and n, respectively. Then,

D(A ∘ B)E = (DAE) ∘ B = (DA) ∘ (BE)

Proof  

\eqalignno{ {\left [D(A ∘ B)E\right ]}_{ij} & ={ \mathop{∑ }}_{k=1}^{m}{\left [D\right ]}_{ ik}{\left [(A ∘ B)E\right ]}_{kj} & &\text{@(a href="fcla-jsmath-2.12li31.html#theorem.EMP")Theorem EMP@(/a)} & & & & \cr & ={ \mathop{∑ }}_{k=1}^{m}{ \mathop{∑ }}_{l=1}^{n}{\left [D\right ]}_{ ik}{\left [A ∘ B\right ]}_{kl}{\left [E\right ]}_{lj} & &\text{@(a href="fcla-jsmath-2.12li31.html#theorem.EMP")Theorem EMP@(/a)} & & & & \cr & ={ \mathop{∑ }}_{k=1}^{m}{ \mathop{∑ }}_{l=1}^{n}{\left [D\right ]}_{ ik}{\left [A\right ]}_{kl}{\left [B\right ]}_{kl}{\left [E\right ]}_{lj} & &\text{@(a href="#definition.HP")Definition HP@(/a)} & & & & \cr & ={ \mathop{∑ }}_{k=1}^{m}{\left [D\right ]}_{ ik}{\left [A\right ]}_{kj}{\left [B\right ]}_{kj}{\left [E\right ]}_{jj} & &{\left [E\right ]}_{lj} = 0\text{ for all }l\mathrel{≠}j & & & & \cr & ={ \left [D\right ]}_{ii}{\left [A\right ]}_{ij}{\left [B\right ]}_{ij}{\left [E\right ]}_{jj} & &{\left [D\right ]}_{ik} = 0\text{ for all }i\mathrel{≠}k & & & & \cr & ={ \left [D\right ]}_{ii}{\left [A\right ]}_{ij}{\left [E\right ]}_{jj}{\left [B\right ]}_{ij} & &\text{@(a href="fcla-jsmath-2.12li69.html#property.CMCN")Property CMCN@(/a)} & & & & \cr & ={ \left [D\right ]}_{ii}({\mathop{∑ }}_{l=1}^{n}{\left [A\right ]}_{ il}{\left [E\right ]}_{lj}){\left [B\right ]}_{ij} & &{\left [E\right ]}_{lj} = 0\text{ for all }l\mathrel{≠}j & & & & \cr & ={ \left [D\right ]}_{ii}{\left [AE\right ]}_{ij}{\left [B\right ]}_{ij} & &\text{@(a href="fcla-jsmath-2.12li31.html#theorem.EMP")Theorem EMP@(/a)} & & & & \cr & = ({\mathop{∑ }}_{k=1}^{m}{\left [D\right ]}_{ ik}{\left [AE\right ]}_{kj}){\left [B\right ]}_{ij} & &{\left [D\right ]}_{ik} = 0\text{ for all }i\mathrel{≠}k & & & & \cr & ={ \left [DAE\right ]}_{ij}{\left [B\right ]}_{ij} & &\text{@(a href="fcla-jsmath-2.12li31.html#theorem.EMP")Theorem EMP@(/a)} & & & & \cr & ={ \left [(DAE) ∘ B\right ]}_{ij} & &\text{@(a href="#definition.HP")Definition HP@(/a)} & & & & }

With equality of each entry of the matrices being equal we know by Definition ME that the two matrices are equal.

Also,

\eqalignno{ {\left [(DAE) ∘ B\right ]}_{ij} & ={ \left [DAE\right ]}_{ij}{\left [B\right ]}_{ij} & &\text{@(a href="#definition.HP")Definition HP@(/a)} & & & & \cr & = ({\mathop{∑ }}_{k=1}^{n}{\left [DA\right ]}_{ ik}{\left [E\right ]}_{kj}){\left [B\right ]}_{ij} & &\text{@(a href="fcla-jsmath-2.12li31.html#theorem.EMP")Theorem EMP@(/a)} & & & & \cr & ={ \left [DA\right ]}_{ij}{\left [E\right ]}_{jj}{\left [B\right ]}_{ij} & &{\left [E\right ]}_{kj} = 0\text{ for all }k\mathrel{≠}j & & & & \cr & ={ \left [DA\right ]}_{ij}{\left [B\right ]}_{ij}{\left [E\right ]}_{jj} & &\text{@(a href="fcla-jsmath-2.12li69.html#property.CMCN")Property CMCN@(/a)} & & & & \cr & ={ \left [DA\right ]}_{ij}({\mathop{∑ }}_{k=1}^{n}{\left [B\right ]}_{ ik}{\left [E\right ]}_{kj}) & &{\left [E\right ]}_{kj} = 0\text{ for all }k\mathrel{≠}j & & & & \cr & ={ \left [DA\right ]}_{ij}{\left [BE\right ]}_{ij} & &\text{@(a href="fcla-jsmath-2.12li31.html#theorem.EMP")Theorem EMP@(/a)} & & & & \cr & ={ \left [(DA) ∘ (BE)\right ]}_{ij} & &\text{@(a href="#definition.HP")Definition HP@(/a)} & & & & }

With equality of each entry of the matrices being equal we know by Definition ME that the two matrices are equal.

Subsection EXC: Exercises

T10 Prove that A ∘ B = AB if and only if both A and B are diagonal matrices.  
Contributed by Elizabeth Million

T20 Suppose A, B are m × n matrices, and D and E are diagonal matrices of size m and n, respectively. Prove both parts of the following equality hold:

\eqalignno{ D(A ∘ B)E & = (AE) ∘ (DB) = A ∘ (DBE) & & }

 
Contributed by Elizabeth Million

T30 Let A be a square matrix of size n with singular values {σ}_{1},\kern 1.95872pt {σ}_{2},\kern 1.95872pt {σ}_{3},\kern 1.95872pt \mathop{\mathop{…}},\kern 1.95872pt {σ}_{n}. Let D be a diagonal matrix from the singular value decomposition of A, A = UD{V }^{∗} (Theorem SVD). Define the vector d by {\left [d\right ]}_{i} ={ \left [D\right ]}_{ii} = {σ}_{i}, 1 ≤ i ≤ n. Prove the following equality,

\eqalignno{ {\left [A\right ]}_{ii} & ={ \left [(U ∘\overline{V })d\right ]}_{i} & & }

 
Contributed by Elizabeth Million

T40 Suppose A, B and C are m × n matrices. Prove that for all 1 ≤ i ≤ m,

\eqalignno{ {\left [(A ∘ B){C}^{t}\right ]}_{ ii} & ={ \left [(A ∘ C){B}^{t}\right ]}_{ ii} & & }

 
Contributed by Elizabeth Million

T50 Define the diagonal matrix D of size n with entries from a vector x ∈ {ℂ}^{n} by

\eqalignno{ {\left [D\right ]}_{ij} & = \left \{\array{ {\left [x\right ]}_{i}\quad &\text{if $i = j$}\cr 0 \quad &\text{otherwise} } \right . & & }

Furthermore, suppose A, B are m × n matrices. Prove that {\left [AD{B}^{t}\right ]}_{ ii} ={ \left [(A ∘ B)x\right ]}_{i} for all 1 ≤ i ≤ m.  
Contributed by Elizabeth Million