# Impossible counterexample to Leibniz integration rule

I am greatly confused about the Leibniz integral rule for probability densities. If $$f_X$$ is a valid univariate probability distribution parametrized by $$\boldsymbol \theta=\{\theta_1,...,\theta_k\}$$, then we should have $$\int_\mathbb{R} f_X(x|\boldsymbol \theta) dx = 1$$ since this is a fundamental property of probability densities. Generally speaking, the value of this integral should not depend on $$\boldsymbol \theta$$ (assuming the density is defined for all possibles values $$\boldsymbol \theta$$ can take). So, it seems reasonable that $$\frac{d}{d \theta} \int_\mathbb{R} f_X(x|\boldsymbol \theta) dx=0$$ for all $$\theta\in\boldsymbol\theta$$. However, if I use the Leibniz integral rule, I get the strange result that $$\frac{d}{d \theta} \int_\mathbb{R} f_X(x|\boldsymbol \theta) dx= \int_\mathbb{R} \frac{\partial}{\partial \theta} f_X(x|\boldsymbol \theta) dx\neq0$$ since the derivative $$\frac{\partial}{\partial\theta}f_X(x|\boldsymbol\theta)$$ is not $$0$$ if $$\theta$$ is a proper parameter of $$f_X$$.

Where did I make a mistake? I think that all necessary assumptions for the Leibniz rule should be fulfilled, given that we are in a measurable probability space.

• Did you try a concrete example? Sep 2, 2022 at 10:21
• You are not guaranteed that $\frac{\partial}{\partial\theta}f_X(x\mid \boldsymbol\theta)$ exists for all $x$: consider a uniform distribution on $[0,\theta]$ for $\theta>0$ and what happens to the partial derivative at $x=\theta$. If it does exist for all $x$, the partial derivative will sometimes be positive and sometimes negative - how do you know it does not integrate to $0$? Sep 2, 2022 at 10:47
• @Henry Oh, that's it. I forgot to consider that the derivative can be negative. Cheers. Sep 2, 2022 at 10:50

You are not guaranteed that $$\frac{\partial}{\partial\theta}f_X(x\mid \boldsymbol\theta)$$ exists for all $$x$$: consider a uniform distribution on $$[0,θ]$$ for $$θ>0$$ and what happens to the partial derivative at $$x=θ$$.
If it does exist for all $$x$$, the partial derivative will sometimes be positive and sometimes negative - how do you know it does not integrate to $$0$$?