# Deriving the Chi-squared distribution using characteristic functions

I would like to directly derive the probability density function (PDF) for a Chi-squared distribution with $$k$$ degrees of freedom using characteristic functions.

If $$X_{1}, X_{2}, \dots, X_{k}$$ are independent, standard normal random variables, then $$Y = \sum_{i=1}^{k} X_{i}^{2}$$ and $$Y$$ is chi-squared distributed with $$k$$ degrees of freedom. The PDF for $$Y$$ when $$k = 1$$ is given by $$f(x, 1) = \frac{1}{\sqrt{2 \pi x}} e^{-\frac{1}{2} x}$$ and its respective characteristic function is $$\varphi_{Y_{1}} (\omega) = \int_{-\infty}^{\infty} f(x, 1) e^{iwx} dx = (1 - i2 \omega)^{-\frac{1}{2}} \text{,}$$ where $$i$$ is the imaginary number. For a general $$k$$ degrees of freedom, $$Y$$'s characteristic function is given by $$\varphi_{Y} (\omega) = (1 - i2 \omega)^{-\frac{k}{2}} \text{.}$$ Is it possible to explicitly derive $$f(x, k)$$ using the inverse Fourier transform, where $$f(x, k) = \frac{1}{2 \pi} \int_{-\infty}^{\infty} (1 - i2 \omega)^{-\frac{k}{2}} e^{-iwx} d\omega ?$$ I have had no success with this approach, but I'm probably missing something very obvious.

Failing that, is it possible to derive a formula for $$k=2$$, where $$f(x, 2) = \frac{1}{2 \pi} \int_{-\infty}^{\infty} (1 - i2 \omega)^{-1} e^{-iwx} d\omega ?$$ This would at least allow me derive the PDF inductively. In addition, I am aware that $$f(x, 1)$$ can be represented as the Gamma distribution $$\text{Gamma}(x, \frac{1}{2}, \frac{1}{2})$$ and the sum of independent Gamma random variables is known to be Gamma distributed, therefore, for this example, $$Y \sim \text{Gamma} ( \cdot, \frac{k}{2}, \frac{1}{2}) \text{.}$$

I have exact the exact motivation of finding the pdf of the chi squared through the characteristic function and got stuck in the same place. But finally I worked it out.

What we want to find is:

$$\int_{-\infty}^{\infty} f(\omega) d\omega=\int_{-\infty}^{\infty} (1 - i2 \omega)^{-k/2} e^{-iwx} d\omega =?$$ For solving the integral, we will use the residue theorem. The integrand has one pole at -i/2. For calculating the residue of this pole, we will use the Cauchy integral formula for order n and extend it using the concepts of fractional calculus. The Cauchy integral formula goes as: $$g^{(n)}(a)=\frac{n!}{2\pi i} \oint_{\gamma} \frac{g(z)}{(z-a)^{n+1}}dz$$ Where $$\gamma$$ is a closed curve enclosing $$a$$ and oriented counterclockwise.

Following the principles of fractional calculus, we substitute $$n! = \Gamma(n+1)$$, rearranging terms and changing the variable n for s to make explicit that we are now in a continuous formula, we have: $$\oint_{\gamma} \frac{g(z)}{(z-a)^{s}}dz=\frac{2\pi i}{\Gamma(s)}g^{(s-1)}(a)\:,\: s\: \epsilon \: \mathbb{R}$$ In our case, we have $$g(z)=e^{-ixz}$$, $$s=k/2$$ and $$a=-i/2$$.

From the fractional calculus we know that the fractional derivative of the exponential is:

$$\frac{d^{s}}{dz^{s}}e^{az}=a^se^{az}\: \: \Rightarrow \: \: g^{(k)}(z)=(-ix)^ke^{-ixz}$$

Making the substitutions, we get: $$\oint_{\gamma}\frac{e^{-ixz}}{(1-2iz)^{\frac{k}{2}}}dz=(-2i)^{-\frac{k}{2}}\oint_{\gamma}\frac{e^{-ixz}}{(z+\frac{i}{2})^{\frac{k}{2}}}dz=(-2i)^{-\frac{k}{2}}\frac{2\pi i}{\Gamma(k/2)}(-ix)^{\frac{k}{2}-1}e^{-ix(-i/2)}$$

