Tutorials › Statistical Theory I - Probability and Distribution Theory › Adding a Discrete Variable to a Continuous Variable

Joint Laws of Independent Variables · Tutorial 287 of 994

Adding a Discrete Variable to a Continuous Variable

Learn how each possible discrete shift contributes a weighted copy of the continuous density, and how to justify the resulting density formula.

Intermediate 10 min read

What You'll Learn

  • State the density formula for the sum of independent discrete and continuous random variables.
  • Derive the formula for finite and countable discrete supports.
  • Compute densities when the discrete variable has two or three possible values.
  • Work with an infinite mixture of shifted exponential densities.
  • Distinguish the union of shifted supports from its closure.
  • Recognize why independence and correct mixture weights matter.

Why a Discrete Shift Produces a Mixture

Suppose a continuous measurement is subject to an additional random shift that can take only discrete values. The total is not generally described by one shifted copy of the continuous density: different shifts contribute different copies, each weighted by the probability of that shift. The result is a mixture of shifted densities.

This situation occurs, for example, when a continuous measurement is combined with a random number of whole-unit delays, or when a continuous error is added to a discrete offset. The central calculation is simple to state, but its conditions matter: the two variables must be independent, and for infinitely many possible shifts the sum in the formula must be understood as a nonnegative series.

Definition: Let \(X\) be a continuous random variable with density \(f_X\), and let \(Y\) be an independent discrete random variable with distinct possible values \(y_j\), indexed by a finite or countable set \(J\). Write \(p_j=P(Y=y_j)\), where \(p_j>0\) and \(\sum_{j\in J}p_j=1\). For \(S=X+Y\), a density is $$ f_S(s)=\sum_{j\in J}p_j f_X(s-y_j) $$ for almost every \(s\). The sum is a finite sum when \(J\) is finite and a series of nonnegative terms when \(J\) is countable.

The term \(f_X(s-y_j)\) is the density of \(X+y_j\), the continuous variable translated by \(y_j\). Its coefficient \(p_j\) is the probability that this shift occurs. Thus the formula adds the shifted densities, not the shifted distribution functions or the shift values themselves. As with any density, values on a set of Lebesgue measure zero do not affect the distribution.

Deriving the Density Formula

A direct derivation works for both finite and countable support and avoids assuming that an infinite sum can be differentiated term by term. Let \(B\) be any Borel subset of the real line. The events \(Y=y_j\) partition the sample space, so countable additivity and independence give

$$ \begin{aligned} P(S\in B) &=\sum_{j\in J}P(X+Y\in B,\ Y=y_j)\\ &=\sum_{j\in J}p_j P(X+y_j\in B)\\ &=\sum_{j\in J}p_j\int_{\mathbb R}\mathbf{1}_B(x+y_j)f_X(x)\,dx. \end{aligned} $$

For each \(j\), use the translation \(s=x+y_j\), so \(x=s-y_j\) and \(dx=ds\). Since every summand is nonnegative, Tonelli's theorem permits exchanging the countable sum and the integral:

$$ P(S\in B) =\int_B\sum_{j\in J}p_j f_X(s-y_j)\,ds. $$

The function in the integrand is measurable and nonnegative. Its integral over the real line is

$$ \int_{\mathbb R}\sum_{j\in J}p_j f_X(s-y_j)\,ds =\sum_{j\in J}p_j\int_{\mathbb R}f_X(s-y_j)\,ds =\sum_{j\in J}p_j=1. $$

Therefore it is a probability density for \(S\). In the countable case, the series can be infinite at exceptional points, but its integral is one, so it is finite almost everywhere. Changing its values on any null set where it is infinite gives an ordinary finite-valued version of the density. This proves the mixture formula without an unjustified exchange of differentiation and an infinite sum. \(\square\)

Theorem: Under the conditions in the definition, the distribution function of \(S=X+Y\) is $$ F_S(t)=\sum_{j\in J}p_j F_X(t-y_j), $$ where \(F_X\) is the distribution function of \(X\). The series converges for every \(t\), since its terms are nonnegative and bounded above by \(p_j\).

To verify the formula, partition the event \(\{X+Y\le t\}\) according to the value of \(Y\). Independence yields

$$ \begin{aligned} F_S(t) &=\sum_{j\in J}P(X+y_j\le t,\ Y=y_j)\\ &=\sum_{j\in J}p_jP(X\le t-y_j)\\ &=\sum_{j\in J}p_jF_X(t-y_j). \end{aligned} $$

The series is well-defined because \(0\le p_jF_X(t-y_j)\le p_j\), and the probabilities \(p_j\) sum to one. This gives a second useful description of the same mixture. The density formula above is the density version of this distribution-function identity; it does not require differentiating the series term by term. \(\square\)

Worked Examples

Worked Example: A Three-Point Shift of a Normal Variable

Let \(X\sim N(0,1)\), and independently let \(Y\) take the values \(-1,0,2\) with probabilities \(0.2,0.5,0.3\), respectively. Find the density of \(S=X+Y\), and evaluate it at zero.

The standard normal density is \(\phi(x)=(2\pi)^{-1/2}e^{-x^2/2}\). Applying the mixture formula gives

$$ f_S(s)=0.2\phi(s+1)+0.5\phi(s)+0.3\phi(s-2). $$

At \(s=0\), the three terms use \(\phi(1)\), \(\phi(0)\), and \(\phi(-2)=\phi(2)\):

