# Integrating a Delta Function of a Sum

As part of an inference project, I'm normalising a prior distribution which vanishes unless the set of $M$ data points $f_1,...f_M$ satisfies $$\sum_{i=1}^M f_i = 1.$$ Accordingly this is encoded with a Delta function in the prior, along with the condition that $0 \leq f_i \leq 1$, as such: $$\mathrm{Pr}(f_i) \propto \delta_\mathrm{D}\left(\sum_{i=1}^M f_i - 1\right)\prod_{i=1}^M \Theta(f_i),$$ where $\Theta$ is the Heaviside step function. To normalise we integrate and solve for $C$: $$C\int_{-\infty}^{\infty}...\int_{-\infty}^{\infty} \delta_\mathrm{D}\left(\sum_{i=1}^M f_i - 1\right)\prod_{i=1}^M \Theta(f_i) \,\mathrm{d}f_i = 1.$$ Trying to integrate this with a few values of $M$ in Mathematica shows that the integral itself is $(M-1)!$.

What I'm looking for is some insight into why this is... Is the first integral over $f_M$ just the integral of a delta function of $f_M$ plus some constants? so is it 1? Then the rest of the integrals are just over constants. I can see that you do this $M-1$ times but then I don't see how the $(M-1)!$ comes out.

Make the following change of variables:

$$y_1 = f_1$$

$$y_2 = f_1 + f_2$$

...

$$y_k = \sum_{i=1}^k f_i$$

...

$$y_M = \sum_{i=1}^M f_i$$

and notice that $$y_1.

The Jacobian determinant of the above transformation is 1, therefore,

$$\int \prod_{i=1}^M \ df_i\ \Theta(f_i) \ \delta\left(\sum_{i=1}^Mf_i-1\right)= \int \prod_{i=1}^M \ dy_i\ \Theta(y_i) \ \delta\left(y_M-1\right)$$

Since $$y_1, the latter series of integrals can be written as

$$\int^{1}_0 dy_M \ \delta\left(y_M-1\right)\int_0^{y_M} dy_{M-1} \int_0^{y_{M-1}} dy_{M-2} ... \int_0^{y_{k+1}} dy_{k} ... \int_0^{y_3} dy_2 \int_0^{y_2} dy_1$$

$$= \int_0^1 dy_{M-1} \int_0^{y_{M-1}} dy_{M-2} ... \int_0^{y_{k+1}} dy_{k} ... \int_0^{y_3} dy_2 \ y_2$$

$$= \int_0^1 dy_{M-1} \int_0^{y_{M-1}} dy_{M-2} ... \int_0^{y_{k+1}} dy_{k} ... \int_0^{y_4} dy_3 \frac{y_3^2}{2}$$

and integrating step by step we have

$$\int_0^1 dy_{M-1} \int_0^{y_{M-1}} dy_{M-2} ... \int_0^{y_{k+1}} dy_k \ \frac{ y_{k}^{k-1}}{(k-1)!} = \int_0^1 dy_{M-1}\ \frac{ y_{M-1}^{M-2}}{(M-2)!} =\frac{1}{(M-1)!}$$

Therefore $$C = (M-1)!$$

and the normalized distribution is

$$P({f}) = (M-1)!\int \prod_{i=1}^M \ df_i\ \Theta(f_i) \ \delta\left(\sum_{i=1}^Mf_i-1\right)$$

Q.E.D.

The integral can be calculated using Laplace transform.

The original integral is $$I_M=\int_0^\infty\int_0^\infty \delta\left(\sum_{i=1}^M f_i - 1\right) \prod_{i=1}^M \,\mathrm{d}f_i\ .$$ Define an auxiliary integral as $$I_M(T)=\int_0^\infty\int_0^\infty \delta\left(\sum_{i=1}^M f_i - T\right) \prod_{i=1}^M \,\mathrm{d}f_i\ .$$ Clearly, $$I_M=I_M(1)$$.

Take the Laplace transform $$\hat{I}(s)=\int_0^\infty \mathrm{d}T~e^{-sT}I_M(T)=\left[\int_0^\infty\mathrm{d}f~e^{-sf}\right]^M=\frac{1}{s^M}\ ,$$ whose inverse Laplace transform is $$I_M(T)=\frac{T^{M-1}}{(M-1)!}$$ as can be verified by direct substitution. Setting $$T=1$$, we get $$I_M=\frac{1}{(M-1)!}$$.