0
$\begingroup$

Let's say we have two independent random variables, $X$ and $Y$, whose pdfs are:

$f_X(x)=1,0 \le x \le 1$

$f_Y(y)=1,0 \le y \le 1$

Let $W=X+Y$. I understand that:

$f_W(w)=\int_{-\infty}^{\infty}f_X(x)f_Y(w-x)dx=\int_{-\infty}^{\infty}1 \cdot dx$.

How is it that when $0 \le w \le 1$, $0 \le x \le w$? (This range is used to evaluate the integral above, since the integral is over $dx$.) Moreover, when $1 \le w \le 2$, why is it that $w-1 \le x \le 1$?

  • 1
    You've only specified the pdfs over one interval. Presumably, since their integral over that interval is $1$, they are meant to be $0$ everywhere else. In that case, your last displayed equation is wrong.2011-07-15
  • 1
    @Samad, the formula for $f_W$ holds only if $X$ and $Y$ are independent. You do not state this in your question. If this is the case, please edit your question accordingly.2011-07-15
  • 0
    mpiktas: thanks, I've edited the statement above to specify independence.2011-07-15

3 Answers 3

0

Let me try:

Well, since $f_{X}(x)=1$ if $0\leq x \leq 1$ and $0$ otherwise, we must have $$f_{W}(w)=\int_{0}^{1}f_{Y}(w-x)\mathrm{d}x.$$ The above integral will be zero unless $0 \leq w-x \leq 1$ or $w-1 \leq x \leq w$. So if $0\leq w \leq 1$ we must have $0\leq x \leq w.$

Also, if $1 \lt w \leq 2$, we must have $w-1 \leq x \leq 1$.

1

A notational method often used to get rid of such errors is to mention systematically in the expression of the densities the relevant indicator function. In your case, one defines $f_X$ on $\mathbb{R}$ as $f_X=g$ with $$ g(x)=\mathbf{1}_{[0,1]}(x), $$ for every real number $x$. Note that $f_X$ and $g$ are the same function, defined on the whole real line $\mathbb{R}$. Likewise $f_Y=g$.

The following assumes that $X$ and $Y$ are independent, otherwise $W=X+Y$ can have many different densities (for example $W$ might be uniform on $[0,2]$). Then the density of $W$ is the convolution of $f_X$ and $f_Y$, as it should be, that is, $$ f_W=f_X\ast f_Y. $$ In your case, for every real number $w$, $$ f_W(w)=\int_{-\infty}^{+\infty} g(x)g(w-x)\mathrm{d}x. $$ Note that the integral is indeed over the whole real line $\mathbb{R}$ and that the formula holds for every real number $w$.

Without any further head-scratching about $w$ or $x$ being in this interval or that interval, one finds the correct density $f_W$, which, following the same logic, is defined on $\mathbb{R}$ and should be written as $$ f_W(w)=w\mathbf{1}_{[0,1]}(w)+(2-w)\mathbf{1}_{[1,2]}(w). $$ The details of the computation are $$ f_W(w)=\int_{-\infty}^{+\infty}\mathbf{1}_{[0,1]}(x)\mathbf{1}_{[0,1]}(w-x) \mathrm{d}x=\int_{-\infty}^{+\infty}\mathbf{1}_{[0,1]}(x)\mathbf{1}_{[w-1,w]}(x) \mathrm{d}x, $$ hence $f_W(w)$ is the length of the interval $[0,1]\cap[w-1,w]$, which is zero if $w\le0$ or $w\ge2$ and as written above if $0\le w\le 2$.

  • 0
    The OP does not say that $X$ and $Y$ are independent. The density of the sum is the convolution of the densities, when the summands are independent.2011-07-15
  • 0
    @mpiktas: True. Thanks, I modified my post.2011-07-15
  • 0
    Didier: est-ce que vous pouvez expliquer pour quoi quand $w$ est entre $[0,1]$, $x$ est entre $[0,w]$, et quand $w$ est entre $[1,2]$, $x$ est entre $[w-1, 1]$ ? Ça c'est le coeur de ma question. Je crois que vous avez glissé sur ce point.2011-07-15
  • 0
    @Samad (Bravo pour votre français.) One does not need to know between what and what $x$ is. What I wrote proves that $f_W(w)$ is the length of the interval $I(w)=[0,1]\cap[w−1,w]$ for every $w$ (no more $x$ here). Now, if $w$ is in $[0,1]$, $w-1\le 0\le w\le 1$ hence $I(w)=[0,w]$, whose length is $w$. Likewise, if $w$ is in $[1,2]$, $0\le w-1\le 1\le w$ hence $I(w)=[w-1,1]$, whose length is $2-w$. .../...2011-07-15
  • 0
    .../... If you insist on not using that the integral defining $f_W(w)$ is the length of the interval $I(w)$, what I wrote proves that the integral one considers goes from $0$ to $w$ in the first case and from $w-1$ to $1$ in the second case. Hope this helps.2011-07-15
