Probability – PDF of the Difference Between Two Independent Beta Random Variables

calculusintegrationmultivariable-calculusprobabilityprobability distributions

I am having trouble deriving the distribution of the difference of two beta random variables and would like some help verifying the steps I have taken. In particular calculating the bounds.


Say I have $X_1\sim\text{Beta}(a_1,b_1)$ and $X_2\sim\text{Beta}(a_2,b_2)$, independent, and am interested in calculating the distribution of $X_1-X_2$. So here is what I have come up with so far:

Let $Z=X_1-X_2$ and $W=X_1$ where $0\leq X_i\leq 1$ for $i=1,2$. So $X_1=W$ and $X2 = W-Z$.

Likewise $\frac{dX_1}{dW}=1$, $\frac{dX_1}{dZ}=0$, $\frac{dX_2}{dW}=1$, and $\frac{dX_2}{dZ}=-1$. Then the determinant of the Jacobian would be $|J| = 0\times1 – (-1)\times1=1 $

Then we have that

\begin{align}
f_{Z,W}(z,w)
&=f_{X_1,X_2}(J_1(z,w),J_2(z,w))\times|J|\\
&=f_{X_1,X_2}(w,z-w)\\
&=f_{X_1}(w) f_{X_2}(z-w)\\
&=\text{Beta}(w;a_1,b_1)\times\text{Beta}(w-z;a_2,b_2)\\
&=\frac{(w)^{1-a_1}(1-w)^{1-b_1}}{\beta(a_1,b_1)}\times\frac{(w-z)^{1-a_2}(1-(w-z))^{1-b_2}}{\beta(a_2,b_2)}
\end{align}

From there I could integrate out $W$ from $f_{Z,W}(z,w)$ to get the quantity of interest, i.e., the distribution of $Z=X_1-X_2$.


So now this is where I am stuck. I have the following:

$$f_Z(z)=\int f_{Z,W}(z,w)dw=\int \text{Beta}(w;a_1,b_1)\times\text{Beta}(w-z;a_2,b_2) dw$$

But I do not understand how to obtain the bounds for the integral, and if the integral needs to be broken into parts or not. Let me know also if any of the above steps are incorrect.

Best Answer

We have $0<x_1<1$ and $0<x_2<1$. Since $W=X_1$ and $X_2=W-Z$, we then have $0<w<1$ and $0<w-z<1\quad\longrightarrow\quad z<w<1+z$ after transformation. It is easy to see that these are equivalent to $w>0$, $w<1$, $z<w$, and $z>w-1$. To make it more clearly, let's plot these four inequalities

enter image description here

From $w$-axis viewpoint, the region $0<w<1$ is bounded by $z=w$ and $z=w-1$. On the other hand, from $z$-axis viewpoint, the region $-1<z<0$ is bounded by $w=1+z$ and $w=0$ and the region $0<z<1$ is bounded by $w=1$ and $w=z$. Hence, If we refer to figure above, it is seen that the marginal pdf of $W$ is given by \begin{equation} f_W(w)=\left\{ \begin{array}{l} &\displaystyle\int_{w-1}^{w}f_{W,Z}(w,z)\ dz\qquad &0<w<1\\[10pt] &0\qquad &\text{elsewhere} \end{array} \right. \end{equation} In a similar manner, the marginal pdf of $Z$ is given by \begin{equation} f_Z(z)=\left\{ \begin{array}{l} &\displaystyle\int_{0}^{1+z}f_{W,Z}(w,z)\ dw\qquad &-1<z<0\\[10pt] &\displaystyle\int_{z}^{1}f_{W,Z}(w,z)\ dw\qquad &0<z<1\\[10pt] &0\qquad &\text{elsewhere} \end{array} \right. \end{equation}

Related Question