$x+y+z=n$. Finding the number of solutions.

I have found two formulas. I want to connect them!

The number of ways in which a given positive integer $n≥3$ can be expressed as a sum of three positive integers $x,y,z$ (i.e. $x+y+z=n$) , subject to $x≤y≤z$ is the integer closest to $\frac{n^2}{12}$.

If $x+y+z=n$ where $x,y,z$ are postive integers then the number of ways is ${n-1 \choose 2}$ .

The difference between these two formula is the condition $x≤y≤z$. Can we connect these two ?? Please help me!

I mainly wants to know how one implies the other.


Solution 1:

Just by looking at the generating functions, we can see a link (colors applied) ...


The number of solutions for $x+y+z=n, x\geq1, y\geq1, z\geq1$ is the coefficient of $x^n$ term of the $$(x+x^2+x^3+...+x^k+...)^3=\color{red}{\frac{x^3}{(1-x)^3}}$$ But because $$\color{blue}{\frac{1}{(1-x)^3}= \frac{1}{2}\left(\frac{1}{1-x}\right)^{''}= \frac{1}{2}\left(\sum\limits_{k=0}x^k\right)^{''}= \sum\limits_{k=2}\frac{k(k-1)}{2}x^{k-2}}$$ we have $$\frac{x^3}{(1-x)^3}= \sum\limits_{k=2}\frac{k(k-1)}{2}x^{k+1}= \sum\limits_{k=3}\frac{(k-1)(k-2)}{2}x^{k}$$ and the coefficient of $x^n$ is $\color{green}{\frac{(n-1)(n-2)}{2}=\binom{n-1}{2}}$.


The number of solutions for $x+y+z=n, 1\leq x \leq y\leq z$ (like in this example) can be found from the reformulated version $$x=x_1, y=x+y_1=x_1+y_1, z=y+z_1=x_1+y_1+z_1 \Rightarrow \\ 3x_1+2y_1+z_1=n \\ x_1\geq1, y_1\geq0, z_1\geq0$$ with the generating function $$\left(x^3+x^{2\cdot 3}+...+x^{k\cdot 3}+...\right)\left(1+x^2+x^{2\cdot 2}+...+x^{k\cdot 2}+...\right)\left(1+x^2+...+x^k+...\right)=\\ \frac{x^3}{1-x^3}\cdot \frac{1}{1-x^2}\cdot \frac{1}{1-x}= \color{red}{\frac{x^3}{(1-x)^3}}\cdot\frac{1}{1+x}\cdot\frac{1}{1+x+x^2}=\\ \frac{1}{6(1-x)^3}-\frac{1}{4(1-x)^2}-\frac{1}{72(1-x)}-\frac{1}{8(1+x)}+\frac{2+x}{9(1+x+x^2)}=\\ \color{blue}{\sum\limits_{k=2}\frac{k(k-1)}{12}x^{k-2}}- \sum\limits_{k=1}\frac{k}{4}x^{k-1}- \sum\limits_{k=0}\frac{x^{k}}{72}-\sum\limits_{k=0}\frac{(-1)^kx^k}{8}+ \frac{2+x}{9}\sum\limits_{k=0}U_k\left(-\frac{1}{2}\right)x^k$$ where $U_k(x)$ are Chebyshev polynomials of the second kind. The coefficient of $x^n, n\geq2$ is $$\frac{n(n-1)}{12}-\frac{n}{4}-\frac{1}{72}-\frac{(-1)^k}{8}+\frac{2}{9}U_n\left(-\frac{1}{2}\right)+\frac{1}{9}U_{n-1}\left(-\frac{1}{2}\right)=\\ \frac{6n^2-24n-1-9(-1)^n}{72}+\frac{2\sin{\left((n+1)\theta\right)}+\sin{\left(n\theta\right)}}{9\sin{\theta}}$$ where $\cos{\theta}=-\frac{1}{2}$. This is asymptotically close to $\color{green}{\frac{n^2}{12}}$.