# Joint distribution between sum and a component of its sum

Let $X$ and $N$ be independent uniform random variables on $[0,1]$. Define, $$Y=X+N$$

I am interested in computing the joint distribution $P_{XY}$.

I have the following tried from my side.

$$P_{XY}(x,y)=P_{X}P_{Y|X}(x,y)=P_{Y|X}(x,y)=P_{N}(y-x)$$

Then, $P_{XY}(x,y)=1$ for $(x,y)\in S:=\{ (x,y): y\ge x, y \le 1+x \}$, defines the distribution. But I see that, $$\iint_S P_{XY}= \frac{1}{2} \neq 1$$

Where am I wrong?

Thank you

• Why 1/2? The area of $S$ is 1. Draw a picture and you'll see it. Commented Nov 17, 2016 at 15:15
• Ah!, it is the sum of two triangles each with area $1/2$. Thanks! Commented Nov 17, 2016 at 15:21

Assume now that $$x\in [0,1]$$ and $$y\in [0,2]$$.

$$P(X\le x,Y \le y) = P(X\le x,X+N \le y)=\int_0^1 P(X\le x,X\le y -n\mid N=n) \, dn.$$

By independence, the conditional probability on RHS is equal to

$$P(X\le x,X \le y-n) = P(X\le \min (x,y-n)) = \max(\min (x,y-n),0).$$

Therefore

$$P(X\le x,Y \le y) = \int_0^1 \max (\min (x,y-n),0)) d n.$$

Then $$\min (x,y-n)>0$$ if and only if $$y-n>0$$, that is if and only if $$n. Therefore we have

$$(*)\quad P(X\le x,Y\le y) = \int_0^y \min(x,y-n) \, dn.$$

If $$y, the integral is $$\int_0^y (y-n) \, dn = y^2/2$$, while if $$y>x$$, then the integral is equal to $$\int_0^{y-x} x \, dn +\int_{y-x}^y (y-n) \, dn=(y-x)x + x^2/2=x (y-x/2).$$

Therefore joint CDF is

$$P(X\le x,Y\le y) = \min(x,y)(y- \min(x,y)/2).$$

Edit (08/24/20). There's an error in $$(*)$$. It should be

$$P(X\le x,Y\le y) = \int_0^{\min(1,y)} \min(x,y-n) dn.$$

• Thank you for your answer. There is an issue with the final calculation as for x=1 and y=2 the expression is equal to 3/2... Commented Aug 23, 2020 at 14:03
• Thanks! Indeed, there was an error. Now corrected. Commented Aug 24, 2020 at 23:51

Quick question...

Why can't we just say that $$Y|X=x\sim U[x,x+1]$$ for $$x\in[0,1]$$ fixed and immediately conclude $$f_{XY}(x,y)=f_{Y|X=x}(y|x)f_X(x)=1$$ whenever $$0\leq x\leq y\leq x+1 \leq 2$$ and $$f_{XY}(x,y)=0$$ elsewhere, just as was suggested in the original post?

$$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$$ \begin{align} &\bbox[5px,#ffd]{\int_{0}^{1}\int_{0}^{1}\bracks{y = x + n}\dd x\,\dd n} = \int_{0}^{1}\int_{0}^{1}\bracks{x = y - n}\dd x\,\dd n \\[5mm] = &\ \int_{0}^{1}\bracks{0 \leq y - n \leq 1}\dd n = \int_{0}^{1}\bracks{y - 1 \leq n \leq y}\dd n \\[5mm] = &\ \bracks{0 \leq y \leq 1}\int_{0}^{y}\dd n + \bracks{0 < y - 1 \leq 1}\int_{y - 1}^{1}\dd n \\[5mm] = &\ \bbx{\bracks{0 \leq y \leq 1}\color{red}{y} + \bracks{1 < y \leq 2}\color{red}{\pars{2 - y}}} \\ &\ \end{align}