1

If $X$ and $Y$ are uniform$[0,1]$ random variables, then $$ f_X (x) = 1 \; {\rm if} \; 0 \leq x \leq 1, \; {\rm and} \; f_X (x) = 0 \;\; {\rm otherwise}, $$ and $$ f_Y (y) = 1 \; {\rm if} \; 0 \leq y \leq 1, \; {\rm and} \; f_Y (y) = 0 \;\; {\rm otherwise}. $$ If $X$ and $Y$ are moreover independent, then the pdf of their sum $W = X + Y$ is given by the convolution of the respective pdfs, namely $$ f_W (w) = (f_X * f_Y)(w) := \int_{ - \infty }^\infty {f_X (x)f_Y (w - x)\,dx} , \;\; w \in \mathbb{R}, $$ where $*$ denotes convolution. From the definition of $f_X$ it thus follows that $$ f_W (w) = \int_{0}^1 {f_X (x)f_Y (w - x)\,dx} = \int_0^1 {f_Y (w - x)\,dx}, \;\; w \in \mathbb{R}. $$ Let's now split into the four cases $w \leq 0$, $0 < w \leq 1$, $1 < w \leq 2$, and $w > 2$. For the first case, $w \leq 0$, note that $w - x < 0$ for any $0 < x < 1$. Hence, by the definition of $f_Y$, $f_Y (w-x) = 0$ for any $0 < x < 1$, from which it follows that $$ f_W (w) = \int_0^1 {0 \,dx} = 0, \;\; w \leq 0. $$ For the second case, $0 < w \leq 1$, first fix $0 < x < 1$. Next note that $0 \leq w - x \leq 1$ if $x \leq w$, and $w - x < 0$ if $x > w$. From the definition of $f_Y$ it thus follows that $$ \int_0^1 {f_Y (w - x)\,dx} = \int_0^w {f_Y (w - x)\,dx} + \int_w^1 {f_Y (w - x)\,dx} = \int_0^w {1\,dx} + \int_w^1 {0\,dx} = w. $$ Hence $$ f_W (w) = w, \;\; 0 < w \leq 1. $$ For the third case, $1 < w \leq 2$, first fix $0 < x < 1$. On the one hand, $w - x \geq 0$. On the other hand, $w -x \leq 1$ if and only if $x \geq w-1$. From the definition of $f_Y$ it thus follows that $$ \int_0^1 {f_Y (w - x)\,dx} = \int_0^{w-1} {f_Y (w - x)\,dx} + \int_{w-1}^1 {f_Y (w - x)\,dx} = \int_0^{w-1} {0\,dx} + \int_{w-1}^1 {1\,dx} = 2 - w. $$ Hence $$ f_W (w) = 2 - w, \;\; 1 < w \leq 2. $$ For the last case, $w > 2$, note that $w - x > 1$ for any $0 < x < 1$. Hence, by the definition of $f_Y$, $f_Y (w-x) = 0$ for any $0 < x < 1$, from which it follows that $$ f_W (w) = \int_0^1 {0 \,dx} = 0, \;\; 1 < w \leq 2. $$ To summarize, the pdf of $W=X+Y$ is given by $$ f_W (w) = w \;\; {\rm if} \;\; 0 \leq w \leq 1, $$ $$ f_W (w) = 2-w \;\; {\rm if} \;\; 1 < w \leq 2, $$ and $$ f_W (w) = 0 \;\; {\rm otherwise}. $$ Note that $f_W$ is a continuous pdf, and that $$ \int_{ - \infty }^\infty {f_W (w)\,dw} = \int_0^1 {w\,dw} + \int_1^2 {(2 - w)\,dw} = \frac{1}{2} + \frac{1}{2} = 1. $$ Further note that it is a priori clear from the definition of $W$ that $f_W (w) = 0$ for $w \notin [0,2]$.