Solving matrix equation with element-wise products

264 Views Asked by At

I am wondering if there is a way to solve this equation for a:

$$(as^T ⊙ b)n = t.$$

where:
⊙ is element-wise multiplication
a is an unknown v x 1 vector
s is an i x 1 $\vec{1}$ vector
b is a known v x i matrix
n is a known i x 1 vector
t is a v x 1 $\vec{1}$ vector

Thank you in advance

2

There are 2 best solutions below

0
On

Yes. Multiply it out as elements. You will have a system of $v$ uncoupled linear equations in the components of $a$. Then solve each, by itself.

Example with $v=3$, $i=2$: \begin{align*} \left( \begin{pmatrix}a_1 \\ a_2 \\ a_3\end{pmatrix} (s_1 \, s_2) \odot \begin{pmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \\ b_{31} & b_{32} \end{pmatrix}\right)\begin{pmatrix}n_1 \\n_2\end{pmatrix} &= \begin{pmatrix}t_1 \\ t_2 \\ t_3 \end{pmatrix} \\ \left( \begin{pmatrix}a_1s_1 & a_1s_2 \\ a_2s_1 & a_2s_2 \\ a_3s_1 & a_3s_2\end{pmatrix} \odot \begin{pmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \\ b_{31} & b_{32} \end{pmatrix}\right)\begin{pmatrix}n_1 \\n_2\end{pmatrix} &= \begin{pmatrix}t_1 \\ t_2 \\ t_3 \end{pmatrix} \\ \begin{pmatrix}a_1b_{11}s_1 & a_1b_{12}s_2 \\ a_2b_{21}s_1 & a_2b_{22}s_2 \\ a_3b_{31}s_1 & a_3b_{32}s_2\end{pmatrix} \begin{pmatrix}n_1 \\n_2\end{pmatrix} &= \begin{pmatrix}t_1 \\ t_2 \\ t_3 \end{pmatrix} \\ \begin{pmatrix}a_1b_{11}n_1s_1 + a_1b_{12}n_2s_2 \\ a_2b_{21}n_1s_1 + a_2b_{22}n_2s_2 \\ a_3b_{31}n_1s_1 + a_3b_{32}n_2s_2\end{pmatrix} &= \begin{pmatrix}t_1 \\ t_2 \\ t_3 \end{pmatrix} \\ \begin{cases} a_1 = \frac{t_1}{b_{11}n_1s_1 + b_{12}n_2s_2} \\ a_2 = \frac{t_2}{b_{21}n_1s_1 + b_{22}n_2s_2} \\ a_3 = \frac{t_3}{b_{31}n_1s_1 + b_{32}n_2s_2} \end{cases}\text{,} \end{align*} assuming those $v$ divisions are defined.

0
On

$ \def\l{\left} \def\r{\right} \def\lr#1{\l(#1\r)} \def\d#1{\operatorname{diag}\lr{#1}\,} \def\D#1{\operatorname{Diag}\lr{#1}\,} \def\v#1{\operatorname{vec}\lr{#1}\,} \def\o{{\tt1}} \def\p{{\partial}} \def\grad#1#2{\frac{\p #1}{\p #2}} $Define the Khatri-Rao product $(\boxtimes)$ in terms of all-ones vectors $(\o)$ and the Kronecker $(\otimes)$ and Hadamard $(\odot)$ products $$\eqalign{ &F \in {\mathbb R}^{m\times n},\quad g \in {\mathbb R}^{n},\quad H \in {\mathbb R}^{n\times p},\quad \o_m \in {\mathbb R}^{m} \\ &H^T\boxtimes F = (H^T\otimes{\o_m})\odot({\o_p}\otimes F) \;\in {\mathbb R}^{(mp)\times n} \\ }$$ Then we have the relatively unknown identity $$\eqalign{ &{ {\rm vec}\!\lr{F\,\D{a}\,H}=\lr{H^T\boxtimes F}a }\quad\qquad\qquad \\ }$$ while another, better known identity, relates the Hadamard product and diagonal matrices $$ab^T\odot C = \D{a}\;C\,\D{b}$$ Applying these to your equation yields $$\eqalign{ \o_v &= (a\o_i^T\odot B)\,n \\ &= \big(\D{a}\,B\,I_i\big)\,n \\ &= I_v\,\D{a}(Bn) \\ &= \l[(Bn)^T\boxtimes I_v\r]a \\ }$$ Therefore $$\eqalign{ a &= \l[(Bn)^T\boxtimes I_v\r]^{-1}\o_v \\ }$$