# How to find the coefficient of $x^k$ in the expression $\prod_{p=1}^n (x^p+1)^p$?

This Question asked on math over flow

I tried to find the indefinite integral $$f_n(x)=\int \prod_{k=1}^n \cos^k(kx)dx$$ by using Euler's formula and put $$x=\frac{\ln y}{2i}$$ I got $$f_n(x)=-i2^{-\frac{n(n+1)}{2}-1}\int y^{-\frac{n(n+1)(2n+1)}{12}-1} \prod_{k=1}^n (y^k+1)^k dy$$ now lets define $$a(n,k)$$ as the coefficient of $$x^k$$ in the expression $$\prod_{p=1}^n (x^p+1)^p$$ then $$\prod_{k=1}^n (y^k+1)^k =\sum_{k=0}^{\frac{n(n+1)(2n+1)}{6}} a(n,k) y^k$$

So $$f_n(x)=2^{-\frac{n(n+1)}{2}-1}\sum_{k=0}^{\frac{n(n+1)(2n+1)}{6}} \frac{a(n,k)}{k-\frac{n(n+1)(2n+1)}{12}} (-i)\exp\left(-2x\left(k-\frac{n(n+1)(2n+1)}{12}\right) i\right)+c$$ and where $$f_n(x)$$ is real So we will take the real part of the result and get $$f_n(x)=2^{-\frac{n(n+1)}{2}-1}\sum_{k=0}^{\frac{n(n+1)(2n+1)}{6}} \frac{a(n,k)}{k-\frac{n(n+1)(2n+1)}{12}}\sin\left(2x\left(k-\frac{n(n+1)(2n+1)}{12}\right)\right)+c$$ and if $$k=\frac{n(n+1)(2n+1)}{12}$$ then take limit to get $$\frac{\sin(2ax)}{a}=2x , a\to0$$

finally if we know $$a(n,k)=a\left(n,\frac{n(n+1)(2n+1)}{6}-k\right)$$ then $$f_n(x)=2^{-\frac{n(n+1)}{2}} a\left(n,\frac{N}{2}\right) x+2^{-\frac{n(n+1)}{2}-1}\sum_{k=1}^{\frac{N}{2}} \frac{a\left(n,\frac{N}{2}-k\right)}{k} \sin\left(2kx\right)+c ,\text{if } N \text{ is even}$$ and $$f_n(x)=2^{-\frac{n(n+1)}{2}+1}a\left(n,\frac{N-1}{2}\right)\sin\left(x\right)+2^{-\frac{n(n+1)}{2}}\sum_{k=1}^{\frac{N-1}{2}} \frac{a\left(n,\frac{N-1}{2}-k\right)}{2k+1} \sin\left((2k+1)x\right)+c ,\text{if } N \text{ is odd}$$ where $$N=\frac{n(n+1)(2n+1)}{6}$$

now my QUESTIONS

How to calculate $$a(n,k)$$ or even what is the recurrence relation?

also How to prove that $$a(n,k)=a\left(n,\frac{n(n+1)(2n+1)}{6}-k\right)$$?

and when we took the real part if we took the imaginary part it will be zero So How to prove $$\sum_{k=0}^{\frac{n(n+1)(2n+1)}{6}} \frac{a(n,k)}{k-\frac{n(n+1)(2n+1)}{12}}\cos\left(2x\left(k-\frac{n(n+1)(2n+1)}{12}\right)\right)=c$$

• Have you considered the log of the original expression and use the Taylor expansion of $\log(1+u)$? Commented Feb 12 at 21:20
• @StefanLafon No..please show how can you get it by that way Commented Feb 12 at 21:35
• Hmm, on second thoughts, that was not one of my brightest ideas :) I don't think it helps are all. Commented Feb 12 at 23:12
• Related post
– Sil
Commented Feb 12 at 23:39
• If one takes $n\to\infty$, the resulting infinite series is tabulated on OEIS as A026007. This entry does not include an explicit formula for the $n$th term, so I'm not sure one should hope for such in that case (let alone the case for finite $n$). Commented Feb 13 at 19:01

