# Does Mathematica apply the additivity property in Sum?

I was trying to simplify a summation of two terms, as follows

FullSimplify[Sum[1, {n, 1, k}] + Sum[x[n], {n, 1, k}]]


However, the simplification was not performed as I expected: When I split the summation in two, I obtain the expected result, as follows: Am I doing something wrong?

I do not understand why Mathematica does not apply the additivity property in the first case. Is there a procedure to include properties in Mathematica Functions?

A complete inclusion of the additivity property in summation can be obtained by the following code:

Unprotect[Sum];
Sum[Plus[leftArg_, rightArg__], {variable_, argStart_, argEnd_}] :=
Sum[Plus[leftArg], {variable, argStart, argEnd}] +
Sum[Plus[rightArg], {variable, argStart, argEnd}]
Protect[Sum];

• The problem is that Sum[1, {n, 1, k}] is already automatically evaluated. – J. M.'s discontentment Jan 31 '17 at 16:41

I guess the Mathematica Programmers decided, that this is not nessecary. I for myself could also believe, that there are situations where this +1 can make it easier to get a closed expression for your sum.

But if you want to really have this functionality, you can overload it:

Unprotect[Sum];
Sum[Plus[leftArg_, rightArg__], {variable_, argStart_,
argEnd_}] := (argEnd - argStart + 1)*leftArg +
Sum[Plus[rightArg], {variable, argStart, argEnd}] /;
FreeQ[leftArg, variable]
Protect[Sum];


Now your Mathematica behaves like you wished:

Sum[x[n] + 1, {n, 1, k}]
Sum[x[n] + 1, {n, 5, k}]


k + Sum[x[n], {x, 0, k}]

-4 + k + Sum[x[n], {x, 5, k}]

_

EDIT: Also notice, that for Mathematica, this isn't a simplification. They're are actual equally complex:

LeafCount[Sum[x[n] + 1, {n, 1, k}]] == LeafCount[k + Sum[x[n], {n, 1, k}]]


True

• That's solved my problem! Thank you very much! – Rodrigo Jan 31 '17 at 17:17