# PDF of dependent variables

In my recent question an answer was given, and I am able to compute it myself. Still, I'd like to understand where does that answer come from. Hence, what's the approach to handle dependent variables in order to get a PDF? Specifically, $X,Y$ are iid uniform[0,1] RVs, and $W$'s PDF is $f_W(w)=-\frac{1}{4}\ln\frac{w}{4}$, $w\in(0,1]$. I want (preferably, using pen and paper) to calculate the PDF of $Z=X+Y+\sqrt{(X-Y)^2+W}$. The PDFs of $A=X+Y$ and $B=\sqrt{(X-Y)^2+W}$ (separately) are known. How do I find the PDF of $Z$?

As the answer obtained via Mathematica/mathStatica is (piecewise) given by elementary functions, I'd expect $Z$'s PDF to be possible to calculate analytically (the software does it somehow, so a human should be able to do it as well). I browsed the web in search for theory of dependent RVs or anything related, but couldn't find anything useful (i.e., anything I'd be able to comprehend). Any help in providing hints, sketching the solution or specifically pointing to any relevant source (publication, textbook, etc.) will be appreciated.

EDIT Is it possible to find conditional probability $Pr(A|B)$ (or $Pr(B|A)$), given the (marginal) distributions of $A$ and $B$? Then the joint probability would be $Pr(A,B)=Pr(A|B)\cdot Pr(B)$. Or not?

This can be a general question if there exists a general answer, i.e., given $f_X(x)$, $f_Y(y)$ and $f_W(w)$, how to find $f_Z(z)$ when $Z=G(X,Y,g(X,Y,W))$.

If there's an approach that exploits particular forms of the functions $G$ and $g$ (from the first paragraphs of this question), I'd be happy to know it.

• Are you asking a general question -- how to compute the density of a transformation of dependent variables (where the joint distribution is presumably completely specified)? You seem to waver between asking a general question and a specific one. – Glen_b -Reinstate Monica Apr 6 '15 at 2:10
• You do not add pdfs, nor can you find the pdf of $A+B$ knowing only the (marginal) pdfs of $A$ and $B$: you need the joint pdf or the credulity to believe that $A$ and $B$ are independent. For example, I would be very skeptical of unsupported claims that $X+Y$ and $\sqrt{(X-Y)^2+W}$ are independent random variables but your imagination might be running wild... That being said, the pdf of $A+B$ is $$f_{A+B}(z)=\int_{-\infty}^\infty f_{A,B}(x,z-x)\,\mathrm dx=\int_{-\infty}^\infty f_{A,B}(z-y,y)\,\mathrm dy$$ which gives the convolution formula when $A$ and $B$ are independent. – Dilip Sarwate Apr 6 '15 at 3:03
• Gleb_b: in fact, both; I have no idea what to start with because my lack of knowledge in this field. To focus attention and further explain what I really want, I ask a specific question. Dilip Sarwate: they are not independent, which imho is visible straightforward, but I also made a simulation and the PDF obtained assuming independence is quite different from the correct one. The formula you give is general and known, but how do I get the joint PDF of $A$ and $B$? – corey979 Apr 6 '15 at 7:54
• One cannot get the joint pdf from the marginal pdfs alone; there is a standard method for computing the joint pdf of $W=g(X,Y)$ and $Z=h(X,Y)$ which involves partial derivatives and Jacobians etc., and it is, in many interesting cases, fairly tedious to apply. Symbolic computation packages such as Mathematica, Maple, and perhaps R and MathStatica often are used in such cases (see e.g. wolfie's answer to your other question. – Dilip Sarwate Apr 7 '15 at 23:11
• Dilip Sarwate, I know that and know how to deal with this kind of simple situations. And the convolution formula from your previous comment is a tool I used extensively with previous calculations in this topic. I'm really curious how to get the answer in this particular situation with overt approach, not symbolic computations; as Mathematica can give an analytic answer, I strongly believe it's possible to obtain it without a computer. I don't only want to know the answer, I want to know also where does it come from. – corey979 Apr 7 '15 at 23:35

Let $X=A+D+\sqrt{(A-D)^2+U}$ with $Y=A+D$ and $Z=(A-D)^2$; hence $A=\frac{Y+\sqrt{Z}}{2}$, $D=\frac{Y-\sqrt{Z}}{2}$ and $U=(X-Y)^2-Z$, with a Jacobian $|J|=\left|\frac{y-x}{2\sqrt{z}}\right|$. Then, the PDF of $X$ is $$f_X(x)=-\frac{1}{4}\int\limits_{-\infty}^{\infty}\int\limits_{-\infty}^{\infty}f_A\left(\frac{y+\sqrt{z}}{2}\right)\cdot f_D\left(\frac{y-\sqrt{z}}{2}\right)\cdot\ln\frac{(x-y)^2-z}{4}\cdot\left|\frac{y-x}{2\sqrt{z}}\right|dydz,$$ where $f_A$ and $f_D$ are equal to 1 if their argument is in $[0,1]$ and equals 0 otherwise, and $-\frac{1}{4}\ln\frac{*}{4}$ is the PDF of $U$, with $*\in(0,4]$. The integration region is given by the inequalities $$0\leq y+\sqrt{z}\leq 2$$ $$0\leq y-\sqrt{z}\leq 2$$ $$0<(x-y)^2-z\leq 4$$ with $x\in[0,4]$, $y\in[0,2]$ and $z\in[0,1]$. The integration region is additionaly split by $x=y$, as at this surface the Jacobian changes its sign and in the formula for $f_X(x)$ we have its module.
Can someone verify whether my reasoning and the formula for $f_X(x)$ are correct? And the last sentence about splitting the integral by the Jacobian.