# How do I calculate the probability density function for a joint beta + uniform distribution?

The PDF of a Beta distribution is $$f_X(x) = {{x^{a-1}(1-x)^{b-1}}\over {B(a,b)}}$$ and CDF $$F_X(x) = I_x(a,b)$$

The PDF of a uniform distribution is $$f_Y(y) = {1 \over {b-a}} \space for \space x \in [a,b]$$ and CDF $${ x - a} \over {b - a}$$

I've know that if X and Y are two independent, continuous random variables, described by probability density functions above of $$f_X(x)$$ and $$f_Y(x)$$ then probability density function of $$Z = XY$$ is $$f_Z(z) = \int_\infty^\infty f_X(x)f_Y({z\over x}){1\over abs(x)}dx$$ but I'm struggling with the algebra to get from this to the PDF and the CDF of the joint distribution. I'm using the uniform distribution between 0 and 1.

• Is the mod(x) in your equation supposed to be abs(x)? Feb 4, 2021 at 13:43
• yes - sorry I've amended Feb 4, 2021 at 14:58
• Although your question is unclear--you never specify what the distributions of $X$ and $Y$ are--the title suggests they are both Beta distributions, indicating the duplicate thread provides an answer.
– whuber
Feb 4, 2021 at 15:31
• sorry - amended to make clear that i'm looking for the joint PDF and CDF of a uniform distribution and a beta distribution Feb 4, 2021 at 15:48
• Because the duplicate at stats.stackexchange.com/questions/3359/… has no explicit answers and because the uniform distribution (which is a Beta(1,1) distribution) is special, conceivably a simple, effective answer could be provided in this special case, so I have voted to reopen this question.
– whuber
Feb 5, 2021 at 15:59

The density of a $$B(a,b)$$ variable $$X$$ is $$f(x,a,b) = \frac{1}{B(a,b)}x^{a-1}(1-x)^{b-1}$$

for $$0\le x\le 1.$$ Let $$F(x,a,b)$$ be its distribution function

$$F(x,a,b) = \int_{-\infty}^x f(x,a,b)\,\mathrm{d}x = \int_0^x f(x,a,b)\,\mathrm{d}x,$$

so that (as usual) $$\frac{d}{dx} F(x,a,b) = f(x,a,b).$$

When $$U$$ is a uniform variable on $$[0,1]$$ and $$0\le z\le 1,$$ $$\Pr(U\le z) = z.$$ Otherwise, when $$z\gt 1,$$ $$\Pr(U\le z)=1.$$ These (defining) formulas can be expressed as

$$\Pr(U\le z) = z\wedge 1$$

(the smaller of $$z$$ and $$1$$), provided $$z\ge 0.$$

To evaluate the distribution of $$UX$$ (where $$U$$ and $$X$$ are independent), note it's certain that $$0\le UX \le 1.$$ So let $$z$$ be in this range and, assuming $$a\gt 1,$$ compute

\begin{aligned} F_{UX}(z) &= \Pr(UX\le z) = \Pr\left(U\le \frac{z}{X}\right) = E\left[\frac{z}{X}\wedge 1\right]\\ &= \frac{1}{B(a,b)}\int_z^1 \frac{z}{x} x^{a-1}(1-x)^{b-1}\,\mathrm{d}x + \int_0^z (1)f(x,a,b)\,\mathrm{d}x\\ &= \frac{z B(a-1,b)}{B(a,b)} (1-F(z,a-1,b)) + F(z,a,b)\\ &= \frac{z (a+b-1)}{a-1} (1-F(z,a-1,b)) + F(z,a,b). \end{aligned}

That determines the CDF of $$UX$$ (by definition). To obtain its PDF, differentiate with respect to $$z,$$ giving

$$f_{UX}(z) = \frac{d}{dz}F_{UX}(z) = \frac{a+b-1}{a-1}\left(1 - F(z,a-1,b) - z f(z,a-1,b)\right) + f(z,a,b).$$

Here are the results of four separate simulations of one million values of $$UX$$ for various values of $$(a,b):$$

The red curves plot $$f_{UX}:$$ they agree perfectly with the simulations.

Since this question appears to be for educational purposes, I leave the evaluation of the case $$0\lt a \le 1,$$ should that be of interest, as an exercise. Note that even in this case $$UX$$ exists, and there is no problem evaluating integrals from $$z$$ to $$1$$ even when the exponent of $$x$$ (equal to $$a-2$$ in the formula) is less than $$-1;$$ however, such integrals do not correspond to Beta distributions and need to be expressed in terms of the Incomplete Beta function.