Suppose I have 4 numbers, $x_0,x_1,x_2$ and $x_3$, and the sum, $$x_0+x_1+x_2+x_3$$ I put the constraint that $x_0$ and $x_3$ are either 1 or 0, and $x_0$ and $x_3$ can be equal or between $0$ to $3; (0,1,2,3)$. I am looking for the generating function of this?
Side note, for a simpler case I know when the only constrain is $$0\leqslant x_i\leqslant 3$$ then the generating function would be $$f(x)=(x^{0}+x^{1}+x^{2}+x^{3})^{4}=(1+x+x^{2}+x^{3} )^{4}$$
Well, aren't we looking for the coefficient of $x^4$ in the polynomial $$(1+x)^2\cdot(1+x+x^2+x^3)^2$$since $x_0,x_3$ are limited to $0,1$, hence the function $(1+x)$, and the others as you've presented.
So, the polynomial, when expanded, is $$x^8+4x^7+8x^6+12x^5+14x^4+12x^3+8x^2+4x+1$$Hence, our answer is $\color{red}{14}$.