# How to compute the residue of $f(z)=\frac{n/z}{z^{n}-1}$ to be $-n$ at $z=0$? [duplicate]

How to get residue of $$f(z)=\frac{n/z}{z^{n}-1}$$ with correct residue of $$-n$$ at zero?

It works it out just fine at 1 with:

Residue[(n/z/(z^n - 1)), {z, 1}]

• Comments have been moved to chat; please do not continue the discussion here. Before posting a comment below this one, please review the purposes of comments. Comments that do not request clarification or suggest improvements usually belong as an answer, on Mathematica Meta, or in Mathematica Chat. Comments continuing discussion may be removed.
– Kuba
Feb 25 at 19:59
• I agree with @user64494 that this is not a complete duplicate and further the closure of the question. However I'm grateful for time and useful information all have contributed nevertheless. If I understand the system correctly the question might be automatically removed in time especially as it is now likely to attract downvotes - rather unfortunate considering it might help somebody else. TTFN Feb 25 at 20:26

Regarding the comment: the residue at z=1 is clearly wrong

If a function, $$f(z)$$, has a pole of order $$k$$ at $$z=z_0$$ then

$$$$\text{Res}(f,z_0)=\frac{1}{(k-1)!}\frac{d^{k-1}}{dz^{k-1}} \left[(z-z_0)^k f(z) \right]\Bigg|_{z=z_0}$$$$

Ok, so let's consider the function -which is the example in the OP with $$n=1$$

$$$$f = - \frac{1}{z(1-z)}$$$$

The above has a pole of order $$1$$ at $$z=0$$ and a pole of order $$1$$ at $$z=1$$. Hence, we compute explicitly

$$\text{Res}(f,0) = \frac{1}{(1-1)!} \left((z-0)^1(-)\frac{1}{z}\frac{1}{1-z} \right)\Bigg|_{z=0} = - 1$$

and also

$$\text{Res}(f,1) = \frac{1}{(1-1)!} \left((z-1)^1(-)\frac{1}{z}\frac{1}{1-z} \right)\Bigg|_{z=1} = 1$$

And likewise for higher values of $$n$$.

So, when Mathematica computes

Residue[n/(z (z^n - 1)) /. n -> 1, {z, 0}]
Residue[n/(z (z^n - 1)) /. n -> 1, {z, 1}]


as

-1

1

it is indeed correct.

Then, all the methods agree.

@Artes suggested

FindSequenceFunction[Table[Residue[n/(z (z^n - 1)), {z, 0}], {n, 10}],
n]


which returns

-n

and is the same as

Assuming[n ∈ Integers && n >= 1,
Simplify@SeriesCoefficient[n/(z (z^n - 1)), {z, 0, -1}]]


from the linked question. Credits are to @Carl Woll.

Hopefully the above offers some clarity and will stop the war of the comments.

• Assuming[n \[Element] Integers && n >= 1, Simplify@SeriesCoefficient[n/(z (z^n - 1)), {z, 0, -1}]] is somewhat more exact. Feb 25 at 14:53
• I'd like to notice SeriesCoefficient[n/(z (z^n - 1)), {z, 0, -1}, Assumptions -> n \[Element] Integers && n >= 1] returns Piecewise[{{-n, Mod[0, n] == 0}}, 0]. Feb 25 at 14:58
• @user64494 regarding your first comment, yes you are correct. my bad as I was copying and pasting. regarding your second comment take into consideration that SeriesCoefficient[n/(z (z^n - 1)), {z, 0, -1}, Assumptions -> n \[Element] Integers && n >= 1] // FullSimplify returns -n
– bmf
Feb 25 at 15:04