5

I have a matrix $A$ of dimension $m \times n$, and I need to get a matrix $B$ which is also $m \times n$, that has the following specifications:

Element $B_{ij}$ of matrix $B$ is the product of the sum of all elements in row $i$, and the sum of all elements in row $j$, divided by the sum of all elements in $A$:

$$B_{ij} = \frac{\sum{A_i}\sum{A_j}}{\sum{A_{ij}}}$$

Is there a matrix equation of basic operations (addition, multiplication, trace, transpose, etc.) that can be used to express this transformation?

23rd
  • 16,234
  • 44
  • 70

1 Answers1

5

Yes you can. $B$ is a rank one matrix. Use the column vector $\vec{1}$ with $n$ ones and the row vector $\vec{1}^\top$ with $m$ ones. Then $$B = \frac{(A\vec{1})(\vec{1}^\top A)}{\vec{1}^\top A\vec{1}}$$

Where the denominator is a scalar. Note that you need only do the left and right vector multiplication once.

adam W
  • 5,565