Addition of $2$ Events 
Let $X$ and $Y$ be independent, each uniformly distributed on $\{1, 2, ..., n\}$. Find $P(X + Y = k)$ for $2 \le k \le 2n$.

\begin{align}P(X + Y = k) &= \sum_{(x,y)\,:\,x+y=k} P(x, y) \\
&= \sum_{(x,y)\,:\,x+y=k} \frac{1}{n^2} \\
&= (k - 1)\frac{1}{n^2}  \\
&= \frac{k-1}{n^2} \end{align}
When $k = 2: (1, 1)$
When $k = 3: (1, 2), (2, 1)$
When $k = 4: (1, 3), (3, 1), (2, 2)$
When $k = 5: (1, 4), (4, 1), (2, 3), (3, 2)$
$$\#(x, y) = k - 1$$
Textbook Answer: 

$\frac{k-1}{n^2}\,\,\,$ for $\,\,\,2 \le k \le n+1$
$\frac{2n-k+1}{n^2}\,\,\,$ for $\,\,\,n+2 \le k \le 2n$

Why are there $2$ intervals being considered?

The first formula fails to find the probability after $n+1$, because:
When $n=2$, the sample space is: $(1,1),(1,2),(2,1),(2,2)$, while $2\le k \le 4$ and 
$$k=2: (1,1); k=3: (1,2),(2,1); k=4: (2,2)$$
Note that when $k=4$, we are ignoring $(1,3),(3,1)$, because they are not in the sample space. So the two formulas must be applied: one until the middle, another after it.
