# Counting triples with a fixed sum using Kronecker delta and complex integration

Let $(n_1,n_2,n_3)$ a triple of non-negative integers summing up to $27$, i.e. $n_1+n_2+n_3=27$. I want to count how many triples there are satisfying this constraint, using the contour integral representation of the Kronecker delta. In principle, I should be able to count the number of triples in two different ways: $$I_1=\sum_{n_1=0}^{27}\sum_{n_2=0}^{27}\sum_{n_3=0}^{27}\delta_{n_1+n_2+n_3,27}$$ $$I_2=\sum_{n_1=0}^{\infty}\sum_{n_2=0}^{\infty}\sum_{n_3=0}^{\infty}\delta_{n_1+n_2+n_3,27}$$ (I believe I should be allowed to extend the range of the summations to $\infty$, landing on $I_2$, as clearly numbers $n_i>27$ cannot contribute to the counting). However, if I carry out the calculation in the two cases using the integral representation of the Kronecker delta function, the second 'version' ($I_2$) seems problematic (also for Mathematica). Using $$\delta_{a,b}=\frac{1}{2\pi\mathrm{i}}\oint_{|z|=1}dz\ z^{a-b-1}\ ,$$ I obtain $$I_1 =\frac{1}{2\pi\mathrm{i}}\oint_{|z|=1}\frac{dz}{z^{28}}\left(\sum_{n=0}^{27} z^n\right)^3= \frac{1}{2\pi\mathrm{i}}\oint_{|z|=1}\frac{dz}{z^{28}}\left(\frac{-1+z^{28}}{-1+z}\right)^3 =\mathrm{Res}\left(\frac{1}{z^{28}}\left(\frac{-1+z^{28}}{-1+z}\right)^3;\{z,0\}\right) =406\ ,$$ using Cauchy's residue theorem (there is a pole of order $28$ in zero and a removable singularity at $z=1$ on the contour). The answer is correct. However, if I attempt to compute $I_2$ $$I_2 =\frac{1}{2\pi\mathrm{i}}\oint_{|z|=1}\frac{dz}{z^{28}}\left(\sum_{n=0}^{\infty} z^n\right)^3= \frac{1}{2\pi\mathrm{i}}\oint_{|z|=1}\frac{dz}{z^{28}}\left(\frac{1}{1-z}\right)^3$$ I run into potential troubles, as the earlier removable singularity has now become a 3rd-order pole right on the contour. This presumably forces me to reinterpret it as a Cauchy principal value integral (which I am not super-familiar with). Mathematica has also some problems in evaluating the integral in $I_2$ (setting $z=\exp(\mathrm{i\theta})$), while the integral in $I_1$ is perfectly fine. Now, assuming that the $n_i$s can be safely extended to $\infty$ (I do not see why they shouldn't), I would be grateful if you could help me with the evaluation of the PV integral $I_2$ and confirm that it also yields 406. And if it doesn't, where do things go wrong? Many thanks in advance.

Imagine permitting $M$ terms in each sum in $I_1$. Then the integrand is

$$\frac1{z^{28}}\left (\frac{1-z^M}{1-z} \right )^3 = \frac1{z^{28}}\left (1-3 z^M + 3 z^{2 M}-z^{3 M} \right ) \sum_{n=0}^{\infty} \binom{n+2}{n} z^n$$

For example, if $M=7$, then we have contributions at $n=27$, $n=20$, $n=13$, and $n=6$, so that the total number of triples becomes

$$\binom{29}{27} - 3 \binom{22}{20} + 3 \binom{15}{13} - \binom{8}{6} = \frac12 (29 \cdot 28 - 3 \cdot 22 \cdot 21 + 3 \cdot 15 \cdot 14-8 \cdot 7) = 33$$

When $M \gt 27$, it no longer matters what $M$ is; the answer will remain $406$ as $M$ increases. Thus, this is how we view the Cauchy principal value: we take the limit as $M \to \infty$.

It should be noted that the actual integral represented by $I_2$ doesn't even exist as a Cauchy PV, as we have a triple pole on the contour. The only way I see around this problem is to consider $M$ very large but finite.

• many thanks for your answer. However, I am still a bit 'puzzled' by the fact that I started from a seemingly legitimate expression $I_2$ (in terms of sums extending to infinity), and end up with an integral expression for $I_2$ that apparently does not make sense (even as a PV). Is this then a case where the limit ($M\to\infty$) and the contour integral cannot be exchanged? I would then love to learn which hypotheses of what theorem are violated in this case... – Pierpaolo Vivo Jan 4 '16 at 8:55
• @PierpaoloVivo: To be honest, I am a bit puzzled too. But keeping $M$ finite and large is the only way I can reconcile how this all works. I guess the problem is that, near $z=1$, $z^M$ may not be as small as we would like. I'll bet that's the origin of the misunderstanding. – Ron Gordon Jan 4 '16 at 14:12