Tutorials › Statistical Theory I - Probability and Distribution Theory › Expectations of Constants and Affine Functions

Expectation and LOTUS · Tutorial 313 of 994

Expectations of Constants and Affine Functions

Learn how constants and fixed linear transformations change an expectation, when the resulting expectation exists, and how to calculate it in discrete and continuous models.

Intermediate 9 min read

What You'll Learn

  • State the expectation of a constant random variable.
  • Calculate the expectation of an affine function of an integrable random variable.
  • Identify the conditions under which the transformed expectation exists.
  • Apply the identities to Bernoulli, uniform, and exponential models.
  • Avoid invalid expectation calculations when the original expectation is undefined.

Why Constants and Affine Transformations Matter

Many random quantities are reported after a change of scale or a shift. A temperature may be converted from one scale to another; a cost may include a fixed fee as well as a variable component; a score may be rescaled and then offset. These operations have the form \(aX+b\), where \(X\) is random and \(a,b\) are fixed real numbers. Knowing how expectation behaves under this transformation lets us calculate the new mean directly from the old one.

The conditions matter. The simple formula is guaranteed when \(X\) is integrable, meaning \(E[|X|]<\infty\). Without that condition, an expectation may be infinite or undefined, and algebraic manipulation can conceal an invalid cancellation. The earlier material on linearity under absolute integrability supplies the general linearity result; here we specialize it to constants and affine functions and make the existence conditions explicit.

Constants and Affine Functions

Definition: A constant random variable with value \(c\in\mathbb{R}\) is a random variable that equals \(c\) with probability one. An affine function of a random variable \(X\) is \(aX+b\), where \(a,b\in\mathbb{R}\) are fixed, nonrandom constants. The coefficient \(a\) scales \(X\), and \(b\) shifts it.

For an integrable random variable, the key identities are

$$ E[c]=c \qquad\text{and}\qquad E[aX+b]=aE[X]+b. $$

The second identity includes the special cases \(E[aX]=aE[X]\) and \(E[X+b]=E[X]+b\). The constants must be finite real numbers. They may be chosen using a model parameter, provided that for each fixed parameter value they are nonrandom constants.

Theorem: If \(X\) is integrable and \(a,b\in\mathbb{R}\), then \(aX+b\) is integrable and \(E[aX+b]=aE[X]+b\). Conversely, if \(a\ne 0\) and \(aX+b\) is integrable, then \(X\) is integrable. If \(a=0\), \(aX+b=b\) is integrable regardless of the behavior of \(X\).

Thus, for \(a\ne0\), the affine transformation has a finite expectation exactly when \(X\) does. When \(a=0\), the random part disappears altogether: the transformed variable is just the constant \(b\). In applications, it is useful to check this distinction before substituting values into the formula.

Why the Identities Hold

For a constant, the expectation is the constant itself because the total probability is one. For example, if \(X\) is discrete with mass function \(f\), then

$$ E[c]=\sum_x c f(x) =c\sum_x f(x) =c. $$

For a continuous random variable with density \(f\), the same reasoning uses the fact that the density integrates to one:

$$ E[c]=\int_{-\infty}^{\infty} c f(x)\,dx =c\int_{-\infty}^{\infty} f(x)\,dx =c. $$

More generally, expectation under a probability distribution integrates a constant against total probability one, so \(E[c]=c\) also holds for mixed distributions.

To establish the affine formula, first verify that the transformed variable is integrable. The triangle inequality gives

$$ |aX+b|\le |a|\,|X|+|b|. $$

Taking expectations of the nonnegative quantities on both sides shows

$$ E[|aX+b|]\le |a|E[|X|]+|b|<\infty, $$

so \(aX+b\) is integrable. Linearity under absolute integrability, applied to \(aX\) and the constant \(b\), now gives the formula:

$$ E[aX+b]=E[aX]+E[b]=aE[X]+b. $$

For the converse when \(a\ne0\), suppose \(aX+b\) is integrable. Rearranging gives \(X=((aX+b)-b)/a\), and therefore

$$ E[|X|] \le \frac{1}{|a|}\left(E[|aX+b|]+|b|\right)<\infty. $$

Thus \(X\) is integrable as well. If \(a=0\), the transformed variable is \(b\), whose absolute expectation is \(|b|<\infty\), without any integrability assumption on \(X\). \(\square\)

Worked Examples

Worked Example: An Affine Function of a Bernoulli Variable

Let \(X\sim\operatorname{Bernoulli}(p)\), where \(0\le p\le1\), so \(P(X=1)=p\) and \(P(X=0)=1-p\). Find the expectation of \(Y=6-4X\), first in terms of \(p\), then at \(p=0.3\).

Because \(X\) has finite support, it is integrable. Directly from its probability mass function,

$$ E[X]=0(1-p)+1(p)=p. $$

The affine identity gives

$$ E[Y]=E[6-4X]=6-4E[X]=6-4p. $$

At \(p=0.3\), this is \(E[Y]=6-4(0.3)=4.8\). Checking by summing over the two outcomes, \(Y=6\) when \(X=0\) and \(Y=2\) when \(X=1\), so \(E[Y]=6(0.7)+2(0.3)=4.2+0.6=4.8\), as required.

Worked Example: Rescaling a Uniform Variable

