Similar to the derivation of the probability of the chi-squared distribution, say we have continuous random variables $X$ and $Y$ with $Y = X^2$ where $X \sim \mathcal{N}(\mu, \sigma^2)$. What is the probability density of $Y$ in this case?
This should seemingly be trivial but I cannot reproduce the result I have found in my lecture notes. The expected result is:
$$ \frac{1}{2 \sqrt{2 \pi \sigma y}} \exp(-\frac{y + \mu^2}{2 \sigma^2}) \left[\exp(\frac{\mu \sqrt{y}}{\sigma^2}) + \exp(-\frac{\mu \sqrt{y}}{\sigma^2})\right] $$
but I don't get that at all, here's what I have tried so far:
$$ f_Y(y) = \frac{d}{dy} F_Y(y) = \frac{d}{dy} (P_X[X \leq \sqrt{y}] - P_X[X \leq -\sqrt{y}]) $$
where:
\begin{align*} \frac{d}{dy} P_X[X \leq \sqrt{y}] &= \frac{1}{\sqrt{2 \pi} \sigma} \frac{d}{dy}\exp(-\frac{(\sqrt{y} - \mu)^2}{2 \sigma^2}) \\ &= \frac{1}{\sqrt{2 \pi} \sigma} (\frac{1}{2 \sqrt{y}})(-\frac{\sqrt{y} - \mu}{\sigma^2}) \exp(-\frac{(\sqrt{y} - \mu)^2}{2 \sigma^2}) \end{align*}
and at this point it's already clear that this will not work out since there are is going to be an unwanted factor $-(\sqrt{y} - \mu)/\sigma^2$ in in the final expression for $f_Y(y)$.
Where did I go wrong?
EDIT:
I really screwed up here, as gt6989b rightly pointed out I forgot an integral so the second part should really be:
\begin{align*} \frac{d}{dy} P_X[X \leq \sqrt{y}] &= \frac{1}{\sqrt{2 \pi} \sigma} \frac{d}{dy} \int_{-\infty}^{\sqrt{y}} \exp(-\frac{(t - \mu)^2}{2 \sigma^2}) dt\\ &= \frac{1}{\sqrt{2 \pi} \sigma} (\frac{1}{2 \sqrt{y}})\exp(-\frac{(\sqrt{y} - \mu)^2}{2 \sigma^2}) \end{align*}
Which works out I think.