Q:

how many solutions to the equation $\vert x_1\vert+x_2+x_3 = 16$

How many solutions to the equation $\vert x_1\vert +x_2+x_3 = 16 .$
we also know that $x_1 \in\mathbb Z$ and $x_2,x_3 \in\mathbb N$ .
in our class, $0 \in\mathbb N$ .
the answer in the textbook is : 17+ $2 \cdot{17\choose 2}$.
Thank you!!

A:

Assuming $0 \in \mathbb{N}$, we can find the number of solutions for $x_1+x_2+x_3 = 16$, say $A$, with $x_1,x_2,x_3 \ge 0$ and multiply them by $2$ (in order to count the solutions with negative values of $x_1$) and subtract the number of solutions for $x_1 = 0$, say $B$. (since we will be counting them twice). Long story short, we are seeking $2A-B$.
In order to find $A$ and $B$, we can make an analogy such that $A$ is the number of ways of putting $16$ balls to $3$ boxes without any restriction and $B$ is the number of ways of putting $16$ balls to $2$ boxes without any restriction. In order to find these numbers, we can use stars and bars or binary number representation. For example, if we put $1$ ball to $x_1$, $1$ ball to $x_2$ and $14$ balls to $x_3$, corresponding binary representation is $01010000000000000000$. So, total number of ways $A$ is the number of binary representations containing two $1$'s and sixteen $0$'s, which is $\binom{18}{2} = 153$. By similar logic, we can find $B$ as, $B = \binom{17}{1} = 17$. So the asnwer is $2A-B = 2 \cdot 153-17 = 289$.

