# Count the number of solutions of the inequality $a+b+c+d=n$, $a \geq b \geq c \geq d \geq 0$.

How would I count the number of integer solutions to: $a+b+c+d=n$, $a \geq b \geq c \geq d \geq 0$. Thanks for your help!

-

In order to solve the problem with $a\geq b\geq c\geq d\geq 0$, we are gonna use generating functions. First note that we can write $$a+b+c+d=n$$ as $$a+b+c^{'}+2d=n,$$ where we used $c=c^{'}+d$ for some $c^{'} \geq 0$ Repeating this process, we get $$a^{'}+2b^{'}+3c^{'}+4d^{'}=n \,\, a^{'},b^{'},c^{'},d^{'}\geq 0.$$ Now if you are familiar with generating functions, see for example Generating functions for combinatorics, you recognize that the generating function of this equation is the product of $$\frac{1}{1-x}\frac{1}{1-x^2}\frac{1}{1-x^3}\frac{1}{1-x^4}.$$ You seek the coefficient of $x^n$ in the power series of this function. It starts like $$1+x+2\,{x}^{2}+3\,{x}^{3}+5\,{x}^{4}+6\,{x}^{5}+9\,{x}^{6}+11\,{x}^{7 }+15\,{x}^{8}+18\,{x}^{9}+23\,{x}^{10}+27\,{x}^{11}$$ You can find this sequence on OEIS for a greater list.