# Why can we treat MGF in this way

For the standard proof that if $$Z \sim N(0,1)$$ than $$Z^{2} \sim \chi^{2}_{1}$$

We write:

$$M_{Z^{2}}(t)=\int_{\mathbb{R}}\exp(tz^{2})\frac{1}{\sqrt{2\pi}}\exp(\frac{-z^{2}}{2}) dz$$

That is, we use the standard normal density to compute the moment generating function (MFG).

Why do we not need to use the density of $$Z^{2}$$ but instead are able to use the density of just $$Z$$? I assume because it is a continuous one to one function ?

In principle, you don't know the density of $$Z^2$$, so you can't use it.
What's being done when you use the density of $$Z$$ is an application of the law of the unconscious statistician.