# Difference distribution of iid noncentral chi2 variables

Given are two identically distributed independent noncentral chi-square variables $$Z_1\sim \chi^2(k,\lambda)\\Z_2\sim\chi^2(k,\lambda)$$ with $$k=2$$ degrees of freedom and location parameter $$\lambda$$.

What is the pdf of $$Z_1-Z_2$$?

A related post deals with the difference of such variables. However the solution is not given there. I hope the solution for the difference of identically distributed variables is easier to show.

• You cannot directly use the information given on the link. The link deals with addition, your question is on subtraction. Totally different variables. eg, The support of your new variable is from $Z_1-Z_2\in(-\infty, \infty)$, while the support for the link is $[0,\infty)$. Ie Think of two exponentials, the difference is laplacial distribution while the sum is gamma distribution. Hope you see how different addition and subtraction are. One thing though is I am not sure as to whether there exists a closed form/ well known form for the distribution you are looking for. You .... Commented Dec 18, 2021 at 3:56
• could compute the $M_{Z_1-Z_2}(t) = \frac{\exp\left(\frac{4\lambda t^2}{1-4t^2}\right)}{\left(1-4t^2\right)^{k/2}}$ and use the inverse laplacian transformation to obtain the pdf. Commented Dec 18, 2021 at 4:16
• If you are okay with integrating the Bessel functions of the first kind, then consider using law of total probability to obtain the pdf Commented Dec 18, 2021 at 4:17
• @Onyambu: looks interesting: could you detail better ? Commented Dec 18, 2021 at 15:10
• If you don't like Fourier Transform representations, you're going to be out of luck on this one too.
– whuber
Commented Dec 18, 2021 at 15:37

If you are accepting an Integral representation for this one, then you could do the following:

\begin{aligned} Z &= X - Y\\ f_Z(z)&=\frac{\partial}{\partial z}P(Z\le z) = \frac{\partial}{\partial z}P(X-Y\le z)\\ &=\frac{\partial}{\partial z}P(X\le Y + z)\\ &=\frac{\partial}{\partial z}\int_0^\infty P(X\le Y+z | Y=y) f_Y(y) ~dy\quad\text{law of Total probability}\\ &=\frac{\partial}{\partial z}\int_0^\infty F_X(y+z) f_Y(y) ~dy\\ &=\int_0^\infty \frac{\partial}{\partial z}F_X(y+z) f_Y(y) ~dy\quad\text{Leibniz Rule}\\ &=\boxed{\int_0^\infty f_X(y+z)f_Y(y) ~dy,\quad -\infty

We can confirm the above by using a programing Language:

R

## Our pdf:
fz_pdf <- Vectorize(function(z, df, ncp){
g<- function(y)dchisq(y+z, df, ncp)*dchisq(y, df,ncp)
integrate(g, 0, Inf)\$value
})

## Sample random Data And see whether the function above fits the data.
n <- 100000
k <- 2
lambda <- 5

X <- rchisq(n, k, lambda)
Y <- rchisq(n, k, lambda)
plot(density(X-Y), lwd = 3)## This is the density we want to match.

# Superimpose the pdf from our line
curve(fz_pdf(z, k, lambda),
from = -20,
xname = 'z', add = TRUE, col='red', lwd = 2, n=200)


The resulting image shows that the pdf matches the density of Z