# Find distribution function and pdf for a random variable based on a uniform distribution

Let $X$ be uniform on $(0,1)$.

Definition of $Y$ is as following:

$$Y=\begin{cases}e^X \quad &(0\le X<0.5) \\ \log X\quad &(0.5\le X\le 1)\end{cases}$$

1. find Definition function of Y, F(y) and pdf (probability distribution function) f(y)
2. find E(Y) and Var(Y)
3. E(Y|X<0.25)
4. ρ(X,Y) ->maybe this is covariance

### My progress

For the definition function,

$$F(y)=Pr(Y\le y) =pr(0\le X<0.5) + Pr(0.5 \le X\le 1) = Pr(Y=e^X | X=x)0.5 + Pr(Y=\log X | X=x)0.5$$

I tried to integrate and I got just the value. But DF should be expressed as a function, so my answer is wrong.

• A first step would be to tell us what you tried, what you thought of, and where you are currently stuck. – Clement C. May 31 '15 at 22:27

You have $Y=g(X)$ where $g(x) = \begin{cases} e^x & : 0\leq x< 0.5\\\ln x & : 0.5\leq x < 1 \\ \text{undef} & : \text{elsewhere}\end{cases}$

Sketching the graph of $y=g(x)$ over $x\in[0;0.5)\cup[0.5;1]$ tells us that the function is a bijection (1:1 and onto); that is, there does exist an inverse function (let's call it $h$) mapping the support of $Y$ back onto the support of $X$.

That means $X=h(Y)$ where $h(y) = g^{-1}(y) = \begin{cases} e^y & :\ln(0.5) \leq y < 0\\ \ln y & : 1\leq y < e \\ \text{undef} & : \text{elsewhere}\end{cases}$

We should note from sketching the graph of $y=g(x)$ that while y increases as x does on two halves of the support of x, there is a step discontinuity.

\begin{align}F_Y(y) & = \Pr(Y\leq y) \\[1ex] &= \begin{cases} \Pr(0.5<X\leq h(y)) & : \ln(0.5)< y\leq 0 \\ \Pr(0.5\leq X\leq 1) & : 0\leq y < 1 \\ \Pr(0 < X < h(y)\cup 0.5\leq X < 1) & : 1\leq y < e \\ 0 & : y\leq \ln(0.5) \\ 1 & : y\geq e \end{cases} \\[1ex] & = \begin{cases} e^y-0.5 & : \ln(0.5)< y\leq 0 \\ 0.5 & : 0\leq y < 1 \\ \ln (y)+0.5 & : 1\leq y < e \\ 0 & : y\leq \ln(0.5) \\ 1 & : y\geq e\end{cases} \end{align}

Can you continue from here?

• why do you introduce h(Y) ? actually X is uniform distribution (0,1) and could you explain more in detail? – Jackie May 31 '15 at 23:28
• $h(y)=g^{-1}(y)$, the inverse of the map from $X$ to $Y$. As $Y=g(X)$, then $X=h(Y)$. And by noting the step discontinuity, we have: $$\Pr(Y\leq y) = \Pr\big(0.5\leq X\leq g^{-1}(y)\big)\mathbf 1_{\ln(0.5)\leq y\leq 0}+\Big(\Pr\big((0\leq X\leq g^{-1}(y)) \cup (0.5\leq X\leq 1)\big)\Big)\mathbf 1_{1\leq y\leq e}$$ – Graham Kemp Jun 1 '15 at 1:25