Total number of non negative integer solution of the equation $x+y+z=n$ subjected to the condition $x\leq y \leq z.$
Try:if $x=0$ Then we have $y+z=n$
If $x=1$ Then we have $y+z=n-1$
.....if $x=n$ Then we have $y+z=0$ so $x=y=0$
Could some help me how to calculate for $x+y=n,n-1,n-2$ ect.
Or any nice way to find solution of original equation.Thanks
Let us define $A,B,C$ as follows :
$A$ : The number of non-negative solutions $(x,y,z)$ such that $x\lt y\lt z$.
$B$ : The number of non-negative solutions $(x,y,z)$ such that $x=y\lt z$ or $x\lt y=z$.
$C$ : The number of non-negative solutions $(x,y,z)$ such that $x=y=z$.
Then, the number of solutions such that $x\le y\le z$ is given by $A+B+C$.
The number of non-negative solutions for $x+y+z=n$ is given by $\binom{n+2}{2}=\frac{(n+2)(n+1)}{2}$, so we have $$\frac{(n+2)(n+1)}{2}=3!A+\frac{3!}{2!}B+C\tag1$$
Since $C$ is given by $$C=\begin{cases}1&\text{if $n\equiv 0\pmod 3$}\\\\0&\text{if $n\not\equiv 0\pmod 3$}\end{cases}$$ we can write $$C=\left\lfloor\left\lfloor\frac n3\right\rfloor\div\frac n3\right\rfloor\tag2$$
To find $B$, let us consider $a+a+b=n$ where $a\not=b$, and then
$$b=n-2a\ge 0\implies a\le\frac n2\implies a=0,1,\cdots,\left\lfloor\frac n2\right\rfloor$$
So, we have $$B=\left\lfloor\frac n2\right\rfloor+1-C\tag3$$
From $(1)$, we have $$A=\frac 16\left(\frac{(n+2)(n+1)}{2}-3B-C\right)\tag4$$
Therefore, from $(2)(3)(4)$, the number of solutions with $x\le y\le z$, i.e. $A+B+C$ is given by $$\frac{1}{12}\left((n+2)(n+1)+6\left\lfloor\frac n2\right\rfloor+6+4\left\lfloor\left\lfloor\frac n3\right\rfloor\div\frac n3\right\rfloor\right)$$