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 the matrix

{{3, 2, 1}, {3, 1, 2}, {2, 3, -1}, 
{-(3/b), -(3/b^2) - 2/b, -(3/b^3) - 2/b^2 - 1/b}, 
{-(3/b), -(3/b^2) - 1/b, -(3/b^3) - 1/b^2 - 2/b}, 
{-(2/b), -(2/b^2) - 3/b, -(2/b^3) - 3/b^2 + 1/b}}

and I want to compute its inverse (or pseudoinverse).

The problem is that Mathematica solves this regarding b as a complex number. How do I change this to set b as real? I tried Assuming but that didn't work. Maybe I am writing it wrong. Any ideas? It should be fairly simple, but I am not really good at Mathematica and I couldn't find a solution elsewhere. I would be greatful for a general answer, not one specifically for this example; e.g., Pseudoinverse[a] /. Reals[b] -> ... (this didn't work).


share|improve this question
Try ComplexExpand[PseudoInverse[mat]]. – b.gatessucks Nov 17 '12 at 15:16

Usually simplifying the result with appropriate assumptions gives desired result:

m={{3, 2, 1},
 {3, 1, 2},
 {2, 3, -1},
 {-(3/b), -(3/b^2) - 2/b, -(3/b^3) - 2/b^2 - 1/b},
 {-(3/b), -(3/b^2) - 1/b, -(3/b^3) - 1/b^2 - 2/b},
 {-(2/b), -(2/b^2) - 3/b, -(2/b^3) - 3/b^2 + 1/b}};

Simplify[PseudoInverse[m], b \[Element] Reals]
share|improve this answer
Yes thats true,it works just fine, thank you very much you have been very helpful! – Lazaros Moysis Nov 17 '12 at 15:22

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.