# Distribution function of $1/X$ when $X$ is uniform on $[-1,1]$

(from The Probability Tutoring Book, C. Ash, p. 157)

Find the density of $$Y$$ if $$Y = 1/X$$ and $$X$$ is uniform on $$[-1,1]$$.

The distribution function given in the answer key is

$$F(y) = \begin{cases} \frac{-1}{2y} & \text{if }y \leq -1\\ \frac{1}{2} & \text{ if }-1 \leq y \leq 1\\ 1-\frac{1}{2y} & \text{if } y \geq 1 \end{cases}$$

My question is why the first and last cases aren't $$0$$ and $$1$$. Doesn't $$Y$$ only range over $$[-1, 0)$$ and $$(0, 1]$$?

• No, when $X \approx 0,$ you have extreme positive and negative values of $Y.$ Commented Apr 18, 2020 at 23:17
• Yes, I will adjust my question. I'm really trying to understand the equations for y <= -1 and y >= 1 Commented Apr 18, 2020 at 23:23
• Maybe start with $F_Y(y) = P(Y \le y) = P(1/X \le y) = \cdots,$ for $y$ in each of the three intervals. Commented Apr 18, 2020 at 23:31
• Similar to stats.stackexchange.com/q/450921/119261 since the distribution of $X$ is symmetric about zero. To derive the pdf from the cdf, it suffices to find the cdf for $y>0$ as the distribution of $1/X$ will also be symmetric about zero. Commented Apr 19, 2020 at 18:22

I hope a quick simulation in R will help you visualize this transformation. For readable graphs, I use only transformed values in $$(-10,10).$$

set.seed(2020)
x = runif(10^5, -1,1)
y = 1/x
Y = y[abs(y) < 10]  # plotted values
length(y)
[1] 100000
length(Y)
[1] 89815
par(mfrow=c(1,2))
hist(Y, prob=T, col="skyblue2")
plot(ecdf(Y))
par(mfrow=c(1,1))


Note: The ECDF of a sample plots values of the sample from smallest to largest. It is a stairstep function (with jumps too small to see here). At each value of a sample of size $$n$$ the ECDF jumps up by $$1/n.$$ If there are $$K$$ values tied at a point, then the function jumps by $$k/n$$ at that point. (No ties here) For a sufficiently large sample the ECDF closely imitates the population CDF.

Observe that $$-1\le x\le 1\implies |x|\le 1\implies \frac1{|x|}\ge 1$$, so support of $$|Y|$$ is $$[1,\infty)$$.

In other words, support of $$Y$$ is $$(-\infty,-1]\cup [1,\infty)$$.

For any continuous random variable $$X$$, distribution function of $$Y=\frac1X$$ is

\begin{align} P(Y\le y)&=P\left(\frac1X\le y,X<0\right)+P\left(\frac1X\le y,X>0\right) \\&=\begin{cases} P\left(\frac1y\le X<0\right) &,\text{ if }y<0 \\ P(X<0)+ P\left(X\ge \frac1y\right) &,\text{ if }y>0\end{cases} \end{align}

That is,

$$P(Y\le y)=\begin{cases} P(X<0)-P\left(X\le \frac1y\right) &,\text{ if }y<0 \\ 1 + P(X<0)-P\left(X < \frac1y\right) &,\text{ if }y>0\end{cases}$$

As $$P\left(\frac1X\le y\right)=P(X\in A)$$ where $$A=\left\{x: \frac1x \le y\right\}$$, drawing a picture of the region $$A$$ might help in verifying the calculation.

Now if you carefully find $$P\left(X \le \frac1y\right)$$ from the distribution function of $$X$$, you will end up with the answer in your post.

Alternatively, you can find the density of $$Y$$ directly from the change of variables $$y=\frac1x$$:

$$f_Y(y)=f_X\left(\frac1y\right)\left|\frac{\mathrm dx}{\mathrm dy}\right|$$