I was recently studying a theorem called Multinomial Theorem, in combinatorics, the theory regarding the topic was given in my book as follows,
Consider the equation $$x + y+ z = 4$$ and that we have to find the number of non-negative integrals solution to this equation, every single variable can take values from $0$ to $4$, both included, let their values be set as the exponent of some quantity say, $p$, for each variable the set of terms with different exponents of $p$ is $\{p^0, p^1, p^2, p^3,p^4, p^4\}$
The number of all possible triplets is the no. of terms in the product $$(p^0 + p^1 + p^2 + p^3 + p^4 + p^4)^3$$ Each term for a variable i.e. $x,y,z$.
To find the number of integral solutions for the equation we must find the coefficient of $p^4$ in the expansion of the above polynomial, hence we have to figure out the coefficient of $p^4$ in $$(1-p^5)^3(1-p)^{-3}$$
or its coefficient in $(1-p)^{-3}$.
Till this point in the theory I understood everything quite well, now the textbook put forward the taylor series expansion of $(1-x)^{-n}$ to help us solve the problem,
$$(1-x)^{-n} = \sum_{k = 0}^{\infty}{n +k-1\choose k}x^k$$
Now I have studied calculus, so taylor series are not new to me, however now the textbook proceeded to find the coefficient of $p^4$ using this taylor expansion, and stating that as the answer.
What i do not understand is that why does this work?, how do the coefficients of the taylor series actually answer the problem, nowhere in computing the taylor series was i adding up exponents of the various terms then why does this even work.
Any help would be highly appreciated!.