<s>[INST] Please explain how to derive the PGF of a 6 sided dice I understand the PGF is
$$ P(s) = \frac{s}{6} \frac{1-s^6}{1-s} $$
Can someone explain all the steps to get there
 [/INST] We want
$$f(x)=x+x^2+x^3+\cdots +x^6.$$
By long division we can prove that
$$\frac{1}{1-x}=1+x+x^2+x^3+\cdots$$
If we multiply the above expression by $1-x^7$ we are going to see a pattern where all the $x^n$ exponents will cancel out after $x^6$:
$$\begin{align}&(1-\color{red}{x^7})+(x-\color{blue}{x^8}) +(x^2-x^9)+\cdots+(\color{red}{x^7}-x^{14})+(\color{blue}{x^8}-x^{15})+\cdots\\[2ex]&=1+x+x^2+\cdots+x^6
\end{align}$$
Now we have to get rid of the $1$ in front by multiplying the series by $x.$ That will require reducing the exponent in the numerator exponent from $1-x^7$ to $1-x^6.$
This leaves us with $x\frac{1-x^6}{1-x}.$ And since the probability of each outcome is $1/6,$ the expression is derived:
$$f(x)=\frac 1 6 \frac{x(1-x^6)}{1-x}$$
</s>