# Expected value of a transformation

A simple question.

If $Y=\frac{1}{X}$ and I know $f_X(x)$, is it true that $E(Y) = E(1/X) = \int_{-\infty}^\infty \frac{1}{x}f_X(x) dx$?

Yes. In general if $X\sim f(x)$ then for a function $g(x)$ you have $E(g(X)) = \int g(x)f(x)dx$. You can verify this for simple cases by deriving the distribution of the transformed variable. The completely general result takes some more advanced math which you can probably safely avoid :)
• @mark999 I don't think so; $f$ is continuous from his notation so $Pr(X=0)=0$. If the integral diverges then the expectation is still well defined, it's just infinite. Depends on what troubles you :) – JMS May 16 '11 at 23:54
• I'm not sure I understand. What if $X$ was uniform on (-1,1)? – mark999 Jun 21 '11 at 7:52
• @mark999 That's true; I guess I shot that comment off too quickly. In your example $E(1/X)$ doesn't exist since the integrals $\int_0^{1} 0.5/x\ dx$ and $\int_{-1}^{0} 0.5/x\ dx$ are $\pm \infty$ respectively. But neither does $E(Y)$ so the "equality" holds in some sense... – JMS Jun 22 '11 at 18:37