Suppose I have the following expression:

(2a + 3b)^2

when expanded, it gives

4a^2 + 9b^2 +6a*b

I want to pick up only the terms involving a* b, that is the term 6a*b. Is there an automatic way to pick up this kind of terms? (of course in the above example it is very simple, but I want it to work automatically for more complicated cases.)

  • 4
    $\begingroup$ Check your expansion. $\endgroup$ Aug 24 at 16:49
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Aug 24 at 21:23
  • $\begingroup$ It would be helpful if you were to show some of the more complicated cases $\endgroup$
    – m_goldberg
    Aug 25 at 15:58
Coefficient[(2 a + 3 b)^2, a b] a b

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