This is an off-shot from [my previous post](https://mathoverflow.net/questions/353715/an-identity-for-polynomials-over-partitions) on MO.


Given an integer partition $\lambda=(\lambda\_1,\dots,\lambda\_{\ell(\lambda)})$ of $n$, denote $\ell(\lambda)$ to be the length of $\lambda$.


Let $r\_2(n)$ denote the number of ways of expressing $n$ as a sum of two squares of integers, [look it up on OEIS](https://oeis.org/A004018).


Here is perhaps a "new formulation" of $r\_2(n)$:



> 
> **QUESTION.** Is this true? If it is, please either provide a reference or a proof.
>  $$r\_2(n)
> =\sum\_{\lambda\vdash n}(-1)^{n-\lambda\_1}{\prod\_{j=1}^{\ell(\lambda)}} \,4\,(\lambda\_j-\lambda\_{j+1})$$
>  where $\lambda\_{\ell(\lambda)+1}=0$ and the product excludes $\lambda\_j=\lambda\_{j+1}$.
> 
> 
> 


**Example.** Take $n=4$. The solutions to $4=x^2+y^2$ are $(\pm2,0), (0,\pm2)$ and hence $r\_2(4)=4$. On the other hand, $\lambda=(4,0), (3,1,0), (2,2,0), (2,1,1,0), (1,1,1,1,0)\vdash 4$ so that 
$$(-1)^{4-4}4\cdot4+(-1)^{4-3}4\cdot2\cdot4\cdot1+(-1)^{4-2}4\cdot2
+(-1)^{4-2}4\cdot1\cdot4\cdot1+(-1)^{4-1}4\cdot1=4.$$



Sum of squares and partitions
Start by checking that the following formal product can be expanded as a sum over partitions
$$\prod\_{i\geq 1}\left(1+\sum\_{r\geq 1}a\_r(x\_1x\_2\cdots x\_i)^r\right)=\sum\_{\lambda}\left(\prod\_{j\geq 1}a\_{\lambda\_j-\lambda\_{j+1}}\right)\left(\prod\_{j\geq 1}x\_j^{\lambda\_j}\right)$$
with the convention that $a\_0=1$. The proof of this is really just a weighted version of the usual generating function for partitions.


If we set $x\_1=t$ and $x\_i=-t$ for $i\geq 2$, and all $a\_r=4r$ for $r\geq 1$ then the right side becomes 
$$\sum\_{n\geq 0} t^n\sum\_{\lambda\vdash n}(-1)^{n-\lambda\_1}{\prod\_{j=1}^{\ell(\lambda)}} \,4\,(\lambda\_j-\lambda\_{j+1})$$
and the identity says that this is equal to the product
$$\prod\_{i\geq 1} \left(1+\frac{4(-1)^{i-1}t^i}{(1-(-1)^{i-1}t^i)^2}\right)=\frac{(1+t)^2}{(1-t)^2}\cdot \frac{(1-t^2)^2}{(1+t^2)^2}\cdot \frac{(1+t^3)^2}{(1-t^3)^2}\cdots$$
$$=\prod\_{k\geq 1}\frac{(1-t^{2k})^{10}}{(1-t^k)^4(1-t^{4k})^4}.$$
This last final expression is a [well known product formula](https://en.wikipedia.org/wiki/Dedekind_eta_function) for $r\_2(n)$:
$$\sum\_nr\_2(n)t^n=\frac{\eta(t^2)^{10}}{\eta(t)^4\,\eta(t^4)^4}, \qquad
\text{where $\eta(t)=t^{\frac1{24}}\prod\_{k=1}^{\infty}(1-t^k)$ is the Dedekind eta function}.$$
So your identity follows.


