<s>[INST] random variable transformation I'm having trouble with the following random variable transformation:
$Y = X^2 + X$
I am looking for the pdf of Y. I tried the following method:
$p_Y(y) = \int_{X} p_{Y|X=x}(y)\cdot p_{X}(x)dx$
and we know that $(Y|X=x) \sim (x^2+x) \Rightarrow p_{Y|X=x} = \delta_{x^2+x}(y)$
thus: $p_Y(y) = \int_{X} \delta_{x^2+x}(y)\cdot p_{X}(x)dx$
But I don't see a way to reduce this further.
Then I tried a different approach:
$p_Y(y) = DF(Y < y) = DF(X^2 + X < y) = ...$
But then I don't see a way to find the inverse of $X^2 + X$.
Can anyone help me further on this?
 [/INST] Let $Y = X^2 + X = \left( X+\frac{1}{2} \right)^2 - \frac{1}{4}$. Then
$$
 F_Y(y) = \mathbb{P}(Y \le y) = \mathbb{P}\left( \left( X+\frac{1}{2} \right)^2 
\le  y + \frac{1}{4} \right)
$$
Assume, additionally, that $y+\frac{1}{4} > 0$. Then
$$ \begin{eqnarray}
   F_Y(y) &=& \mathbb{P}\left( -\sqrt{y + \frac{1}{4}} \le X+\frac{1}{2} 
\le  \sqrt{y + \frac{1}{4}} \right) \\ &=& F_X\left( -\frac{1}{2} + \sqrt{y + \frac{1}{4}} \right) -  F_X\left( -\frac{1}{2} -\sqrt{y + \frac{1}{4}} \right) + \mathbb{P}\left( X = -\frac{1}{2} - \sqrt{y + \frac{1}{4}} \right)
 \end{eqnarray}
$$
If $X$ is continuous rv, the last term is zero.
Differentiating with respect to $y$, we get
$$
   f_Y(y) = \frac{1}{\sqrt{4y+1}} \left( f_X\left(-\frac{1}{2} + \sqrt{y + \frac{1}{4}} \right) + f_X\left( -\frac{1}{2} -\sqrt{y + \frac{1}{4}} \right) \right) \cdot \mathbf{1}\left(y > -\frac{1}{4}\right)
$$
</s>