# Quantile function

#### paulina96

##### New Member
Hi everyone,
I'm trying to solve the following problem:

I have a uniform random variable X with:

1 if 0 < x < 1
0 otherwise

Now, I computed the CDF in the following way:

0 if x <= 0
x if 0 < x < 1
1 if x equal or higher than 1

Then, the problem says, let Y = -2log X; it asks to find the quantile function.
The quantile function is the inverse of CDF. So I wrote:

F(y) =P(Y<= y) = P (-2log X <= y) = P (log x >= -y/2) = P ( x >= e ^ (-y/2) ) = 1 - P ( x <= e ^ (-y/2) ) = 1 - F( e^-(y/2) )
Then, what should I do next?
Thanks

#### fed2

##### Active Member
I think the confusion is that the F() on the LHS is not the same F(.) on the RHS, the one on the RHS is apparently the CDF of X, ie x for the uniform RV?

so having the CDF of Y now just invert ie set F(y) = gamma_0.5 (or whatever percentile) and solve.

#### paulina96

##### New Member
My intuition says that the next stage is to compute the CDF of X, that is, the CDF(e^-(y/2))
This CDF is equal to 0 for e^(-y/2)<=0 ,
is equal to e^(-y/2) for 0< e^(-y/2) <1
Then it is one for e^(-y/2)>1
Just as I did for CDF of X in my first message

So, the result is 1 - F( e^-(y/2) ) = 1-e^(-y/2)
Then, I can write down the quantile function.
Can it work for you?

#### fed2

##### Active Member
yes, you have it in that last equation, so just need to take inverse function of that. real question is how will you check if ans is correct?

#### paulina96

##### New Member
I suppose that's a rhetorical question, right? If not, what do you mean?

Last edited: