
Hadamard Product
The Hadamard product is a mathematical operation that multiplies corresponding elements between two matrices or vectors, yielding a matrix or vector of the same size.
This operation is alternatively referred to as component wise multiplication or element wise product. Each of these names accurately captures the essence of the process.
To illustrate its operation, let's engage with a practical example.
Suppose we have two vectors
$$ \vec{v} = \begin{pmatrix} 2 \\ -1 \\ 3 \end{pmatrix} $$
$$ \vec{w} = \begin{pmatrix} 4 \\ 5 \\ -2 \end{pmatrix} $$
The fundamental requirement for the Hadamard product is a matching number of components in the vectors or matrices. In our current case, both vectors encompass three elements.
Calculating the Hadamard product of vectors v and w yields a new vector, derived from the product of each corresponding element of v and w:
$$ \vec{v} \cdot \vec{w} = \begin{pmatrix} 2 \\ -1 \\ 3 \end{pmatrix} \cdot \begin{pmatrix} 4 \\ 5 \\ -2 \end{pmatrix} $$
$$ \vec{v} \cdot \vec{w} = \begin{pmatrix} 2 \cdot 4 \\ -1 \cdot 5 \\ 3 \cdot (-2) \end{pmatrix} $$
$$ \vec{v} \cdot \vec{w} = \begin{pmatrix} 8 \\ -5 \\ -6 \end{pmatrix} $$
The Hadamard product can also be performed between two matrices.
In such an instance, each element (i, j) in the resulting matrix is derived from the product of the corresponding elements (i, j) in the original matrices.
Consider the following 2x2 matrices
$$ A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} $$
$$ B = \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix} $$
For elementwise multiplication, it's vital that the matrices share identical dimensions. This isn't exclusive to square matrices; rectangular ones can also be accommodated, as long as they maintain the same number of rows and columns.
Upon carrying out the componentwise product of these matrices, we obtain:
$$ A \cdot B = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} \cdot \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix} $$
$$ A \cdot B = \begin{pmatrix} 1 \cdot 5 & 2 \cdot 6 \\ 3 \cdot 7 & 4 \cdot 8 \end{pmatrix} $$
$$ A \cdot B = \begin{pmatrix} 5 & 12 \\ 21 & 32 \end{pmatrix} $$
It's worth noting that, in the broader mathematical landscape, the Hadamard product finds less frequent use compared to other forms of vector or matrix multiplication.
Therefore, the calculation of a Hadamard product should only be performed when an explicit request for elementwise multiplication has been made.
In the absence of such a specification, the common practice is to adopt the row-by-column method for matrix multiplication. When dealing with vectors, the standard procedures involve either the cross product or dot product.
That being said, the Hadamard product does find occasional applications in specific areas such as statistics, signal theory, and machine learning, which underlines its distinct and significant role in mathematical operations.