# Combined distribution of beta and uniform variables

Given

(where $\alpha=\beta$, if that helps) and

I’m trying to find a formula for $P(Y)$ (or even the cdf) of

on the domain $(0,1)$.

I know from here that given $C = \cos(\theta),$ its PDF is

and of course the pdf of a beta distribution is

But combining them is getting beyond my skills as an engineer.

EDIT: As it seems a closed form is not possible for this, could someone please show me how to formulate the integral to calculate this sort of PDF? There may be some way I can reformulate the problem to be more solution-friendly if I could wrap my head around how compound distributions of this type are built mathematically.

There is no closed form for the density. Its integral form can be obtained as follows. If we condition on $$X=xX=x$$ we have $$Y=x+(1−2x)CY = x + (1-2x) C$$ where $$CC$$ ranges over the unit interval. The support under this condition is:

$$supp(Y|X=x)={[x,1−x]for 0⩽\text{supp}(Y|X=x) = \begin{cases} [x,1-x] & & & \text{for } 0 \leqslant x < \tfrac{1}{2}, \\[6pt] [1-x,x] & & & \text{for } \tfrac{1}{2} < x \leqslant 1. \\[6pt] \end{cases}$$

(We can ignore the case where $$x=\tfrac{1}{2}x=\tfrac{1}{2}$$ since this occurs with probability zero.) Over this support we have the conditional density:

\begin{aligned} p_{Y|X}(y|x) &= \frac{1}{|1-2x|} \cdot p_C \bigg( \frac{y-x}{1-2x} \bigg) \\[6pt] &= \frac{1}{|1-2x|} \cdot \frac{2}{\pi} \bigg( 1 - \bigg( \frac{y-x}{1-2x} \bigg)^2 \bigg)^{-1/2} \\[6pt] &= \frac{1}{|1-2x|} \cdot \frac{2}{\pi} \bigg( \frac{(1-2x)^2 - (y-x)^2}{(1-2x)^2} \bigg)^{-1/2} \\[6pt] &= \frac{1}{|1-2x|} \cdot \frac{2}{\pi} \bigg( \frac{(1-4x+4x^2) - (y^2-2xy+x^2)}{(1-2x)^2} \bigg)^{-1/2} \\[6pt] &= \frac{1}{|1-2x|} \cdot \frac{2}{\pi} \bigg( \frac{1 - 4x + 3x^2 + 2xy - y^2}{(1-2x)^2} \bigg)^{-1/2} \\[6pt] &= \frac{1}{|1-2x|} \cdot \frac{2}{\pi} \cdot \frac{|1-2x|}{\sqrt{1 - 4x + 3x^2 + 2xy - y^2}} \\[6pt] &= \frac{2}{\pi} \cdot \frac{1}{\sqrt{1 - 4x + 3x^2 + 2xy - y^2}}. \\[6pt] \end{aligned}\begin{aligned} p_{Y|X}(y|x) &= \frac{1}{|1-2x|} \cdot p_C \bigg( \frac{y-x}{1-2x} \bigg) \\[6pt] &= \frac{1}{|1-2x|} \cdot \frac{2}{\pi} \bigg( 1 - \bigg( \frac{y-x}{1-2x} \bigg)^2 \bigg)^{-1/2} \\[6pt] &= \frac{1}{|1-2x|} \cdot \frac{2}{\pi} \bigg( \frac{(1-2x)^2 - (y-x)^2}{(1-2x)^2} \bigg)^{-1/2} \\[6pt] &= \frac{1}{|1-2x|} \cdot \frac{2}{\pi} \bigg( \frac{(1-4x+4x^2) - (y^2-2xy+x^2)}{(1-2x)^2} \bigg)^{-1/2} \\[6pt] &= \frac{1}{|1-2x|} \cdot \frac{2}{\pi} \bigg( \frac{1 - 4x + 3x^2 + 2xy - y^2}{(1-2x)^2} \bigg)^{-1/2} \\[6pt] &= \frac{1}{|1-2x|} \cdot \frac{2}{\pi} \cdot \frac{|1-2x|}{\sqrt{1 - 4x + 3x^2 + 2xy - y^2}} \\[6pt] &= \frac{2}{\pi} \cdot \frac{1}{\sqrt{1 - 4x + 3x^2 + 2xy - y^2}}. \\[6pt] \end{aligned}

Inverting the support we have $$\text{supp}(X|Y=y) = [0,\min(y,1-y)] \cap [\max(y,1-y),1]\text{supp}(X|Y=y) = [0,\min(y,1-y)] \cap [\max(y,1-y),1]$$. Thus, applying the law of total probability then gives you:

\begin{aligned} p_Y(y) &= \int \limits_0^1 p_{Y|X}(y|x) p_X(x) \ dx \\[6pt] &= \int \limits_0^{\min(y,1-y)} p_{Y|X}(y|x) p_X(x) \ dx + \int \limits_{\max(y,1-y)}^1 p_{Y|X}(y|x) p_X(x) \ dx \\[6pt] &= \frac{2}{\pi} \frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha) \Gamma(\beta)} \Bigg[ \quad \int \limits_0^{\min(y,1-y)} \frac{x^{\alpha-1} (1-x)^{\beta-1}}{\sqrt{1 - 4x + 3x^2 + 2xy - y^2}} \ dx \\ &\quad \quad \quad \quad \quad \quad \quad \quad + \int \limits_{\max(y,1-y)}^1 \frac{x^{\alpha-1} (1-x)^{\beta-1}}{\sqrt{1 - 4x + 3x^2 + 2xy - y^2}} \ dx \Bigg]. \\[6pt] \end{aligned}\begin{aligned} p_Y(y) &= \int \limits_0^1 p_{Y|X}(y|x) p_X(x) \ dx \\[6pt] &= \int \limits_0^{\min(y,1-y)} p_{Y|X}(y|x) p_X(x) \ dx + \int \limits_{\max(y,1-y)}^1 p_{Y|X}(y|x) p_X(x) \ dx \\[6pt] &= \frac{2}{\pi} \frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha) \Gamma(\beta)} \Bigg[ \quad \int \limits_0^{\min(y,1-y)} \frac{x^{\alpha-1} (1-x)^{\beta-1}}{\sqrt{1 - 4x + 3x^2 + 2xy - y^2}} \ dx \\ &\quad \quad \quad \quad \quad \quad \quad \quad + \int \limits_{\max(y,1-y)}^1 \frac{x^{\alpha-1} (1-x)^{\beta-1}}{\sqrt{1 - 4x + 3x^2 + 2xy - y^2}} \ dx \Bigg]. \\[6pt] \end{aligned}

There is no closed form for this integral so it must be evaluated using numerical methods.