firstly the degree of $$(x^p+1)^p$$ is $$p^2$$ So the degree of $$\prod_{p=1}^n (x^p+1)^p$$ is $$N=1+2^2+3^2+...+n^2=\frac{n(n+1)(2n+1)}{6}$$ now we have $$\prod_{p=1}^n (x^p+1)^p=\sum_{p=1}^N a(n,p)x^p$$ by taking kth derivative and put $$x\to0$$ we get $$\lim_{x\to0} \frac{d^k}{dx^k} \prod_{p=1}^n (x^p+1)^p=\lim_{x\to0} \frac{d^k}{dx^k}\sum_{p=1}^N a(n,p)x^p$$ But for natural $$k,p$$ $$\lim_{x\to0} \frac{d^k}{dx^k} x^p=0 ,p\ne k$$ So $$\lim_{x\to0} \frac{d^k}{dx^k} a(n,k)x^k=\lim_{x\to0} \frac{d^k}{dx^k} \prod_{p=1}^n (x^p+1)^p$$ then $$a(n,k)=\frac{1}{k!}\lim_{x\to0} \frac{d^k}{dx^k} \prod_{p=1}^n (x^p+1)^p$$ now to find the kth derivative we need to use General Leibniz rule and get $$\frac{1}{k!}\lim_{x\to0} \frac{d^k}{dx^k} \prod_{p=1}^n (x^p+1)^p=\frac{1}{k!}\sum_{k_1+k_2+...+k_n=k} \binom{k}{k_1,k_2,...,k_n} \prod_{j=1}^n \lim_{x\to0} \frac{d^{k_j}}{dx^{k_j}} (x^j+1)^j$$ where $$\lim_{x\to0} \frac{d^{k_j}}{dx^{k_j}} (x^j+1)^j=\sum_{p=0}^j \binom{j}{p} \lim_{x\to0} \frac{d^{k_j}}{dx^{k_j}} x^{pj}$$ So it must be $$k_j=pj$$ which mean $$\frac{k_j}{j}\in N$$ or its value is zero then $$\lim_{x\to0} \frac{d^{k_j}}{dx^{k_j}} (x^j+1)^j=\binom{j}{\frac{k_j}{j}} k_j!f\left(\frac{k_j}{j}\right) , 0 \leq\frac{k_j}{j}\leq j$$ where $$f(x)=1$$ if $$x\in N$$ and $$f(x)=0$$ if $$x \notin N$$
back to the formula we have $$a(n,k)=\frac{1}{k!}\sum_{k_1+k_2+...+k_n=k} \binom{k}{k_1,k_2,...,k_n} \prod_{j=1}^n \lim_{x\to0} \frac{d^{k_j}}{dx^{k_j}} (x^j+1)^j$$ $$=\sum_{k_1+k_2+...+k_n=k} \frac{1}{k_1!k_2!...k_n!} \prod_{j=1}^n \binom{j}{\frac{k_j}{j}} k_j!f\left(\frac{k_j}{j}\right)$$ So $$a(n,k)=\sum_{k_1+k_2+...+k_n=k}\prod_{j=1}^n \binom{j}{\frac{k_j}{j}} f\left(\frac{k_j}{j}\right)$$ now put $$g_j=\frac{k_j}{j}$$ So $$a(n,k)=\sum_{g_1+2g_2+...+ng_n=k}\prod_{j=1}^n \binom{j}{g_j} f\left(g_j\right)$$ where $$g_1+2g_2+...+ng_n=k$$ with $$0\leq g_j \leq j$$ which mean $$g_j\in\{0,1,2,...,j\}$$ So $$f(g_j)=1$$
finally I got $$a(n,k)=\sum_{\substack{\sum_{j=1}^n j g_j=k \\ g_j\in\{0,1,..,j\}}}\prod_{j=1}^n \binom{j}{g_j}$$
and because of $$g_j\in\{0,1,..,j\}$$ then we can put $$g_j\to j-g_j$$ then $$\sum_{j=1}^n j (j-g_j)=k \to \sum_{j=1}^n j g_j=N-k$$ which mean $$a(n,k)=a(N-k)$$
and for the last question to prove the given series is constant function for $$x$$ lets define $$f(x)$$ and rewrite $$\cos x$$ as real part of $$e^{ix}$$ So $$f(x)=\Re\left(\sum_{\substack{k=0 \\ k\ne \frac{N}{2}}}^N \frac{a(n,k)}{k-\frac{N}{2}} \exp\left(2ix\left(k-\frac{N}{2} \right) \right) \right)$$ note that the case $$k=\frac{N}{2}$$ is real valued by using limit : $$\frac{\sin(ax)}{a} , a\to 0$$ , then by derivative $$f'(x)=\Re\left(2i\sum_{\substack{k=0 \\ k\ne \frac{N}{2}}}^N a(n,k) \exp\left(2ix\left(k-\frac{N}{2} \right) \right) \right)$$ $$=-2\Im\left(e^{-iNx}\sum_{k=0}^N a(n,k) e^{2ikx}-a\left(n,\frac{N}{2}\right) \right)=-2\Im\left(e^{-iNx}\prod_{k=1}^n \left(e^{2ikx}+1\right)^k\right)$$ $$=-2\Im\left(\prod_{k=1}^n e^{-ik^2x} \left(e^{2ikx}+1\right)^k\right)=-\Im\left(\prod_{k=1}^n \left(2 \cos (kx)\right)^k \right)=0$$ therefore $$f'(x)=0$$ which mean $$f(x)$$ is constant for $$x$$