Tutorials › Statistical Theory I - Probability and Distribution Theory › Affine Transformations of Uniform Variables

Uniform, Beta, and Gamma Laws · Tutorial 151 of 994

Affine Transformations of Uniform Variables

Learn how shifting and scaling a uniform variable changes its support and density, and why a negative scale factor reverses the endpoint order.

Beginner 9 min read

What You'll Learn

  • Derive the support of an affine transformation of a uniform variable.
  • Find its CDF when the scale factor is positive or negative.
  • Obtain the transformed density using the change-of-variables formula.
  • Handle the zero-scale case as a degenerate distribution.
  • Calculate probabilities after shifting and rescaling uniform variables.
  • Recognize and correct common sign and support errors.

Why Affine Transformations Matter

Uniform distributions model outcomes that are equally likely across an interval. In applications, however, a quantity may be recorded in a different unit or shifted to a new origin. If \(X\) is uniform on an interval and \(Y=c+dX\), the transformation shifts and rescales the interval. When \(d\) is negative, it also reverses the order of values. Getting the transformed support and density right requires accounting for that reversal.

Assume throughout that \(X\sim\operatorname{Uniform}(a,b)\), where \(a<b\), and that \(c,d\) are fixed real constants. The density of \(X\) is \(1/(b-a)\) on \([a,b]\) and zero outside it; endpoint values of a density do not affect probabilities.

Definition: An affine transformation of \(X\) is \(Y=c+dX\), where \(c\) is a fixed shift and \(d\) is a fixed scale factor. For \(d\ne0\), \(Y\) is uniform on the interval with endpoints \(c+da\) and \(c+db\). Its support is \([\,\min(c+da,c+db),\ \max(c+da,c+db)\,]\).

Support and Distribution When \(d\ne0\)

The transformed endpoints are found by applying \(x\mapsto c+dx\) to \(a\) and \(b\). If \(d>0\), this map preserves order, so \(c+da<c+db\). If \(d<0\), it reverses order, so \(c+db<c+da\). In either case, the interval width is \(|d|(b-a)\).

The following result gives both the CDF and density. It is useful to state the cases explicitly: the negative-\(d\) CDF comes from reversing the inequality when solving for \(X\).

Theorem: Let \(X\sim\operatorname{Uniform}(a,b)\), \(a<b\), and \(Y=c+dX\), with \(d\ne0\). If \(d>0\), the support is \([c+da,c+db]\), and \[ F_Y(y)= \begin{cases} 0, & y<c+da,\\ \dfrac{y-(c+da)}{d(b-a)}, & c+da\le y\le c+db,\\ 1, & y>c+db. \end{cases} \] If \(d<0\), the support is \([c+db,c+da]\), and \[ F_Y(y)= \begin{cases} 0, & y<c+db,\\ \dfrac{y-(c+db)}{|d|(b-a)}, & c+db\le y\le c+da,\\ 1, & y>c+da. \end{cases} \] In both cases, a density is \[ f_Y(y)= \begin{cases} \dfrac{1}{|d|(b-a)}, & \min(c+da,c+db)<y<\max(c+da,c+db),\\ 0, & \text{otherwise}. \end{cases} \] The density may also be assigned the same constant value at either endpoint without changing the distribution.

Proof. By definition, \(F_Y(y)=P(Y\le y)\). First suppose \(d>0\). Then \(c+dX\le y\) is equivalent to \(X\le (y-c)/d\). For \(c+da\le y\le c+db\), the threshold \((y-c)/d\) lies in \([a,b]\). The uniform CDF of \(X\) therefore gives

$$ F_Y(y) =P\left(X\le\frac{y-c}{d}\right) =\frac{(y-c)/d-a}{b-a} =\frac{y-(c+da)}{d(b-a)}. $$

Below this interval the event has probability zero, and above it the event has probability one. This proves the stated CDF for \(d>0\).

Now suppose \(d<0\). Dividing the inequality \(c+dX\le y\) by \(d\) reverses its direction, so it is equivalent to \(X\ge (y-c)/d\). For \(c+db\le y\le c+da\), this threshold lies in \([a,b]\). Since \(X\) is continuous, the probability of equality at the threshold is zero, and

$$ F_Y(y) =P\left(X\ge\frac{y-c}{d}\right) =\frac{b-(y-c)/d}{b-a} =\frac{y-(c+db)}{|d|(b-a)}. $$

The final equality uses \(d=-|d|\). Below the transformed interval the event is impossible; above it the event is certain. Thus the CDF has the stated negative-\(d\) form. In either case, the CDF increases linearly across an interval of width \(|d|(b-a)\), with slope \(1/(|d|(b-a))\). Differentiating on the interval's interior gives the stated density. It integrates to one because its height times the interval width is \(\{1/(|d|(b-a))\}|d|(b-a)=1\). The CDF is continuous at both endpoints, so there are no endpoint point masses. \(\square\)

Worked Transformations

Worked Example: A Positive Rescaling and Shift

Let \(X\sim\operatorname{Uniform}(2,8)\), and define \(Y=3+2X\). Find its support, density, CDF, and \(P(9\le Y\le15)\).

Since \(d=2>0\), the endpoints remain in order: \(3+2(2)=7\) and \(3+2(8)=19\). Thus \(Y\) has support \([7,19]\), of width \(12\), and its density is \(1/12\) on that interval and zero outside.

