# Extract coefficients and terms in polynomial expansion [closed]

I have a polynomial in $$a$$ and $$b$$:

$$(Aa^2 + Bb^2 + Ca + Db + E)^m$$

How can I construct a table of coefficients corresponding to all different products $$a^i b^j$$ in the expansion for a defined $$m$$, and another table with the entries $$i,j$$ so that it is easy to track which coefficient corresponds to which term?

• Can you show why Collect doesn't provide what you want or how to get what you want? Apr 9 at 23:21
• Have you seen CoefficientArrays or CoefficientRules? Apr 9 at 23:31
• @MichaelE2, I wasn't aware of CoefficientRules and that assigns the correct coefficients to all monomials as required
– Sid
Apr 9 at 23:41

m = 2;