Probability Density Function and Expected Value of a Function of a Uniformly Distributed Variable This question pertains to the following homework question: 
Let X ~ U(0,1). Find the probability density function and the expected value of X/(1-X).
How does one go about finding either? 
Thus far, I've reasoned: 
X being U(0,1), implies that X = 1 for 0 < X < 1, and 0 otherwise. 
But doesn't this mean that X/(1-X) is undefined for 0 < x < 1, and zero otherwise? And this      would make X/(1-X) not a defined probability density function. 
E[X/(1-X)] = integral of X/(1-X)dX from 0 to 1 
However, this is infinity, which does not make much sense. 
Where did my reasoning go wrong? Sorry I did not have the time to format decently. 
 A: The random variable $X$ has (continuous) uniform distribution on $(0,1)$ precisely if for any $x$ between $0$ and $1$, we have $\Pr(X\le x)=x$.
Let $Y=\frac{X}{1-X}$. We will find the cumulative distribution function of $Y$, and then the density function.  (There are faster ways than the path we take.)
As $x$ ranges over $(0,1)$, the function $\frac{x}{1-x}$ ranges over the interval $(0,\infty)$. For any positive $y$, we now find $\Pr(Y\le y)$. 
We have $Y\le y$ if and only if $\frac{X}{1-X}\le y$ if and only if $X\le (1-X)y$. 
Rewrite $X\le (1-X)y$ as $X(1+y)\le y$ and then as $X\le \frac{y}{1+y}$. Since $X$ is uniformly distributed on $(0,1)$, we have 
$$\Pr\left(X\le \frac{y}{1+y}\right)=\frac{y}{1+y}.$$ 
It follows that the cdf $F_Y(y)$ is given by
$$F_Y(y)=\frac{y}{1+y},$$
for $0\lt y$. Differentiate to find the density function.
For the expectation of $\frac{X}{1-X}$, we can simply "calculate" $\int_0^1\frac{x\, dx}{1-x}$.  This improper integral diverges (to $\infty$). One can say the mean does not exist, or that it is infinite. We do not need to know the density or cdf of $Y$ to find $E(Y)$. 
