# n-th derivative of an arbitrary polynomial / power series

How can I tell mathematica to give me the symbolic derivative of the following sum $$\frac{\partial^n}{\partial x^n}\sum_{j=0}^N\gamma_jx^j=\sum_{j=n}^N\frac{j!}{(j-n)!} \gamma_jx^{j-n}$$ I only get the left hand side with my simple but wrong code:

G=Sum[Subscript[\[Gamma], i]*(x)^i, {i, 0, N}]
Assuming[n <= N, D[G, {x, n}]


Quick followup question: How do I get $$\gamma_nn!$$ for x=0?

EDIT: Thanks to @BobHanlon for his answer! (I fixed the lower bound in the sum) However, I cannot get the rule interact, with say, standard product rule i.e.

Unprotect[D];
D[Sum[expr_, {k_Symbol, kmin_, kmax_}], {x_, n_}] := Sum[D[expr, {x, n}], {k, kmin + n, kmax}];
Unprotect[D];
D[x*Sum[Subscript[\[Gamma], i]*(x)^i, {i, 0, N}],{x,n}]


what's the issue here? Cheers!

Clear["Global*"]

rule = D[Sum[expr_, {k_Symbol, kmin_, kmax_}], {x_, n_}] :>
Sum[D[expr, {x, n}], {k, kmin, kmax}];

Format[γ[j_]] := Subscript[γ, j]

expr = Sum[γ[j] x^j, {j, 0, n}];

(expr2 = D[expr, {x, n}] /. rule) // TraditionalForm


where FactorialPower is used and expr2 equivalent to

TraditionalForm[
expr3 = ReplacePart[expr2, 1 -> FunctionExpand[expr2[[1]]]] /.
Gamma[z_] :> (z - 1)!]


Clear["Global*"]

EDIT: Regarding your edit, first, do not modify the definition of internal functions. You would most likely have unintended consequences.

The original rule does not work with your second example because your second expression has a different form than the one in the rule. To generalize the rule, modify the rule to

rule2 = D[expr1_ * Sum[expr2_, {k_Symbol, kmin_, kmax_}], {x_Symbol, n_}] :>
Sum[D[expr1*expr2, {x, n}], {k, kmin, kmax}];


I have changed N to imax since N has a special meaning in Mathematica.

(expr4 = D[x*Sum[Subscript[γ, i]*x^i, {i, 0, imax}], {x, n}] /.