How can I get the output (a + b) (a - b) when I enter the expression a^2 - b^2 in Mathematica? I tried with the Expand[a^2 - b^2], but it does not work.

  • 1
    $\begingroup$ I would close this question as the off-topic. It has the solution in documentation and is based on the author's lack of elementary knowledge of MMa. $\endgroup$ Jul 25, 2017 at 9:14
  • 1
    $\begingroup$ Hi @AlexeiBoulbitch, If I am not able to find an answer in documentation, I can't ask questions about documentation? In the right case, can you show me where you find this rule please. $\endgroup$ Jul 25, 2017 at 9:31
  • 3
    $\begingroup$ Hi, Gennaro, no, of course, you can. Your question is correct, and you, should certainly ask all your questions, not important, simple or complex. It is not about you or your question, but about the necessity to store this question at this site. This is according to the rules of this site. My opinion is that as soon as you have already got a good answer (and you have got it below), this question should not be kept any longer. The reasons I gave above. To accept my reasons or not will be decided further by the community. $\endgroup$ Jul 25, 2017 at 9:43
  • 1
    $\begingroup$ @AlexeiBoulbitch, even though I agree assessment of the pertinence of question. I also think that the way the documentation is written/organized (as well as a lot of other things in MMa), while very powerful tools in the hands of an intermediate or above user, I think they tend to be very confusing for beginners, specially if the beginner doesn't have a previous background in numerical, symbolic, scientific or functional programming or at least a good knowledge of programming in general. The only material really targeted for beginners is Wolfram's Elementary Introduction to MMa. $\endgroup$
    – nicholas80
    Jul 25, 2017 at 14:44
  • $\begingroup$ @nicholas80 I do not agree. To my taste the Mma Help is excellent. But it is not predestinated for learning Mma from scratch. For those who starts learning it there is a number of different sources, and one can chose something passing. One can find a great list of sources here: mathematica.stackexchange.com/questions/18/… $\endgroup$ Jul 26, 2017 at 8:19

1 Answer 1


For this, you are suppose to use Factor not Expand.

Factor[a^2 - b^2]

(a - b) (a + b)

You can also use FullSimplify,

FullSimplify[a^2 - b^2]

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