# The probability density of $X^2$?

Here is a question about probability density. I am trying to work it out using a different method from the method on the textbook. But I get a different answer unfortunately. Can anyone help me out?

Question: Let $X$ be uniformly distributed random variable in the internal $[ 0, 1]$. Find the probability density of $X^2$?

My trial: \begin{align} F_Y(y) & = P(Y\leq y) \\ & = P(X^2\leq y) \\ & = P(X\leq\surd y)\\ & = F_X(\surd y) \\ & = \int_0^{\surd y} t \;\mathrm d t \\ & = 0.5 y\\ \therefore f_Y(y) & =0.5 \end{align} This is actually inspired by https://math.stackexchange.com/questions/...

Solution on the textbook: \begin{align} y & = x^2 \\ \mathrm dy & = 2x \;\mathrm dx \\ h(y)\;\mathrm dy & = 1 \mathrm dx \\ h(y) 2x \;\mathrm dx & = \mathrm dx \\ h(y) & = 0.5/x \\ & = 0.5/\surd y \end{align}

The method is fine in principle, but the wrong density function for $X$ was used..\ As in your argument, we have, for $0\lt y\lt 1$, $$F_Y(y)=\Pr(X\le \sqrt{Y}).$$ However, if you really want to use an integral, $$F_X(\sqrt{y})=\int_0^{\sqrt{y}} 1\cdot dt=\sqrt{y}.$$ This is because the density function of $X$ on $(0,1)$ is $1$.

Differentiating, we find that $f_Y(y)=\frac{1}{2y^{1/2}}$ for $0\lt y\lt 1$.

My Trial \begin{align} F_Y(y) & = P(Y\leq y) \\[1ex] & = P(X^2\leq y) \\[1ex] & = P(X\leq\surd y)\\[1ex] & = F_X(\surd y) \\[1ex] & = \int_0^{\surd y} t \;\mathrm d t & \bigstar \\[1ex] & = 0.5 y\\[2ex] \therefore f_Y(y) & =0.5 \end{align}

$\bigstar$ Your error is here. $f_X(t) = 1$ for all $t\in[0;1]$, and $F_X(t) = t$; so $F_X(\surd y)=\surd y$.

\begin{align} F_Y(y) & = F_X(\surd y) \\[1ex] & = \int_0^{\surd y} 1 \;\mathrm d t & \bigstar \\[1ex] & = \surd y\\[2ex] \therefore f_Y(y) & =1 / (2\surd y) \end{align}

Addendum. The textbook's solution demonstrates that if you have an invertable map of $X\to Y$ and a pdf for $X$ and wish to find the pdf for $Y$, then you don't have to integrate then derive again, you just need to apply a change of variable transformation (one derivation).

$$Y=g(X) \implies f_Y(y) = f_X(g^{-1}(y)) \left\lvert\frac{\mathrm d g^{-1}(y)}{\mathrm d y}\right\rvert$$

This will often be a much easier approach, particularly if the initial distribution is something other than uniform.   Learn it and love it.

\begin{align}Y=X^2, f_X(x)=\mathbf 1_{(0;1)}(x) \implies f_Y(y) & = f_X(\surd y) \left\lvert\frac{\mathrm d \surd y}{\mathrm d y}\right\rvert \\ & = \frac{1}{2\surd y}\;\mathbf 1_{(0;1)}(y) \end{align}