Linear functions of a random variable

In this article, we consider linear functions of a random variable. That is, given a random variable X, we consider functions of the form Y = aX+b.

First, let us consider discrete random variables. Given a discrete random variable X, we see how the probability mass function and the cumulative distribution function of Y = aX+b are related to those of X.

As is usual, let p_X(x) and F_X(x) denote the probability mass function and the cumulative distribution function respectively of X. Then, we have:

\begin{aligned} p_Y(x) & = P\{Y = x\} \\ & = P\{aX+b = x\} \\ & = P\left\{X = \frac{x-b}{a}\right\} \\ & = p_X\left(\frac{x-b}{a}\right) \end{aligned}


Thus, the probability mass function of X is horizontally stretched by a factor a and then right-shifted by b to give the probability mass function of aX+b. Note that if a < 0, a horizontal stretch by a factor of a implies a horizontal stretch by |a| and a reflection about the Y-axis.

To determine F_Y(x), let us first consider the case of a > 0.

\begin{aligned} F_Y(x) & = P\{Y \le x\} \\ & = P\{aX+b \le x\} \\ & = P\left\{X \le \frac{x-b}{a}\right\} \\ & = F_X\left(\frac{x-b}{a}\right) \end{aligned}


Thus, when a > 0, the cumulative distribution function of X is horizontally stretched by a factor a and then right-shifted by b to give the cumulative distribution function of aX+b.

Let us now consider the case of a < 0.

\begin{aligned} F_Y(x) & = P\{Y \le x\} \\ & = P\{aX+b \le x\} \\ & = P\left\{X \ge \frac{x-b}{a}\right\} \\ & = P\left\{X = \frac{x-b}{a}\right\} + P\left\{X > \frac{x-b}{a}\right\} \\ & = p_X\left(\frac{x-b}{a}\right) + 1 - P\left\{X \le \frac{x-b}{a}\right\} \\ & = p_Y(x) + 1 - F_X\left(\frac{x-b}{a}\right) \end{aligned}



Now, let us turn to continuous random variables. Given a continuous random variable X, we see how the probability density function and the cumulative distribution function of Y = aX+b are related to those of X.

As is usual, let f_X(x) and F_X(x) denote the probability density function and the cumulative distribution function respectively of X.

For small \epsilon > 0, we know that P\{x\le X \le x+\epsilon\} \approx \epsilon f_X(x).

For the case of a > 0, we have:

\begin{aligned} \epsilon f_Y(x) & \approx P\{x \le Y \le x+\epsilon\} \\ & = P\{x \le aX+b \le x+\epsilon\} \\ & = P\left\{\frac{x-b}{a}\le X \le \frac{x+\epsilon - b}{a}\right\} \\ & = P\left\{\frac{x-b}{a}\le X \le \frac{x - b}{a}+\frac{\epsilon}{a}\right\} \\ & \approx \frac{\epsilon}{a}f_X\left(\frac{x-b}{a}\right) \end{aligned}


Thus, for a > 0, we have f_Y(x) = \frac{1}{a}f_X\left(\frac{x-b}{a}\right).

For the case of a < 0, we have:

\begin{aligned} \epsilon f_Y(x) & \approx P\{x \le Y \le x+\epsilon\} \\ & = P\{x \le aX+b \le x+\epsilon\} \\ & = P\left\{\frac{x+\epsilon-b}{a}\le X \le \frac{x - b}{a}\right\} \\ & = P\left\{\frac{x-b}{a}+\frac{\epsilon}{a}\le X \le \frac{x - b}{a}\right\} \\ & \approx -\frac{\epsilon}{a}f_X\left(\frac{x-b}{a}\right) \end{aligned}


Thus, for a < 0, we have f_Y(x) = -\frac{1}{a}f_X\left(\frac{x-b}{a}\right).

We combine the two cases of a > 0 and a < 0 and say that for any a \ne 0, f_Y(x) = \frac{1}{|a|}f_X\left(\frac{x-b}{a}\right).

Thus, the probability density function of X is horizontally stretched by a factor a, right-shifted by b and then, vertically shrunk by a factor |a| to give the probability density function of aX+b. Note that, if a < 0, a horizontal stretch by a factor of a implies a horizontal stretch by |a| and a reflection about the Y-axis.

To determine F_Y(x), we first consider the case of a > 0.

\begin{aligned} F_Y(x) & = \int\limits_{-\infty}^{x}f_Y(t)\,dt \\ & = \int\limits_{-\infty}^{x}\frac{1}{a}f_X\left(\frac{t-b}{a}\right)\,dt \\ & = \frac{1}{a}\int\limits_{-\infty}^{\frac{x-b}{a}}f_X(u)a\,du \\ & = \int\limits_{-\infty}^{\frac{x-b}{a}}f_X(u)\,du \\ & = F_X\left(\frac{x-b}{a}\right) \end{aligned}


Thus, when a > 0, the cumulative distribution function of X is horizontally stretched by a factor a and then right-shifted by b to give the cumulative distribution function of aX+b.

Now, let us consider the case of a < 0.

\begin{aligned} F_Y(x) & = \int\limits_{-\infty}^{x}f_Y(t)\,dt \\ & = \int\limits_{-\infty}^{x}-\frac{1}{a}f_X\left(\frac{t-b}{a}\right)\,dt \\ & = -\frac{1}{a}\int\limits_{\infty}^{\frac{x-b}{a}}f_X(u)a\,du \\ & = \int\limits_{\frac{x-b}{a}}^{\infty}f_X(u)\,du \\ & = 1 - \int\limits^{\frac{x-b}{a}}_{-\infty}f_X(u)\,du \\ & = 1 - F_X\left(\frac{x-b}{a}\right) \end{aligned}
Scroll to top