Showing distribution has a $\chi^2$ distribution with df = n Let $X_1,X_2,....,X_n$ denote independent identically distributed random variables such that $X_1$ has density $p_1(x;\theta)$ where
$\hspace{15mm}p(x;\theta) =\frac{1}{\sqrt{2\pi\theta}}e^{1/\theta}x^{-3/2}exp(-1/2(x+x^{-1})/\theta), x > 0$.
Show that $\frac{1}{\theta}T(x) = \frac{1}{\theta}\Sigma_{j}^{}(X_j + X_j^{-1}-2)$ has a $\chi^2$ distribution with df = n.
Attempted answer:
Since $\frac{1}{\theta}(X_i + X_i^{-1} -2)$ is an increasing function of X, let $t = \frac{1}{\theta}(X_i + X_i^{-1} -2)$. The pdf of t is:
$\hspace{15mm}g(t) =f(x)|\frac{dx}{dt}||_t$ --> So then $t = \frac{1}{\theta}(X_i + X_i^{-1} -2)$ --> $dt = \frac{1}{\theta}(1-X^{-2})dx$
After substitution we have
$\hspace{15mm}g(t)  =f(x)|\frac{dx}{dt}||_t$ = $(\frac{1}{2\pi\theta})^{1/2}exp{\frac{1}{-2\theta}}\frac{x^{-3/2}}{\frac{1}{\theta}(1-x^{-2})}$
$\hspace{15mm}=(\frac{\theta}{2\pi})^{1/2}exp(-\frac{t}{2})\frac{x^{1/2}}{(x^2-1)}$
$\hspace{15mm}=(\frac{1}{2\pi})^{1/2}exp(-\frac{t}{2})\frac{(x\theta)^{1/2}}{(x-1)}* \frac{1}{x+1}$
$\hspace{15mm}=(\frac{1}{2\pi})^{1/2}exp(-\frac{t}{2})t^{-1/2}* \frac{1}{x+1}$
The distribution would be $\Gamma(1/2,1/2)$ if the $\frac{1}{x+1}$ could be removed. 
 A: One approach is to work instead with the moment generating function.
Consider $t < 1/2$ and note that the moment generating function of 
$h(X_{i}) = \frac{1}{\theta}(X_{i} + X_{i}^{-1} - 2)$ is
\begin{eqnarray}
M_{h(X)}(t) &=& E\Big[ \exp\Big\{ \frac{t}{\theta}( X_{i} + X_{i}^{-1} - 2) 
\Big\}\Big] \\
&=& \frac{e^{-2t/\theta}}{\sqrt{2\pi\theta}}
\int_{0}^{\infty}e^{1/\theta} \exp\Big(\frac{t}{\theta}\{x + 1/x  \}\Big)x^{-3/2}\exp\Big(\frac{-1}{2\theta}\{x + 1/x\}\Big) dx \\
&=& \frac{e^{(1-2t)/\theta}}{\sqrt{2\pi\theta}}
\int_{0}^{\infty} x^{-3/2}\exp\Big(\frac{-(1 - 2t)}{2\theta}\{x + 1/x\}\Big) dx \\
&=& \frac{1}{\sqrt{1 - 2t}}
\int_{0}^{\infty} \frac{e^{(1-2t)/\theta}}{\sqrt{2\pi}}\sqrt{\frac{1 - 2t}{\theta}}x^{-3/2}\exp\Big(\frac{-(1 - 2t)}{2\theta}\{x + 1/x\}\Big) dx \\
&=&  \frac{1}{\sqrt{1 - 2t}}\int_{0}^{\infty}{ p(x; \eta) dx},
\qquad \textrm{where } \eta = \theta/(1 - 2t) \\
&=& \frac{1}{\sqrt{1 - 2t}}
\end{eqnarray}
This is exactly the mgf of a chi-squared random variable with one degree of 
freedom. Hence, $h(X_{i}) \sim \chi_{1}^{2}$. 
Since $\frac{1}{\theta}T(x) = \sum_{i=1}^{n} h(X_{i})$, this means
that $\frac{1}{\theta}T(x) \sim \chi_{n}^{2}$.
