# Distribution of X+U when X is a discrete and U is a continous random variable

Suppose $$X$$ and $$U$$ are independent random variables. $$X$$ is a discrete uniform variable and $$U$$ is a continuous uniform $$[0,1]$$ variable. What is the value of $$\mathbb P(X+U\leq y)$$, where $$y$$ is a real number?

• Draw a picture of the density of $X+U.$ It's particularly easy to describe when $X$ is supported on an integral lattice, for then the area under this density is the collection of rectangles $[n,n+1]\times [0,\Pr(X=n)].$ – whuber Jun 22 '20 at 18:10
• Consider $X=i$; what's the conditional distribution of $X+U$? From there the marginal distribution should be immediately obvious (but a corresponding formal argument is straightforward). – Glen_b Jun 27 '20 at 5:08
• For $X$ with finite support, this is a special case of the question asked and answered at stats.stackexchange.com/questions/470546. To see that, write $X+U = (X+1/2)+(U-1/2)$ explicitly as the sum of the discrete variable $X$ and the symmetric continuous variable $U-1/2.$ The solution doesn't change when $X$ has infinite support. – whuber Jun 27 '20 at 19:07

The question can be solved without the recourse to Dirac masses and distributions (à la Laurent Schwartz). Starting with $$\mathbb P(X+U\leq y)$$, when assuming $$X$$ is uniform over the set $$\{x_1,\ldots,x_m\}$$, conditioning by $$X$$ does produce the result: \begin{align*} \mathbb P(X+U\leq y) &= \mathbb E^{X,U}[\mathbb I_{X+U\leq y}]\\ &= \mathbb E^{X}[\mathbb E^{U|X}\{\mathbb I_{X+U\leq y}|X\}]\\ &= \mathbb E^{X}[\max\{0,\min(1,y-X)\}]\\ &= \sum_{i=1}^m \frac{1}{m} \max\{0,\min(1,y-x_i)\}\\ &= \sum_{i;\,x_i\le y} \frac{1}{m} \min(1,y-x_i)\\ &= \sum_{i;\,y-1

• Does the E denote expectation? I do not understand it. Maybe I am unfamiliar with the concept. – Nisha Jun 26 '20 at 15:55

Here is an alternative (possibly simpler) expression for the result. Following Xi'an by taking $$\{ x_1,...,x_m \}$$ to be the support of $$X$$, we have:

\begin{align} \mathbb{P}(X+U \leqslant y) &= \sum_{i=1}^m \mathbb{P}(X+U \leqslant y | X = x_i) \cdot \mathbb{P}(X = x_i) \\[6pt] &= \sum_{i=1}^m \mathbb{P}(U \leqslant y-x_i) \cdot \mathbb{P}(X = x_i) \\[6pt] &= \sum_{i=1}^m F_U(y-x_i) \cdot p_X(x_i) \\[6pt] &= \frac{1}{m} \sum_{i=1}^m \min(1, y-x_i) \cdot \mathbb{I}(x_i \leqslant y). \\[6pt] \end{align}

We can program this function in R as follows:

PROB <- function(y, xsupp) {
xsupp <- unique(xsupp);
T1 <- pmin(1, y-xsupp);
T2 <- (xsupp <= y);
sum(T1*T2)/length(xsupp); }


Here is an example:

PROB(y = 1.3, xsupp = c(0.1, 0.3, 0.5, 0.9, 1.1, 2));
[1] 0.5666667


If you are accustomed with distributions, aka "generalized functions", you can easily unify the description of discrete and continuous random varaibles (RV), because the probability density of a discrete RV merely is a distribution. Let $$a_1,\ldots,a_k$$ be the possible values of the discrete RV with probabilities $$P(a_1),\ldots,P(a_k)$$. Then the probability density of this RV is $$g(x) = \sum_{i=1}^k P(a_i)\cdot \delta(x-a_i)$$ where $$\delta$$ denotes Dirac's delta distribution.

The probability density of the sum of two independent RVs with densities $$g$$ and $$f$$ is the convolution $$h=g*f$$ of their densities. If $$f$$ denotes the density of your continuous RV, the convolution yields $$\begin{eqnarray*} h(y) & = & \int_{-\infty}^\infty g(x)\cdot f(y-x)\,dx \\ & = & \sum_{i=1}^k P(a_i) \int_{-\infty}^\infty \delta(x-a_i)\cdot f(y-x)\, dx \\ & = & \sum_{i=1}^k P(a_i)\cdot f(y-a_i) \end{eqnarray*}$$ Addendum: If you are unfamiliar with the delta distribution, it is sufficient in this context to know its defining property: $$\int_{-\infty}^\infty \delta(x)\, f(x)\, dx = f(0)$$ for every sufficiently smooth "test function" $$f$$. Distributions are a much more powerful tool than merely for assigning a density function to discrete random vaiables. To this end, the Stieltjes integral is sufficient, albeit a much more restricted concept. But physicists and engineers have to learn distributions anyway, so it seems natural to use them here, too. The advantage is that you can formally use the familiar notation of integrals.

• I do not understand th euse of dirac delta distribution, it is very unfamiliar. – Nisha Jun 26 '20 at 15:54
• Formally, this is the same as the method by Xi'an, albeit with a (I thouught so) more familiar notation. Think of the delta distribution as a probability density with the "mass" all contrated at x=0. I have added a an explanation in the answer. – cdalitz Jun 27 '20 at 6:18