Let $X\sim U([1,2])$ and $Y=\frac{1}{X}$
How do I calculate the mean of Y?
I know that
$$f(x)=\begin{cases}1 & \text{ if } 1\leq x\leq 2 \\ 0& \text{ otherwise } \end{cases}$$
Does that mean that
$$f(y)=\begin{cases}1 & \text{ if } 1\leq \frac{1}{y}\leq 2 \Leftrightarrow \frac{1}{2}\leq y\leq 1\\ 0& \text{ otherwise } \end{cases}$$
if so then the mean value should be:
$$\int_{1/2}^{1}y=\int_{1/2}^{1}\frac{1}{x} dx$$
Is this correct?
Use the transformation formula
$$p(Y)=p(X)\left|\frac{dX}{dY}\right|=\frac{1}{Y^2}$$ where $Y \in [\frac{1}{2},1]$
So $$E[Y]=\int_{1/2}^1 Y\frac{1}{Y^2}dY=\int_{1/2}^1\frac{1}{Y}dY=\ln1-\ln\frac{1}{2}=\ln 2$$