For \(7\le y\le19\), the CDF is \[ F_Y(y)=\frac{y-7}{12}. \] It is zero below 7 and one above 19. The probability requested is

$$ P(9\le Y\le15) =F_Y(15)-F_Y(9) =\frac{15-7}{12}-\frac{9-7}{12} =\frac{8-2}{12} =\frac12. $$

As a check using \(X\), the event \(9\le3+2X\le15\) is equivalent to \(3\le X\le6\). Its probability is \((6-3)/(8-2)=3/6=1/2\), matching the result.

Worked Example: A Negative Scale Factor

Let \(X\sim\operatorname{Uniform}(1,5)\), and set \(Y=10-3X\). Find the support and CDF, and calculate \(P(-2\le Y\le4)\).

Here \(d=-3\), so the transformed endpoints appear in reverse order: \(10-3(5)=-5\) and \(10-3(1)=7\). The support is \([-5,7]\), with width \(12\), and the density is \(1/12\) on its interior.

For \(-5\le y\le7\), the CDF is

$$ F_Y(y) =\frac{y-(-5)}{12} =\frac{y+5}{12}. $$

It is zero for \(y<-5\) and one for \(y>7\). In particular, \(F_Y(-5)=0\) and \(F_Y(7)=1\), as a CDF must be. Therefore,

$$ P(-2\le Y\le4) =F_Y(4)-F_Y(-2) =\frac{4+5}{12}-\frac{-2+5}{12} =\frac{9-3}{12} =\frac12. $$

To check by transforming the event, \(-2\le10-3X\le4\). Subtracting 10 gives \(-12\le-3X\le-6\); dividing by \(-3\) reverses both inequality directions, giving \(2\le X\le4\). Its probability is \((4-2)/(5-1)=2/4=1/2\).

Worked Example: Shifting and Shrinking an Interval

Suppose \(X\sim\operatorname{Uniform}(-2,4)\), and define \(Y=5-\tfrac12 X\). Find the support and density, then calculate \(P(3.5<Y\le5)\).

The scale factor is negative. The endpoint images are \(5-\tfrac12(-2)=6\) and \(5-\tfrac12(4)=3\), so the support is \([3,6]\), of width \(3\). The density is therefore \(1/3\) on \((3,6)\) and zero outside. For \(3\le y\le6\), its CDF is \(F_Y(y)=(y-3)/3\).

Because \(Y\) has a continuous distribution, including or excluding a single endpoint does not change the probability. Thus

$$ P(3.5<Y\le5) =F_Y(5)-F_Y(3.5) =\frac{5-3}{3}-\frac{3.5-3}{3} =\frac{2-0.5}{3} =\frac12. $$

The event can also be checked on the original scale. The inequality \(3.5<5-\tfrac12X\le5\) is equivalent to \(0\le X<3\): the first inequality gives \(X<3\), and the second gives \(X\ge0\). Hence its probability is \((3-0)/(4-(-2))=3/6=1/2\).

The Zero-Scale Case and a Common Pitfall

If \(d=0\), then \(Y=c\) with probability one, regardless of the distribution of \(X\). This is a point mass at \(c\), not a continuous uniform distribution on an interval of positive width. Its CDF is zero for \(y<c\) and one for \(y\ge c\); it has no density with respect to ordinary length on the real line.

A common mistake is to transform the endpoints and then use them in their original order even when \(d<0\). For example, with \(Y=10-3X\) and \(X\) uniform on \([1,5]\), the image of \(a=1\) is 7 and the image of \(b=5\) is \(-5\). Using 7 as the lower endpoint would produce a decreasing CDF across the interval, which is impossible: if \(y_1\le y_2\), then \(\{Y\le y_1\}\subseteq\{Y\le y_2\}\), so \(F_Y(y_1)\le F_Y(y_2)\). The correction is to sort the two image endpoints and, for the CDF, use \((y-\text{lower endpoint})/(\text{interval width})\) within the support.

The absolute value in the density is another essential safeguard. The density height is the reciprocal of the transformed interval's width, \(|d|(b-a)\), so it must be positive for either sign of \(d\). The total probability is then the height times that width, equal to one.

Key takeaway: For \(d\ne0\), an affine transformation preserves uniformity. Its support has endpoints \(c+da\) and \(c+db\), sorted into increasing order, and its density is the reciprocal of \(|d|(b-a)\) on that interval. A negative scale factor reverses the order; a zero scale factor produces a point mass.

Check Your Understanding

Work through these questions, paying particular attention to endpoint order when the scale factor is negative.

  1. If \(X\sim\operatorname{Uniform}(0,6)\) and \(Y=2+3X\), what is the support and density of \(Y\)?
  2. If \(X\sim\operatorname{Uniform}(2,7)\) and \(Y=9-2X\), state the support and write the CDF on that support.
  3. For \(X\sim\operatorname{Uniform}(-1,3)\) and \(Y=4-\tfrac12X\), calculate \(P(3\le Y\le4)\).
  4. Why is the transformed density proportional to \(1/|d|\), rather than \(1/d\), when \(d\ne0\)?
  5. What is the distribution of \(c+0X\), and why can it not have a density that is constant on an interval of positive width?