Given

X∼Beta(α,β) (where α=β, if that helps) and

θ∼Uniform(0,π/2).

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

Y=X+(1−2X)cos(θ)

on the domain (0,1).

I know from here that given C=cos(θ), its PDF is

P(C)=2π√1−C2

and of course the pdf of a beta distribution is

P(X)=Xα−1(1−X)β−1Beta(α,β).

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.

**Answer**

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

supp(Y|X=x)={[x,1−x]for 0⩽

(We can ignore the case where 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}

Inverting the support we have \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}

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

**Attribution***Source : Link , Question Author : Daniel F , Answer Author : Ben*