# Inverse of matrix with hadamard product

Let $$A$$ and $$B$$, $$X$$ be matrices with $$\mathbb{R}^{n \times n}$$ where $$A$$, $$B$$ are a dense and sparse matrix, i.e., the almost elements of $$B$$ are zeros, respectively. I'm looking for a way to solve the equation below with respect to $$X$$:

$$I \circ B - A(X \circ B) \circ B = 0$$ where $$\circ$$ denotes the Hadamard product.

I tried to solve it as follows:

$$A^{-1}(I \circ B) = X \circ B \circ B$$

$$X = A^{-1}(I \circ B) ⊘ B ⊘ B$$ where ⊘ denotes element-wise division.

But, there are two suspicious parts.

The first is whether $$A$$ can be invertible when the hadamard product exists on the right side of matrix multiplication.

The second is validity of element-wise division. $$X$$ has a constraint that only the part of $$X$$ where the value of matrix $$B$$ is filled has a value, otherwise zero. To compute element of $$X$$, it is just needed to calculate the part filled, so I think it is valid to use element-wise division, but I don't have confidence.

$$\def\b{{\cal B}}$$The standard basis vectors $$\{e_k\}$$ can be used to extract the columns of a matrix.
For example, the $$k^{th}$$ column of $$X$$ is given by $$x_k = Xe_k$$ Unlike all other vectors, the $$\{e_k\}$$ distribute over Hadamard products, i.e. $$\big(A\circ B\big)\,e_k \;=\; \big(Ae_k\circ Be_k\big)$$ This property can be used to turn the matrix equation into a sequence of vector equations, i.e. \eqalign{ \Big(B\circ A(B\circ X)\Big)\,e_k &= \Big(B\circ I\Big)\,e_k \\ Be_k\circ A(Be_k\circ Xe_k) &= Be_k\circ Ie_k \\ b_k\circ A(b_k\circ x_k) &= b_k\circ e_k \\ } Hadamard products of vectors can be replaced by normal matrix products with diagonal matrices \eqalign{ \b = {\rm Diag}(b) \quad\implies\quad \b w \;=\; b\circ w \\ } This creates a simple matrix equation for each column of $$X$$ \eqalign{ (\b_k A\b_k)\,x_k &= \b_k e_k \\ x_k &= (\b_k A\b_k)^{-1}\b_k e_k \;=\; \b_k^{-1} A^{-1} e_k \\ } Finally, any matrix can be written as the sum of its columns $$\times$$ basis vectors, therefore \eqalign{ X\;=\;\sum_{k=1}^n x_k\,e_k^T\;=\;\sum_{k=1}^n\b_k^{-1}A^{-1}e_k\,e_k^T \\ \\ }

Since $$B$$ is very sparse, $$\,\b_k\;\big({\rm and}\;\b_kA\b_k\big)$$ will be singular for most values of $$k$$.

In those cases, the best you can do is use the pseudoinverse to solve for $$x_k$$
\eqalign{ x_k &= \big(\b_k A\b_k\big)^{+}\b_k e_k + \Big(I-\big(\b_k A\b_k\big)^{+}\big(\b_k A\b_k\big)\Big)\,w \\ } where $$w$$ is an arbitrary vector and its coefficient matrix is the nullspace projector.

In particular, if $$\,\b_k=0\;$$ then $$\,x_k=w={\rm arbitrary}.$$

Obviously with all of those random $$w$$-vectors, the solution isn't unique. However, if you always choose the same vector, e.g. $$\,w=0,\,$$ then you can generate a unique $$X$$ matrix.

• Thank you for all your assistance! I really appreciate your help in resolving the problem. Feb 25, 2022 at 7:34