Mathematica Stack Exchange is a question and answer site for users of Mathematica. 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

I have this equation, $$f(x)=Ax-diag(x)(Ax+b)$$, where $x\in \mathbb{R}^n$, $A\in \mathbb{R}^{n\times n}$ and $b\in \mathbb{R}^n$, for which I need to find the zeros. $x=0$ is an obvious solution, but I would like to see if there are other solutions as well.

Is there an explicit way to get the solution in terms of, $A$ and $b$ without specifying the matrices completely?

share|improve this question

It's hard to know how far you can go, but Solve can work in this kind of situation. For instance, leaving all parameters completely free, define the elements and the function f:

aMat = Array[a, {n,n}];
xVec = Array[x, n];
bVec = Array[b, n];
f[xVec_] := aMat.xVec - DiagonalMatrix[xVec].(aMat.xVec + bVec);

Then solve for the zeros

Solve[f[xVec] == 0, xVec]

At least in the 2-by-2 case, you get a completely general answer, though it is unwieldy.

share|improve this answer

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.