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
For an integrable random variable, the key identities are
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.
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
For a continuous random variable with density \(f\), the same reasoning uses the fact that the density integrates to one:
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
Taking expectations of the nonnegative quantities on both sides shows
so \(aX+b\) is integrable. Linearity under absolute integrability, applied to \(aX\) and the constant \(b\), now gives the formula:
For the converse when \(a\ne0\), suppose \(aX+b\) is integrable. Rearranging gives \(X=((aX+b)-b)/a\), and therefore
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,
The affine identity gives
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
Therefore
For \(\theta=3\), the result is \(E[Y]=2\). A direct calculation checks it:
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
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
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,
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.
Check Your Understanding
For each question, state any integrability condition you use.
- If \(E[X]=4\), what is \(E[3X-7]\)?
- If \(X\sim\operatorname{Bernoulli}(p)\), find \(E[2+5X]\).
- If \(X\sim\operatorname{Uniform}(0,\theta)\) with \(\theta>0\), find \(E[1-X]\).
- Why does \(aX+b\) remain integrable when \(X\) is integrable?
- What happens to the existence question for \(aX+b\) when \(a=0\)?
- Why is the affine expectation identity not a license to manipulate an undefined expectation as if it were a finite number?