Let $n_1$ and $n_2$ be non-negative integers such that $n_1+n_2>0$.
Moreover, let $x_1 \in \{1,\ldots,n_1\}$, $x_2 \in \{1,\ldots,n_2\}$ (where we use the convention $\{1,0\}=\{0\}$) and $y \in \{1,\ldots,n_1+n_2\}$.
In this setting, how many couples of integers, $(x_1,x_2)$, exist such that $x_1+x_2=y$?
Thanks in advance for any help!
My attempt: I started to solve the simpler case where $n_1>0$, $n_2>0$ and $y<min(n_1,n_2)$. In such a case I believe that the answer is simply $y-1$ since you can choose the first number $x_1$ between $\{1,\ldots,n_1-1\}$ as you want and that implies a unique choice of $x_2$.
Let $S(y;n_1,n_2)$ be the aforementioned set of couples, the question is to find its cardinality $|S(y;n_1,n_2)|$.
Answer:
(1) Case $n_1=0$ or $n_2=0$ then $|S(y;n_1,n_2)|=1$.
(2) Case $n_1 * n_2 \ne 0$ then $|S(y;n_1,n_2)|= n_1\wedge(y-1) + n_2\wedge (y-1) -y +1$
Idea of the proof:
Case (1) is trivial, so we consider the case (2).
Notice that, without the restriction to $(n_{j})_{j=1,2}$, this is a special case of the well-known problem of the composition on $y$ in exactly two parts (with cardinalities integers $n_1$ and $n_2$). The answer in such an unconstrained case is $\binom{y-1}{J-1}$ with $J=2$. It can be proven by rethinking the problem as choosing where to put a line in $y-1$ spaces splitting $y$ boxes. In this framework, $n_1$ and $n_2$ are the numbers of boxes before and after the line, respectively, thus the previous binomial coefficient.
In our framework, whenever $n_{j}$ are less than $y-1$ we have some restrictions on the possible spaces where we can put the line. More, precisely, from the original $y-1$ spaces we delete the first and/or the last ones, that is $y-1-n_{j}$ spaces.