# Polynomial approximation of $\chi^2$ distribution pdf

The $\chi^2$ distribution PDF is $$f_{\chi^2}(x;k) = \frac{1}{2^{k/2}\Gamma(k/2)} x^{k/2 - 1} \mathrm{e}^{-x/2} \mathbf{1}_{x \geq 0}$$

I am trying to find a polynomial approximation to this density function. Power series expansion for the exponential $\mathrm{e}^x$ works fine, but it's an infinite series. I an looking at possibilities to attain a more compact approximation. Approximation using orthogonal polynomials is one option I'm looking at.

Are there better alternatives to power series expansion of $\mathrm{e}^x$ for approximating this pdf?

• Do you require a polynomial or would other approximations, such as Gaussians, work? (For instance, the cube root of $x$ is approximately Gaussian for modest to large $k$.) – whuber Nov 10 '11 at 21:01
• See if this is helpful. – Sasha Nov 10 '11 at 21:09
• Since $f(x)\to0$ when $x\to\infty$, $|f(x)-P(x)|\to\infty$ when $x\to\infty$ hence $(f-P)$ is unbounded for every polynomial $P$ except $P=0$. You could explain the sense in which $P$ should approximate $f$. – Did Nov 10 '11 at 22:31
• If you're approximating on a bounded interval, you might use Chebyshev series or the Remez algorithm. As Didier noted, polynomials won't give you a good approximation on all of $[0,\infty)$. You could, however, approximate by rational functions. – Robert Israel Nov 11 '11 at 0:02
• @RobertIsrael I want to approximate on all of $[0,\inf]$. I can see why approximation with polynomials could be problem as suggested by Didier. What approach is suggested for rational function approx? – sauravrt Nov 11 '11 at 17:35

Cecil Hastings, in his book Approximations for Digital Computers, gives a rational function approximation to $\exp(-x)$ for $0 \leq x < \infty$ that gives results that are good to $\approx 6$ digits:
$$\exp(-x)\approx R(x)=\frac1{(1+c_1 x+c_2 x^2+c_3 x^3+c_4 x^4+c_5 x^5+c_6 x^6)^4}$$
\begin{align*} c_1&=0.2499986842\\ c_2&=0.0312575832\\ c_3&=0.0025913712\\ c_4&=0.000171562\\ c_5&=5.4302\times 10^{-6}\\ c_6&=6.906\times 10^{-7} \end{align*}
Here's a plot of $R(x)-\exp(-x)$:
Hastings's book gives other, simpler approximations you can use if you have less stringent accuracy requirements. You can now plug this into your $\chi^2$ PDF expression to get the approximation you need.