I came across this integral when trying to get the coefficient of a generating function:

$$\int_0^{2\pi} {(1-p + 2p e^{it})^n\over 1-e^{-3it}/8}\;dt$$

Here $p\in [0,1]$ and $n$ is a positive integer. I tried some obvious substitutions but couldn't make any progress. I then fed it into SymPy and the software didn't return anything, which leads me to suspect that this integral just doesn't have an elementary solution. But I am also just quite bad at integration so perhaps there's something I'm not seeing.

(I only need the definite integral but if there exists an indefinite integral that would be really cool as well.)

EDIT: I'm adding more details because the answer below made me realise that I approached this wrongly. I was trying to solve $${1\over 2\pi i} \oint_{|z| = 2} {(1-p+pz)^n \over z(1-z^{-3})}\,dz $$ because I wanted the coefficient of $1/z$ in that series (is the radius I chose correct?). I expanded it to get the integral at the beginning of the question, but as it turns out, that is not the right thing to do. Instead, we should just find the singularities of this function and sum the residues. However, now I am stuck because I'm not sure what constitutes a singularity. For example, I believe we have singularities at the three cube roots of unity, (and these are indeed in the disk of radius 2). But is there a singularity at 0 as well, since we certainly cannot plug in $z=0$ into $z^{-3}$. Any help would be appreciated!

LAST EDIT: There is no singularity at 0, just the three cube roots of unity. By the Residue Theorem, the answer is $\big(p(1) + p(\omega) + p(\omega^2)\big)/3$, where $\omega$ is the primitive cube root of unity and $p(z)$ is the generating function $(1-p+pz)^n$. This value is real. I marked the only answer as accepted because it put me on the path of using the Residue Theorem.


1 Answer 1


put $z=e^{it} $ then $dz =ie^{it} dt $ and the integral becomes $$=\oint_{|z|=1} \frac{(1-p+2pz)^n }{1-\frac{z^{-3}}{8}}\frac{dz}{iz}$$

then use the Residue Theorem.

(Edited by OP to reflect the factor I forgot in the original question, as well as a missing negative in the exponent of the denominator.)

  • $\begingroup$ Oops, so i guess I messed up because the integral in my question actually began as an integral $\oint_{|z|=2} ((1-p+pz)^n/(z(1-z^{-3}))\,dz) / (2\pi i)$. I suppose the correct substitution would be to make $z = 2w$ (there was a missing factor of 2 in the original question, I just fixed it)? $\endgroup$
    – marcelgoh
    Sep 9, 2020 at 17:50
  • $\begingroup$ Hi, just to follow up, how should I approach finding the residues? There are three singularities at the three complex cube roots of 1/8, but is there one at 0 as well? $\endgroup$
    – marcelgoh
    Sep 9, 2020 at 18:10
  • $\begingroup$ @marcelgoh Yes, there are 4 simple poles that are encircled by $|z|=2$. Do you know how to compute the residues? $\endgroup$
    – Mark Viola
    Sep 10, 2020 at 23:01
  • $\begingroup$ @Mark Viola I made a lot of progress since the last time I commented. I multiplied by $z^3$ in the numerator and denominator. This makes it seem like there are only three poles. Then I found the three residues by plugging the three roots of unity into the formula $a(z)/b'(z)$ (where $f(z) = a(z)/b(z)$ is the original function). This gave an answer that seems plausible for what I wanted it to do. Does it seem correct? $\endgroup$
    – marcelgoh
    Sep 11, 2020 at 2:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .