Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is the given problem, I need to write a code for this:

$(M*Q) \circ (N*Q) $

where $M,Q,N$ are known matrices, "$\ast$" denotes matrix multiplication and "$\circ$" denotes elementwise division.

Dimensions of the matrices: \begin{align*} M: &a\times l,\\ N: &a\times l,\\ Q: &l\times1. \end{align*}

By element-wise division, I mean this:

$A \circ B = C$ where $C_{ij} = A_{ij}/B_{ij} \ \ \forall\ i,j$.

I want to convert this above problem to this:

Find $K$ such that $K*Q = (M*Q) \circ (N*Q)$.

share|cite|improve this question
up vote 2 down vote accepted

In general, this is impossible because $(M*Q) \circ (N*Q)$ is a rational function in the entries of $Q$ but $K*Q$ is linear. For instance, consider $M=(1,0),N=(0,1)$ and $Q=\pmatrix{x\\ y}$. Then $(M*Q) \circ (N*Q)=\frac xy$. Surely it is not a linear function in $x$ and $y$.

share|cite|improve this answer
Yeah, I guess. Alright then. – SPRajagopal May 29 '13 at 12:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.