# Applying the common factor to each term of a series

I have a series like this:

Sum[(n/z)^(1 - j + n)*Binomial[1 + n, j]*G[j], {j, 0, 1 + n}]/ ((1 + n)*(n/z)^n)


where G[j] is, at this stage, "some function", unspecified. n is usually pretty large and at some point I'll be truncating the series with an O(n+2) term at the end; but let's not go there just yet.

What I would like to see is, as you might expect:

or

Sum[((n/z)^(1 - j)*Binomial[1 + n, j]*G[j])/(1 + n), {j, 0, 1 + n}]


I can't see any way from getting from one to the other and get rid of the notion that simple rearrangements of terms are something that I ought to be able to do.

Can anyone point me in the right direction?

• Somewhat related: 21007, 73548, 82596 May 31, 2015 at 13:58

## 1 Answer

exp = Sum[(n/z)^(1 - j + n)*Binomial[1 + n, j]*G[j], {j, 0, 1 + n}]/((1 + n)*(n/z)^n);

exp /. a_ Sum[x_, y___] :> Sum[a x, y]


• +1. Or perhaps exp /. a_ Sum[x_, y___] /; FreeQ[a, Alternatives @@ {y}[[All, 1]]] :> Sum[a x, y] for the cautious. (Or ! InternalDependsOnQ[..] instead of FreeQ, but that might allow more than is desired; e.g. nested sums with the same index. While legal in M, no editor would probably allow it.) May 31, 2015 at 14:12
• Thank you @MichaelE2, for the vote and the caution. Didn't think about nested sums and possible dependence of a` on indices.
– kglr
May 31, 2015 at 14:39