Simplifying: $$\oint_{\gamma}\frac{e^{-ixz}}{(1-2iz)^{k/2}}dz=-\frac{2^{1-\frac{k}{2}}x^{\frac{k}{2}-1}e^{-\frac{x}{2}}\pi}{\Gamma(\frac{k}{2})} = Res(f(z),-\frac{i}{2}) =R$$

Now, we take the integral contour $$\gamma$$ as in the picture below. (Note, it seems that I'm not allowed to embed images because I don't have enough reputation)

Integral Contour

[A segment from $$r$$ to $$-r$$, with $$r\, \epsilon\, \mathbb{R} > 1/2$$, closed by a semicircle centered at the origin with raidus r extending from $$\pi$$ to $$2\pi$$. Closed curve oriented counterclockwise. The semicircle path is named $$C_{\gamma}^+$$, with the + sign indicating the orientation]

If we make $$r\rightarrow \infty$$, we have:

$$\oint_{\gamma}f(z)dz=\int_{C_{\gamma}^+}f(z)dz-\int_{-\infty}^{\infty}f(\omega)d\omega=R$$ Where the minus in the right hand comes from the integration orientation.

Now, we have to prove that the limit of the integral in $$C_{\gamma}^+$$ as $$r\rightarrow \infty$$ is zero:

$$\lim_{r\rightarrow \infty} f(re^{i\theta})=\lim_{r\rightarrow \infty} \frac{e^{-ixre^{i\theta}}}{(1-2ire^{i\theta})^{\frac{k}{2}}} =\lim_{r\rightarrow \infty} \frac{e^{-ixr(\cos(\theta)+i\sin(\theta))}}{(-2i)^{\frac{k}{2}}r^{\frac{k}{2}}e^{\frac{k}{2}i\theta}}$$

$$=(-2i)^{-\frac{k}2{}}\lim_{r\rightarrow \infty}\frac{e^{xr\sin(\theta)}e^{-i(xr\cos(\theta)+\frac{k}{2}\theta)}}{r^{\frac{k}{2}}}=(-2i)^{-\frac{k}2{}}\lim_{r\rightarrow \infty}\frac{e^{xr\sin(\theta)}e^{-ixr\cos(\theta)}}{r^{\frac{k}{2}}}$$

We have used for $$r\rightarrow \infty$$ $$\left | 2ire^{i\theta} \right |\gg 1$$ and $$\left | xr\cos(\theta) \right |\gg \frac{k}{2}\theta$$ for $$\theta\neq \pm \pi/2$$

The limit of $$e^{-ixr\cos(\theta)}$$ as $$r\rightarrow \infty$$ does not exist, however its bounded as the modulus is one, therefore the limit will depend on the other two terms. $$r^{k/2}$$ tends to infinity, and $$e^{xr\sin(\theta)}$$ tends to zero for $$x>0$$ and $$\theta \epsilon (\pi,2\pi)$$, which is precisely the range corresponding to $$C_{\gamma}^+$$.

It is immediate to see that for the cases $$x=0$$ and $$\theta=-\pi/2$$ the limit is also zero.

Thus we have:

$$\forall \theta \epsilon (\pi,2\pi), x\geq 0 : \lim_{r\rightarrow \infty}f(re^{i\theta})=0$$

$$\int_{C_{\gamma}^+}f(z)dz=0 \Rightarrow \int_{-\infty}^{\infty}f(\omega)d\omega=-R=\frac{2^{1-\frac{k}{2}}x^{\frac{k}{2}-1}e^{-\frac{x}{2}}\pi}{\Gamma(\frac{k}{2})}$$

Finally, the probability density function of the Chi Squared distribution is:

$$pdf(x,k)=\frac{1}{2\pi}\int_{-\infty}^{\infty}\frac{e^{-ix\omega}}{(1-i2\omega)^{\frac{k}{2}}}d\omega=\frac{1}{2\pi}\frac{2^{1-\frac{k}{2}}x^{\frac{k}{2}-1}e^{-\frac{x}{2}}\pi}{\Gamma(\frac{k}{2})}=\frac{x^{\frac{k}{2}-1}e^{-\frac{x}{2}}}{2^{\frac{k}{2}}\Gamma(\frac{k}2{})}, x\geq0$$

Which is, of course, the value we were looking for.