Let $X,Y \sim \mathcal{U}([0,a])$ be independent identically continuously uniform distributed real random variables. Find the PDF of $Z := X + Y$.
I know that this can be accomplished via convolution: For $x \in \mathbb{R}$ we have \begin{align*} \int_{\mathbb{R}} f_{X}(x - y) f_{Y}(y) \ \text{dy} & = \frac{1}{(a - 0)^2} \int_{\mathbb{R}} 1_{[0,a]}(x - y) \cdot 1_{[0,a]}(y) \ \text{dy} \\ & = \frac{1}{a^2} \int_{0}^{a} 1 \ \text{dy} \cdot 1_{[0,2a]}(x) = \frac{1_{[0,2a]}(x)}{a}. \end{align*} I obtained the bounds like this. From the second integral in the first line we have $$ 0 \le x - y \le a \qquad \text{and} \qquad 0 \le y \le a. $$ Adding both inequalities yields $y \le x + y \le 2a + y$ or $$ 0 \le x \le 2 a. $$ Therefore $x < a$ and the bounded on the dy-integral are [0, a] and furthermore we know that $x \in [0,2a]$.
Is this (result and procedure) correct and / or is there an easier way to do this?
In this task I faced a similar challenge: Let $X,Y \sim \text{Exp}(\lambda)$ for some $\lambda > 0$ be independent and identically distributed. Find the density of $X + Y$.
\begin{align*} (f_{X} \ast f_{Y})(x) & = \int_{\mathbb{R}} f_{X}(x - y) f_{Y}(y) \ \text{dy} \\ & = \int_{\mathbb{R}} \lambda e^{-\lambda (x - y)} 1_{[0, \infty)}(x - y) \cdot \lambda e^{-\lambda y} 1_{[0, \infty)}(y) \ \text{dy} \\ & = \lambda^2 \int_{0}^{x} e^{-\lambda (x - y)} \cdot e^{-\lambda y} \ \text{dy} \cdot 1_{[0, \infty)}(x) = \lambda^2 \int_{0}^{x} e^{-\lambda x} \ \text{dy} \cdot 1_{[0, \infty)}(x) \\ & = \lambda^2 x \cdot e^{-\lambda x} \cdot 1_{[0, \infty)}(x). \end{align*}
Here the same question as above applies.
First part (uniform). If you want to use the CDF method to find $P(Z \le z)$ by integration, the following plots (made from a simulation), may help you find the limits on integrals. I used $a = 2.$
The left-hand plot shows the region of integration for $P(Z \le 1.5).$ For values of $z$ above $2$ it seems easiest to break the integral into two parts. [However, because the joint distribution is uniform, this can be a high school geometry/algebra problem, if you like.]
The middle plot shows the empirical CDF (jump of $1/10^5$ at each of $10^5$ simulated values of $Z),$ which suggests the form of the CDF you'll get.
The right-hand plot shows a histogram of $10^5$ simulated values of $Z.$ [A discrete analogue of this is the 'triangular' PDF from the sum upon rolling two fair dice.]
Second part (exponential). If you know about moment generating functions, that's probably the easiest way to show that the sum of two independent exponential random variables, each with rate $\lambda$ is $\mathsf{Gamma}(\text{shape}=2,\text{rate}=\lambda).$ However, the PDF and convolution methods also work. [Perhaps see Wikipedia on gamma distributions to check your answer.]
Another simulation to indicate the result:
Notes: (a) This exponential relationship is much used in applications, including queueing theory. [Q. A person is next in line for a bank teller whose service times are exponential with rate one every five minutes, what is the probability that person finishes being served within 8 minutes? A. In R, code
pgamma(8, 2, 1/5)returns 0.4750691.](b) If the two exponential random variables have different rates, the problem is very much messier. (If interested, perhaps google 'sum of exponentials different rates'.)
(c) In case you want it, the R code for making the figure is provided below: