# Homework Help: Uniform Distribution (Probability)

1. Nov 8, 2007

### Kites

1. The problem statement, all variables and given/known data

Let X be a discrete random variable with the p.m.f given in the following table:

x 10 20 30 40

p(x) .25 .2 .4 .15

Suppose you can generate a random value, u, from a uniform(0,1) distribution.

If u = 0.576, then what is the value of your random value from the distribution of X?

2. Relevant equations

F(x) = $$\int f(x)$$dx

Uniform:

f(x) = (a+b)/2

3. The attempt at a solution

I've attempted to find the C.D.F of the table:

x 10 20 30 40

p(x) .25 .45 .85 1

From here I am at a complete loss at how to use my value of U to get at a random value of X. I did attempt the following but am unsure of its validity:

u = $$\int$$(1/30)dx from 10 to x, finding approximately 27 as the value. This seems very wrong to me as that makes me assume that the table is a uniform distribution which it is not.

I could truly use some help. Thanks a lot.

2. Nov 8, 2007

### D H

Staff Emeritus
The CDF for a uniform number is a straight line with values going from 0 to 1. In particular, the CDF for U(0,1) is the line F(x)=x. You function does not have a linear CDF. This is not a problem.

Suppose you have a CDF F(x) for some random distribution. The distribution does not have to be uniform. Now suppose this CDF F(x) is an invertible function. In other words, given some value F, the inverse function F-1(F) finds x such that F(x)=F. If you have such a magic bullet, you can use numbers drawn from the standard uniform distribution to generate random numbers drawn from the distribution in question. How? Simple apply the inverse function F-1(F). This is essentially what you are to do with this problem. What you need to do is find which bin (10, 20, 30, or 40) corresponds to a CDF value of 0.576.

3. Nov 8, 2007

### Kites

Okay, I've taken a look at the CDF and the values are:

x 10 20 30 40

p(x) .25 .45 .85 1

for the CDF of X.

By your logic I have to find what BIN that .567 goes into...

I would say that the closest bin is the P(x) = .45 or, x=20.

Is this correct?

4. Nov 8, 2007

### D H

Staff Emeritus
Any value drawn from U(0,1) that falls between 0 and 0.25 obviously must be assigned to x=10. (What else?) Suppose you use a higher cutoff value than 0.25. This will make the probability of drawing a "10" will exceed 0.25. So anything between 0 and 0.25 maps to the first bin, x=10. Keep following this logic forward and you will find you do not want the closest bin.

5. Nov 8, 2007

### Kites

You're exactly right thank you DH It's a true life saver for me.

6. Nov 8, 2007

### D H

Staff Emeritus
Your'e welcome.