Problem How to count the number of distinct integer solutions $(x_1,x_2,\dots,x_n)$ of the equations like :
$$|x_1| + |x_2| + \cdots + |x_n| = d $$
the count gives the number of coordinate points in the $n$-dimensional space which are at distance equal to $d$ [a non-negative-integer] from the origin [ where we are only allowed to move along the grid lines ]. That is distance between $2$ points $x$ and $y$ is defined as $|x_1-y_1|+\dots +|x_n-y_n|$.
I know how to calculate for non-negative solutions for the equation :
$$x_1 + x_2 + \dots+ x_n = d $$
which is$^{n+d-1}C_{n-1}$, i.e. $x_i \geq 0$ but in the new problem we have upper and lower bounds as well i.e. $x_n\in [-d,d]$.
I don't know that there is any formula for this or not ?
Also I want to know the number of distinct solutions for the equation for large $n$ efficiently :
$$|x_1| + |x_2| + \dots + |x_n| \leq d.$$
Thank you in advance.
Hint. Recall what is multinomial coefficient and slightly upgrade formula to take into account negative integers too.