Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I want to generate a random variable with such a pdf: $f(x) = \frac{5}{12}[1+(x-1)^4], (0 \leq x \leq 2)$ by composition, what should I do?

Some of my thought is that I can first make it into $f(x) = \frac{5}{6}\frac{1}{2} + \frac{1}{6}[\frac{5}{2}(x-1)^4]$. But I'm not sure how to proceed.


share|cite|improve this question
up vote 2 down vote accepted

HINT: You now generate Bernoulli random variable with $p=\frac{1}{6}$. If it is zero, you output uniform random variable on $(0,2)$, otherwise you output random variable with density $\frac{5}{2} (x-1)^4$, which you can generate by inversion method.

share|cite|improve this answer
Got it :) Inversion method rocks. :) – Mathematics Lover Feb 29 '12 at 20:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.