What is a easy way to draw from distribution $f(x|u) \propto x^{\alpha-1}I(xWe know $u$ and want to draw $x$ from the conditional density $f(x|u) \propto x^{\alpha-1}I(x<u), \alpha>0$. One way is that first draw $r$ from uniform(0,1), and then set $x=u e^{\frac{\log(r)}{\alpha}}$. I don't know why. Please help me to explain it. Thanks
 A: I think your density function  $f$ is wrong. Because $\lim_{x\to -\infty} f(x|u)=\infty$ if $\alpha >0$. I suppose you meant: $f(x|u) \propto x^{\alpha-1} I(0<x<u)$.
In that case, fix $u$ and $\alpha$ as given values. Let $X$ be a random variable with distribution that has density funcion $f(x|u) \propto x^{\alpha-1}$, $0<x<u$. Actually, one can find the constant missing:
$$f(x|u) = \frac{\alpha}{u^\alpha} x^{\alpha-1}, \quad 0<x<u.$$
Consider a uniform distribution $R\sim Unif(0,1)$ and define the function $F(r) = u e^{\frac{\log (r)}{\alpha}} = u r^{1/\alpha}.$ Then $F(R)$ has the same distribution as $X$ and hence drawing observations from $X\sim f(x|u)$ is the same as drawing observations from $F(R)$ with $R\sim Unif(0,1)$.
To see that indeed $F(R)$ has the same distribution as $X$, observe:
\begin{align*}
P(F(R)< r) = P(u R^{1/\alpha} < r) = P(R^{1/\alpha} < \frac{r}{u}) = P\left(R < \left(\frac{r}{u}\right)^{\alpha}\right)=\left(\frac{r}{u}\right)^{\alpha} I(0<r<u),
\end{align*}
where the last follows from the fact that $P(R<a)=aI(0<a<1)$ if $R\sim Unif(0,1)$.
Now the derivative of the distribution function $P(F(R)<R)$ should coincide with $f$. Indeed,
$$\frac{d}{dr} P(F(R)<R) = \frac{\alpha}{u^\alpha} r^{\alpha-1} I(0<r<u)$$
and hence $F(R)$ and $X$ have the same density function, hence the same distribution:
$$X\sim F(R) \mbox{ being } R\sim Unif(0,1).$$
