# Comparing two power series and extracting their coefficients

I have a standard mathematical problem that I was wondering how to solve efficiently by mathematica. Here is the problem.

I have two power series expansions of a function F[x,y] = sum1 = sum2

A1 = (a/4)^2 (x^2 + y^2 + z^2);
A2 =  (a/4)^3 x y z;
sum1 = Sum[A1^i * A2^j * P[i, j], {i, 0, 6}, {j, 0, 6}] /. {z -> -x - y}
sum2 = Sum[(a/4)^(i + j) (x^i y^j)/(i! j!) Q[i, j], {i, 0, 6}, {j, 0, 6}]


Basically I want to express one type of coefficients P[i,j] in terms of Q[i,j].

• sum1 contains x-y terms with lowest total degree>0 of two, no terms linear in x or y. However sum2 contains terms linear in x or y. How can sum1 == sum2 be? Jun 22 at 19:16
• Doesn't that mean some of the particular coeffs i.e. P[i,j] or Q[i,j] are zero? Jun 22 at 19:52
• Maybe another way of putting it : sum1 is a restricted sum with 2 i + 3 j = n where n is a natural number. Jun 22 at 19:56

In sum2, the powers of x and y are less than or equal to 6, whereas in sum1, the powers go up much higher. For that reason, we'll have to truncate sum1.
Thread /@ Thread[CoefficientList[sum1, {x, y}][[;; 7, ;; 7]] == CoefficientList[sum2, {x, y}]] // Flatten;

This generates the set of coefficients for each power of $$x^ny^m$$, sets them equal to each other for the two sums (up to degree 6 in each variable), and then solves for the Q's in terms of the P's.
• On second thought, it's not so trivial to obtain P[i, j] = # Q[i, j]. Please let me know if you have any way to solve directly for P[i, j]. Thanks! Jun 24 at 5:37