Suppose \(X\sim\operatorname{Uniform}(0,\theta)\), with \(\theta>0\), and define \(Y=5-2X\). Find \(E[Y]\) as a function of \(\theta\), and evaluate it at \(\theta=3\).

The density of \(X\) is \(f(x)=1/\theta\) for \(0\le x\le\theta\), and zero elsewhere. In particular, \(X\) is integrable. Its expectation is

$$ E[X]=\int_0^\theta x\frac{1}{\theta}\,dx =\frac{1}{\theta}\left[\frac{x^2}{2}\right]_0^\theta =\frac{\theta}{2}. $$

Therefore

$$ E[Y]=E[5-2X]=5-2E[X] =5-2\left(\frac{\theta}{2}\right)=5-\theta. $$

For \(\theta=3\), the result is \(E[Y]=2\). A direct calculation checks it:

$$ E[Y]=\int_0^3 (5-2x)\frac{1}{3}\,dx =\frac{1}{3}[5x-x^2]_0^3 =\frac{15-9}{3}=2. $$

The transformed variable can take negative values when \(X>2.5\); that does not prevent its expectation from existing, since \(X\) and \(Y\) are bounded here.

Worked Example: An Affine Function of an Exponential Variable

Let \(X\) have the exponential density \(f(x)=\lambda e^{-\lambda x}\) for \(x\ge0\), where \(\lambda>0\). For \(Y=2X-3\), derive \(E[Y]\) as a function of \(\lambda\), then calculate it when \(\lambda=1/4\).

First verify the mean of \(X\). Integration by parts, with \(u=x\) and \(dv=\lambda e^{-\lambda x}\,dx\), yields

$$ E[X]=\int_0^\infty x\lambda e^{-\lambda x}\,dx =\left[-xe^{-\lambda x}\right]_0^\infty +\int_0^\infty e^{-\lambda x}\,dx =\frac{1}{\lambda}. $$

The boundary term at infinity is zero because \(xe^{-\lambda x}\to0\) for \(\lambda>0\); the boundary term at zero is also zero. The remaining integral is \(1/\lambda\), which is finite, so \(X\) is integrable. Hence

$$ E[Y]=E[2X-3]=2E[X]-3=\frac{2}{\lambda}-3. $$

For \(\lambda=1/4\), \(E[X]=4\), and \(E[Y]=2(4)-3=5\). The shift by \(-3\) reduces the mean by three, while multiplying \(X\) by two doubles its mean.

Using the Formula With Model Parameters

In a parameterized model, the distribution and the affine coefficients can both depend on a parameter. Write \(X_\theta\) for a random variable whose distribution depends on \(\theta\), and suppose \(E[|X_\theta|]<\infty\) at a particular parameter value. For fixed real numbers \(a_\theta,b_\theta\) at that value,

$$ E[a_\theta X_\theta+b_\theta] =a_\theta E[X_\theta]+b_\theta. $$

This is a pointwise statement in the parameter: integrability must hold at the parameter value where the expectation is calculated. The Bernoulli example has \(E[X]=p\), so its transformed mean is \(6-4p\); the uniform example has \(E[X]=\theta/2\), giving \(5-\theta\). No assumption that the model is discrete or continuous is needed for the identity itself.

The practical value is that an affine transformation does not require a new full expectation calculation whenever the original mean is known. The formula is also a useful check on direct calculations: a disagreement often signals an error in a coefficient, a sign, or the support used in a sum or integral.

Common Mistakes and a Reliable Check

  • Forgetting that the constant is added once. The correct identity is \(E[aX+b]=aE[X]+b\), not \(aE[X]+ab\). The term \(b\) is itself a constant random variable, and its expectation is \(b\).
  • Applying the identity without checking existence. The formula is justified for integrable \(X\). If \(E[X]\) is undefined because its positive and negative parts both have infinite expectation, writing \(aE[X]+b\) is not valid algebra.
  • Treating random coefficients as fixed constants. The result stated here applies to nonrandom \(a\) and \(b\). If a coefficient is random and depends on \(X\), it cannot simply be pulled outside the expectation by this identity.
  • Assuming a zero multiplier needs an integrable input. When \(a=0\), \(aX+b=b\) for every outcome. The transformed variable is integrable even if \(X\) is not.

A reliable calculation therefore has two steps: establish that the needed expectation exists, then separate the scale and shift using \(E[aX+b]=aE[X]+b\). When a distribution is given explicitly, a direct sum or integral can be used afterward to verify the result.

Key takeaway: A finite constant has expectation equal to itself. If \(X\) is integrable and \(a,b\) are fixed real numbers, then \(aX+b\) is integrable and \(E[aX+b]=aE[X]+b\). For a nonzero scale \(a\), integrability of the transformed variable is equivalent to integrability of \(X\).

Check Your Understanding

For each question, state any integrability condition you use.

  1. If \(E[X]=4\), what is \(E[3X-7]\)?
  2. If \(X\sim\operatorname{Bernoulli}(p)\), find \(E[2+5X]\).
  3. If \(X\sim\operatorname{Uniform}(0,\theta)\) with \(\theta>0\), find \(E[1-X]\).
  4. Why does \(aX+b\) remain integrable when \(X\) is integrable?
  5. What happens to the existence question for \(aX+b\) when \(a=0\)?
  6. Why is the affine expectation identity not a license to manipulate an undefined expectation as if it were a finite number?