# How to estimate the PDF of the logarithm of a uniformly distributed random variable?

This is a question I have to solve and need help with. I know it's usual to give pointers and hints so the OP can follow from there. Thus, I'll appreciate all input that shows me the way to go.

Let $$X$$ be a non-negative random variable. Let $$Y = ln(X)$$.

Let $$f_{X}(x)$$ be:

$$f_{X}(x)=\begin{cases} 1/4, & \text{if 2 < x \leq6 }\\ 0, & \text{otherwise}. \end{cases}$$

And let $$f_{Y}(y)$$ be:

$$f_{Y}(y)=\begin{cases} g(y), & \text{if a < x \leq b }\\ 0, & \text{otherwise}. \end{cases}$$

What is the formula for $$g(y)$$? What are the values of $$a$$ and $$b$$?

I know that

$$F_{Y}(y) = \mathbb{P}(Y \leq y)$$

$$F_{Y}(y) = \mathbb{P}(ln(X) \leq y)$$

$$F_{Y}(y) = \mathbb{P}(X \leq e^y)$$

$$F_{Y}(y) = F_{X}(e^y)$$

From this point on, I am not sure what I should plug in to find $$g(y)$$.

Should I have converted the range of $$X$$, i.e. $$[2,6]$$, to a range for $$Y$$? The histogram for the variable $$X$$, as seen in the figure below, was obtained with the sampling of 1 million data points from the distribution $$U:[2,6]$$. The histogram for $$Y$$ followed after taking the $$ln(.)$$ of $$X$$. The range of $$Y$$ is $$[ln(2), ln(6)]$$.

Knowing that the pdf is the derivative of the cdf, from $$F_Y(y) = F_X(e^y)$$, to get the pdf of $$Y$$ you just need to differentiate with respect to $$y$$ and you get that $$f_Y(y) = f_X(e^y)e^y$$. So if $$y\in[ln(2),ln(6)]$$ it is $$e^y/4$$ and $$0$$ otherwise.