# Probability distribution of $aX + b$, where a and b are integers and $X$ is a uniform variable

My textbook has the following introductory example about functions of random variables:

Suppose that $X$ is a random continuous variable with a uniform distribution over the interval $(0,1)$. Determine the distribution of $Y = aX + b$, where $a$ and $b$ are non-zero integers.

The solution provided in the textbook comes with no explanation and it differs from what I ended up with. What's the correct way to solve this problem?

• Please read the self-study tag and its wiki and edit your question to include information about what you have tried, your thought process, and where you are stuck. – Sycorax Jul 30 '15 at 14:49
• I wanted to post every step I did but I can't format the text well and it looks ugly and unreadable. – hjk20 Jul 30 '15 at 14:52
• A tutorial on math formatting can be found here: meta.math.stackexchange.com/questions/5020/… – Sycorax Jul 30 '15 at 15:19
• In accordance with the self-study guidelines, please show your attempt. If it's ugly but understandable, someone will probably help format it for you but I strongly encourage you to read user777's link above. – Glen_b Jul 30 '15 at 21:38
• You might benefit from considering direct calculation - start with $F_Y(y)=P(Y\leq y)$, substituting $aX+b$ for $Y$ and simplifying to get an expression for $F_Y(y)$ in terms of $F_X$, then obtaining $f_Y$ from the resulting expression for $F_Y$. – Glen_b Jul 30 '15 at 22:01

For $t \in (b, a + b)$ and $a > 0$ we have \begin{align} P(aX + b \leq t) &= P \left ( X \leq \frac{t - b}{a} \right ) \\ &= \frac{t - b}{a} . \end{align} When $a < 0$ \begin{align} P(aX + b \leq t) &= P \left ( X \geq\frac{t - b}{a} \right ) \\ &= 1 - P \left ( X < \frac{t - b}{a} \right ) \\ &= 1 - \frac{t - b}{a} \end{align} which is a uniform distribution function in either case.

• The assertion that $\displaystyle P(aX + b \leq t) = P \left ( X \leq \frac{t - b}{a} \right )$ is incorrect when $a < 0$. – Dilip Sarwate Jul 30 '15 at 15:43
• The opening sentence is correct when $a > 0$ but not when $a < 0$. – Dilip Sarwate Jul 30 '15 at 16:29
• If we're being pedantic then pretend the numbers are in the other order. The interpretation of something like $(0, -1)$ should be obvious. – dsaxton Jul 30 '15 at 16:38
• You are writing an answer for the benefit of someone who is having difficulty understanding what is alleged to be a solved example in a book that provides little explanation of the solution. I fail to see how your answer is any improvement. – Dilip Sarwate Jul 30 '15 at 16:47
• I don't understand how you calculated the probability at all. Doesn't the uniform distribution state that for $X$ in $(a,b)$ $P(X <= x) = (x-a)/(b-a)$ ? – hjk20 Jul 31 '15 at 10:32

Alternatively, you can do this via change of variables.

First, find the inverse mapping of $g(X)=aX+b$, $g^{-1}(Y)=(Y-b)/a$.

The density of $Y$ is, in general, given by $$f_Y(x)=f_X(g^{-1}(x))|g^{-1'}(x)|$$ Now, $g^{-1'}(x)=1/|a|$. As $f_X\equiv1$, we obtain $$f_Y(x)=1/|a|,$$ a uniform density (on $[a,b]$).

Upon taking the derivative in the answer of @dsaxton, we see that the solutions agree.