Let

This is geometric progression with first member x and q=x.

Therefore, its sum is

We obtained equality:

Differentiating with respect to x yields:

Since x is n-th root of unity then and we can write above equality as

Or

Again, since then

Finally,

As can be seen from formula x=1 can't be applied to the formula.

When x=1

Therefore, if x=1 , otherwise