0
$\begingroup$

Suppose $1\le x \le k, 1\le y \le k$, and we need to find a explicit formula for the the number of integers solution for the equation such that $x+y=z$ where $z \in\{2,...,2k\}$


I'm doing this because I am trying to find the probability mass function of the distribution $Z=X+Y$ where $X$ and $Y$ are two discrete uniform distribution random variables on $\{1,...,k\}$.

And while I was trying to find the pmf of $Z$, it occured to me that $f_Z(z) = \dfrac{\text{ The number of solutions for the linear Diophantine equation above}}{k^2}$

Am I overthinking this? Or am I approaching the problem in a wrong way?

  • 0
    @joriki Yes, it was a typo.Thanks for pointing it out2011-11-18

1 Answers 1

2

Note that $1 \leq x \leq z$.

Case 1: $2 \leq z \leq k+1$. Then any $1 \leq x \leq z-1 $ together with $ y= z-x$ works. Note that in this case $1 \leq y \leq k+1-1$, is in the right range.. In this case there are $z-1$ solutions.

Case 2: $k+1 < z$. Since $k+1< z =x+y \leq x+k$ we need $x >1$. Actually $z \leq x+k$ gives us the right lower bound:

$x \geq z-k \,.$

Now for each $z-k \leq x \leq k$ we can set $y=z-x$. $y $ is in the right range, since $z-k \leq x$ means $y \leq k$, while $x+1 \leq k+1 < z$ means $y \geq 1$.

In this case there are $k-(z-k)+1=2k-z+1$ solutions.

  • 0
    You are right. I might have been overthinking this problem.2011-11-19