# How to calculate the sum or difference of two probability generating functions?

Suppose I have probability generating functions $$G_{X}(t) = 0.1t+0.2t^{2}+0.7t^{3}\quad\text{and}\quad G_{Y}(t)=0.5+0.4t^{2}+0.1t^{3}.$$ In other words, the random variable $X$ gets the discrete values $P(X=1)=0.1, P(X=2)=0.2,\ \text{and}\ P(X=3)=0.7$.

How do I calculate the sum or difference of $G_{X}$ and $G_{Y}$? It would feel intuitive to write $$G_{X}(t)+G_{Y}(t) = 0.5 + 0.1t + 0.6t^{2}+0.8t^{3}$$ but the coefficients sum over $1$. If I divide each coefficient by $2$ then they sum again to $1$. Is that the correct to way to approach this?

Edit: Sorry for being unclear. I was trying to ask about $G_{X+Y}$, so the PGF of the sum of $X$ and $Y$. The variables can be assumed to be independent.

• The sum of two functions is well defined (as is the difference); if you say "the sum of $G_X$ and $G_Y$" you're simply saying "$G_X+G_Y$" in words. What is it you actually mean to ask? Are you asking for the pgf of $X+Y$ (ie the pgf of the sum, rather than the sum of the pgfs?) Commented Nov 10, 2015 at 14:28
• Sorry for being unclear. I was trying to ask about $G_{X+Y}$, so the PGF of the sum of $X$ and $Y$. The variables can be assumed to be independent.
– jje
Commented Nov 10, 2015 at 17:37
• That independence assumption is critical; I'll edit this information into your question. Commented Nov 10, 2015 at 21:41
• You can deal with a general result when you are considering convex combinations: if $\mathrm P_1, \mathrm P_2$ are probability generating functions and $\alpha\in[0, 1],$ then $\alpha\mathrm P_1 +(1-\alpha) \mathrm P_2$ is a probability generating function. It is not hard to see why: check whether the coefficients of $s^n$ in the convex combination (are non-negative, of course) sum to $1.$ Reference: Probability and Random Processes, Geoffrey Grimmett, David Stirzaker, Oxford University Press, 2020, sec. 5.1. Commented Apr 21, 2023 at 13:19

$G_{X}(t) + G_{Y}(t)$ is not a probability generating function in general. But if $X$ and $Y$ are independent you have the case that $G_{X+Y}(t) = G_{X}(t) G_{Y}(t)$, which might be what you're interested in.

Based on comments from the OP the question is really asking for a product of the two generating functions which is equivalent to asking about the distribution of $$Z=X+Y$$ where $$X$$ and $$Y$$ are independent random variables. Taking the product of the two functions in $$t$$ and collecting terms gives the answer

$$0.05t+0.1t^2+0.39t^3+0.09t^4+0.3t^5+0.07t^6$$

Where the exponent in $$t$$ tells us the value of $$Z$$ and the coefficient in front of the $$t$$ power tells us the corresponding probability. For example, $$\Pr(Z=1)=0.05$$ $$\Pr(Z=2)=0.1$$ etc. Note this only works if the two variables are independent. If they are dependent one way is to get the answer is to specify the joint distribution and calculate the convolution.

Are both your probability generating functions independent from each other ?

The joint probability of two probability generating functions is their product only if the two are independent. If there is some covariance between the two functions, this needs to be taken into account following Bayes' rule:

P(A given B)=P(A)*P(B given A)/P(B)

• For independent events: P(A and B) = P(A) *P(B) (because P(B given A)=P(B))
• For dependent events: P(A and B) = P(A) *P(B given A)