# Examples of convolution (discrete case)

Consider the following problems.

Problem 1
Roll a fair die two times. What is the probability that the sum of the two rolls is 5?

Problem 2
There are two independent multiple choice quizzes where each quiz has 5 questions. Each question on the first quiz has 4 choices and each question on the second quiz has 5 choices. Suppose a student answers the questions in the quizzes by pure guessing. What is the probability that the student obtains 5 correct answers in these two quizzes?

Problem 3
For the two independent quizzes in Problem 2, find the probability function for the total number of correct answers. What is the probability that the student get 6 or more correct answers in the two quizzes?

Problem 4
There are two independent multiple choice quizzes where each quiz has 5 questions. There are 5 choices for all questions in these two quizzes. Suppose the student answers the questions in the quizzes by pure guessing. Find the probability function for the total number of correct answers.

All of the above problems are about the independent sum of discrete random variables. We demonstrate the convolution technique using Problem 2.

The Convolution Formula (Discrete Case)
Let $X$ and $Y$ be independent discrete random variables with probability functions $p_X(x)=P(X=x)$ and $p_Y(y)=P(Y=y)$, respectively. Then the following is the probability function of $Z=X+Y$.

\displaystyle \begin{aligned}p_Z(z)&=\sum \limits_{x+y=z} p_X(x) \ p_Y(y) \\&\text{ } \\&=\sum \limits_{x} p_X(x) \ p_Y(z-x) \\&\text{ } \\&=\sum \limits_{y} p_X(z-y) \ p_Y(y) \end{aligned}

Note that the joint probability function of $X$ and $Y$ is $p_{X,Y}(x,y)=p_X(x) \ p_Y(y)$. The convolution formula says that the probability function of the independent sum $Z=X+Y$ is obtained by summing the joint probabiity over the line $x+y=z$.

Problem 2
Let $X$ be the number of correct guesses in quiz 1 and let $Y$ be the number of correct guesses in quiz 2. The variable $X$ has a binomial distribution with parameters $n=5$ and $p=\frac{1}{4}$. The variable $Y$ has a binomial distribution with parameters $n=5$ and $p=\frac{1}{5}$. Let $Z=X+Y$.

\displaystyle \begin{aligned}p_Z(5)&=P(X=0)P(Y=5)+P(X=1)P(Y=4)+P(X=2)P(Y=3) \\&\text{ } \\&\ \ \ +P(X=3)P(Y=2)+P(X=4)P(Y=1)+P(X=5)P(Y=0) \\&\text{ } \\&=\binom{5}{0} \biggl(\frac{1}{4}\biggr)^0 \biggl(\frac{3}{4}\biggr)^5 \ \ \binom{5}{5} \biggl(\frac{1}{5}\biggr)^5 \biggl(\frac{4}{5}\biggr)^0 \\&\ \ \ +\binom{5}{1} \biggl(\frac{1}{4}\biggr)^1 \biggl(\frac{3}{4}\biggr)^4 \ \ \binom{5}{4} \biggl(\frac{1}{5}\biggr)^4 \biggl(\frac{4}{5}\biggr)^1 \\&\ \ \ +\binom{5}{2} \biggl(\frac{1}{4}\biggr)^2 \biggl(\frac{3}{4}\biggr)^3 \ \ \binom{5}{3} \biggl(\frac{1}{5}\biggr)^3 \biggl(\frac{4}{5}\biggr)^2 \\&\ \ \ +\binom{5}{3} \biggl(\frac{1}{4}\biggr)^3 \biggl(\frac{3}{4}\biggr)^2 \ \ \binom{5}{2} \biggl(\frac{1}{5}\biggr)^2 \biggl(\frac{4}{5}\biggr)^3 \\&\ \ \ +\binom{5}{4} \biggl(\frac{1}{4}\biggr)^4 \biggl(\frac{3}{4}\biggr)^1 \ \ \binom{5}{1} \biggl(\frac{1}{5}\biggr)^1 \biggl(\frac{4}{5}\biggr)^4 \\&\ \ \ +\binom{5}{5} \biggl(\frac{1}{4}\biggr)^5 \biggl(\frac{3}{4}\biggr)^0 \ \ \binom{5}{0} \biggl(\frac{1}{5}\biggr)^0 \biggl(\frac{4}{5}\biggr)^5 \\&\text{ } \\&=\frac{129367}{3200000}=0.0404271875 \end{aligned}

Problem 3
Let $Z=X+Y$ where $X$ and $Y$ are as in Problem 2. The following probabilities are obtained by applying the convolution formula.

$\displaystyle P(Z=0)=\frac{248832}{3200000}=0.07776$

$\displaystyle P(Z=1)=\frac{725760}{3200000}=0.2268$

$\displaystyle P(Z=2)=\frac{950400}{3200000}=0.297$

$\displaystyle P(Z=3)=\frac{735840}{3200000}=0.22995$

$\displaystyle P(Z=4)=\frac{373020}{3200000}=0.11656875$

$\displaystyle P(Z=5)=\frac{129367}{3200000}=0.040427$

$\displaystyle P(Z=6)=\frac{31085}{3200000}=0.009714$

$\displaystyle P(Z=7)=\frac{5110}{3200000}=0.001596875$

$\displaystyle P(Z=8)=\frac{550}{3200000}=0.000171875$

$\displaystyle P(Z=9)=\frac{35}{3200000}=0.0000109375$

$\displaystyle P(Z=10)=\frac{1}{3200000}$

$\displaystyle P(Z \ge 6)=\frac{36781}{3200000}=0.011494$

Problem 4
Let $Z=X+Y$ where both $X$ and $Y$ are binomial with parameter $n=5$ and $p=\frac{1}{5}$. The independent sum $Z$ is binomial with $n=10$ and $p=\frac{1}{5}$. The following probabilities are also exercises for using the convolution formula.

$\displaystyle P(Z=0)=\frac{1048576}{9765625}=0.10737$

$\displaystyle P(Z=1)=\frac{2621440}{9765625}=0.26844$

$\displaystyle P(Z=2)=\frac{2949120}{9765625}=0.30199$

$\displaystyle P(Z=3)=\frac{1966080}{9765625}=0.20133$

$\displaystyle P(Z=4)=\frac{860160}{9765625}=0.08808$

$\displaystyle P(Z=5)=\frac{258048}{9765625}=0.02642$

$\displaystyle P(Z=6)=\frac{53760}{9765625}=0.00551$

$\displaystyle P(Z=7)=\frac{7680}{9765625}=0.000786$

$\displaystyle P(Z=8)=\frac{720}{9765625}=0.0000737$

$\displaystyle P(Z=9)=\frac{40}{9765625}$

$\displaystyle P(Z=10)=\frac{1}{9765625}$