$$ \begin{aligned} f_S(0) &=0.2\phi(1)+0.5\phi(0)+0.3\phi(2)\\ &\approx 0.2(0.241970725)+0.5(0.398942280)+0.3(0.053990967)\\ &\approx 0.048394145+0.199471140+0.016197290\\ &\approx 0.264062575 \approx 0.264063. \end{aligned} $$

Each component is a normal density translated by its corresponding possible value of \(Y\). The mixture need not itself be a single normal density.

Worked Example: A Uniform Variable With Two Overlapping Shifts

Let \(X\sim\operatorname{Uniform}(0,1)\), independently of \(Y\), where \(P(Y=0)=0.6\) and \(P(Y=0.5)=0.4\). Find the density of \(S=X+Y\).

A density of \(X\) is \(f_X(x)=1\) for \(0<x<1\) and zero outside that interval. Therefore

$$ f_S(s)=0.6\mathbf{1}_{(0,1)}(s)+0.4\mathbf{1}_{(0.5,1.5)}(s). $$

On \(0<s<0.5\), only the first shifted density contributes, so \(f_S(s)=0.6\). On \(0.5<s<1\), both contribute, so \(f_S(s)=0.6+0.4=1\). On \(1<s<1.5\), only the second contributes, so \(f_S(s)=0.4\). Outside \((0,1.5)\), the density is zero. Values at the interval endpoints can be assigned arbitrarily without changing the distribution.

As a normalization check, the total area is

$$ (0.5)(0.6)+(0.5)(1)+(0.5)(0.4)=0.3+0.5+0.2=1. $$

The overlap is important: where the shifted intervals overlap, their density heights add.

Worked Example: A Poisson Shift of an Exponential Variable

Let \(X\sim\operatorname{Exponential}(2)\), with density \(f_X(x)=2e^{-2x}\) for \(x>0\) and zero otherwise. Independently, let \(Y\sim\operatorname{Poisson}(1)\), so \(P(Y=k)=e^{-1}/k!\) for integers \(k\ge0\). Find the density as a series and evaluate it at \(s=1.5\).

For a fixed \(k\), the shifted density is \(2e^{-2(s-k)}\) when \(s>k\), and zero otherwise. Hence

$$ f_S(s)=\sum_{k=0}^{\infty}\frac{e^{-1}}{k!}\,2e^{-2(s-k)}\mathbf{1}_{\{s>k\}}. $$

At \(s=1.5\), only \(k=0\) and \(k=1\) contribute. The \(k=0\) term is \(e^{-1}\,2e^{-3}=2e^{-4}\), and the \(k=1\) term is \(e^{-1}\,2e^{-1}=2e^{-2}\). Thus

$$ f_S(1.5)=2e^{-4}+2e^{-2}\approx 0.036631+0.270671=0.307302. $$

Although \(Y\) has infinitely many possible values, at any fixed \(s\) only finitely many terms are nonzero here, because \(X\) is positive and a shift \(k\) cannot contribute when \(k\ge s\).

Support and Interpretation

For a possible shift \(y_j\), the corresponding component is a translated copy of the law of \(X\). If \(\operatorname{supp}(X)\) denotes the topological support of \(X\), then the support of \(S\) is contained in the closure of

$$ \bigcup_{j\in J:\,p_j>0}\bigl(y_j+\operatorname{supp}(X)\bigr). $$

For finitely many shifts, this union is already closed, so the closure is unnecessary. For countably many shifts, limit points can belong to the support even when they are not in the union itself. For example, if \(X\sim\operatorname{Uniform}(0,1)\) and \(Y\) assigns positive probability to every value \(1-1/n\) for \(n\ge2\), then the shifted supports are \([1-1/n,2-1/n]\). Their union does not contain \(2\), but every neighborhood of \(2\) has positive probability under \(X+Y\), so \(2\) is in its support.

The mixture representation is useful because it turns a mixed sum into a weighted collection of familiar continuous densities. It also makes the role of the discrete probabilities transparent: a shift with greater probability contributes more density, while a shift with probability zero contributes nothing.

Common Mistakes

  • Using the wrong direction of shift. The density contribution for \(X+y_j\) at \(s\) is \(f_X(s-y_j)\), not \(f_X(y_j-s)\). The subtraction follows by solving \(s=x+y_j\) for \(x\).
  • Adding shifted densities without weights. Each contribution must be multiplied by \(P(Y=y_j)\); otherwise the result generally does not integrate to one.
  • Assuming the topological support is just the union of shifted supports. For countably many shifts, include the closure because limit points can also be in the support.
  • Using the formula without independence. The step that factors a joint probability into \(p_jP(X+y_j\in B)\) depends on independence. Without it, the mixture weights and component laws need not have this form.
Key takeaway: For independent \(X\) with density \(f_X\) and discrete \(Y\) with probabilities \(p_j\) at values \(y_j\), the sum has density \(f_{X+Y}(s)=\sum_j p_j f_X(s-y_j)\) almost everywhere. Each possible discrete value contributes one probability-weighted shift of the continuous density.

Check Your Understanding

Use the mixture formula and its conditions to answer the following.

  1. If \(X\) has density \(f_X\) and \(Y\) independently takes values \(0\) and \(3\) with probabilities \(0.7\) and \(0.3\), write the density of \(X+Y\).
  2. Why is the contribution from a shift \(y_j\) evaluated using \(f_X(s-y_j)\)?
  3. For the uniform-and-two-shift example, what is the density on \(0.7<s<0.9\), and why?
  4. In the Poisson-and-exponential example, which terms contribute to \(f_S(2.4)\)?
  5. Why can the support of a countable mixture contain a point not in the union of its shifted component supports?