5
$\begingroup$

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?

$\endgroup$
0

1 Answer 1

5
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ It's beautiful, thank you! If only matrix algebra came this easily to me. $\endgroup$ Commented Mar 17, 2013 at 15:49
  • $\begingroup$ One question though, how did you work out that B is a rank one matrix for all A? $\endgroup$ Commented Mar 18, 2013 at 15:55
  • $\begingroup$ Any matrix that is built from the "outer multiplication" (also inner for that matter) of two vectors is a rank one matrix. Consider row reduction; all rows after the first row may be annihilated completely by adding the proper amount from the first row. $\endgroup$
    – adam W
    Commented Mar 18, 2013 at 16:04
  • $\begingroup$ Ohh yes, I see it now. Thanks again! $\endgroup$ Commented Mar 18, 2013 at 16:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .