How many solutions are there to the equation
$$|x_{1}|+|x_{2}|+\cdots +|x_{k}|=n$$
for $n,k\in \mathbb N$ and $\forall\ 1\leq i\leq k,\ x_{i}\in \mathbb Z$?
Any ideas? I don't know how to approach this question. (all I know that if my $ x_{i}$'s were in $\mathbb N$ the solution would be $\binom{n+k-1}{k-1}$ )
It is a simple variation on stars and bars. The number of solutions of $$ x_1+x_2+\ldots+x_k = n $$ with $x_i\in\mathbb{N}^+$ is given by the coefficient of $x^n$ in $\left(\frac{x}{1-x}\right)^k$, i.e. by $\binom{n-1}{k-1}$, so the number of solutions of $$\left|x_1\right|+\ldots +\left|x_k\right| = n$$
with $x_i\in\mathbb{Z}\setminus\{0\}$ is given by $2^k\binom{n-1}{k-1}$. If we take the number of zero variables as a parameter, we get that the number of solutions of $$ \left|x_1\right|+\ldots +\left|x_k\right| = n $$ with $x_i\in\mathbb{Z}$ is given by:
The connection with the GFs found by Felix and Semiclassical lies here: $$\begin{eqnarray*}\sum_{h=0}^{k}\binom{k}{h}2^h [x^{n-h}]\left(\frac{x}{1-x}\right)^h &=& \sum_{h=0}^{k}\binom{k}{h}[x^n]\left(\frac{2x}{1-x}\right)^h\\&=&[x^n]\left(1+\frac{2x}{1-x}\right)^k\\&=&[x^n]\left(\frac{1+x}{1-x}\right)^k.\end{eqnarray*}$$