# determine $f_Y$ given $f_X$, cdf then pdf or inverse function?

I have this problem to determine a density function $$f_{Y}(y)$$ of $$Y$$ given $$X$$ as a random variable with uniform distribution on $$[−1, 1]$$ and $$Y = X^2$$. So: $$f_X(x) = \frac{1}{2}$$ for $$x \in [-1, 1]$$. I approached this problem with two different ways, 1) through determining first the $$F_Y$$ as the $$CDF$$, then derive from it $$PDF$$ 2) by transformation.

For the first method I got $$f_Y(y) = \frac{1}{2\sqrt(y)}$$ for $$y \in ]0, 1]$$ This seems correct. However, for transformation method, I tried the following:

$$g(x) = x^2$$ and $$g'(x) = 2x$$

$$x_1 = g^{-1}(y) = \sqrt(y)$$

so $$f_Y(y) = \frac{f_X(x_1)}{|g'(x_1)|} = \frac{1/2}{2\sqrt(y)} = \frac{1}{4\sqrt(y)}$$

Let $$Z=X^2$$, $$z \geq 0$$, $$P(Z \leq z) = P(X^2 \leq z) = P(X \leq \sqrt{z}, -X \leq \sqrt{z})$$ $$= P(X \leq \sqrt{z}, X \geq -\sqrt{z}) = F_X(\sqrt{z})-F_X(-\sqrt{z})$$

$$f_Z(z) = \frac{\partial P(Z \leq z)}{\partial z} = \frac{f_X(\sqrt{z})+f_X(-\sqrt{z})}{2\sqrt{z}}$$

If you derive the density of $$Z$$ directly using density of $$X$$, then u will get the same answer where $$\frac{1}{2\sqrt{z}}$$ is the jacobian. For $$Z = g(X)$$ with $$g^{-1}$$ continuously differentiable and $$g$$ is continuous, the density: $$f_Z(z) dz = P(Z \in [z,z+dz]) = P(X \in g^{-1}([z,z+dz]))$$ $$= \sum f_X(g^{-1}(z)) \times length(g^{-1}([z,z+dz]) = \sum_{x_i \in g^{-1}(z)} f_X(x_i) |\frac{\partial{g_i^{-1}(z)}}{\partial z}| dz$$ Where $$g_i^{-1} = g|_{S_i}^{-1}, S_i = [x_i,x_i+\epsilon)$$. The last step in the above derivation uses the mean value theorem and continuous differentiability of $$g^{-1}(z)$$. Now directly deriving the density, using above formula: $$f_Z(z) = (f_X(\sqrt{z})+f_X(-\sqrt{z})) |\frac{\partial \sqrt{z}}{\partial z}| = (f_X(\sqrt{z})+f_X(-\sqrt{z})) |\frac{1}{2\sqrt{z}}|$$.

So both gives the same answer.

• Thank you, but your explanation is not clear to me, I modified my question.
– Papa
Dec 8, 2022 at 5:06
• $dz$ is considered a very small increment, $P(Z \in [z,z+dz])$ means probability $Z$ is in the small interval $[z,z+dz]$. Since the interval is small the density function $f_Z(z)$ can be considered to be a constant function in this interval and we approximate it by $f_Z(z) dz = P(Z\in [z,z+dz])$ where $f_Z(z) dz$ is the integration of density $f_Z(z)$ over the interval $[z,z+dz]$ which is by definition $P(Z \in [z,z+dz])$. This approximation becomes exact when at the end you let $dz \rightarrow 0$. Dec 9, 2022 at 3:40
• Note that in the previous comment we assumed $f_Z(z)$ to be constant in the interval $[z,z+dz]$ and integrated it over this interval to get $f_Z(z) dz$ as probability $Z$ is in $[z,z+dz]$. So similarly for finding $P(X \in g^{-1}([z,z+dz]))$, we do the same and assume $f_X(x)$ to be constant in the interval $g^{-1}([z,z+dz])$ and integrate it to get $f_X(g^{-1}(z)) \times length(g^{-1}([z,z+dz]))$. So Now we have $P(X \in g^{-1}([z,z+dz])) = f_X(g^{-1}(z)) \times length(g^{-1}([z,z+dz]))$. Dec 9, 2022 at 3:47
• Now derivative can be thought of as slope and now we finllay do the approximation $length(g^{-1}([z,z+dz])) = |\frac{\partial g^{-1}(z)}{\partial z}| dz$ (since derivative is the slope, this works). Dec 9, 2022 at 3:51
• All these approximations becomes exact when we divide by $dz$ and let $dz \rightarrow 0$ due to the assumptions on $g,g^{-1}$ i.e., $g^{-1}$ is continuously differentiable and $g$ is continuous. Dec 9, 2022 at 3:53