A rabbit initially stands at the position $0$, and repeatedly jumps on the real line. In each jump, the rabbit can jump to any position corresponds to an integer but it cannot stand still. Let $N(a)$ be the number of ways to jump with a total distance of $2019$ and stop at the position $a$. Determine all integers $a$ such that $N(a)$ is odd.
Solution Consider the quantity $$T = (x+x^2+x^3+...)+(y+y^2+y^3+...) = \frac{x}{1-x}+\frac{y}{1-y}$$and define generating functions $$F(x,y) = 1+T+T^2+...$$It's clear that the coefficient of $x^my^n$ in $F$ equals to the number of ways to jump with a total distance of $m+n$ and arrive at position $m-n$. (i.e. variable $x$ corresponds to positive jumps and variable $y$ corresponds to negative jumps).
Now we evaluate $F(x,y)$. To do this, we work in $\mathbb{Z}_2$, so $$F(x,y) = \frac{1}{1-T} = \frac{(1-x)(1-y)}{1-xy}$$ Thus, we have $$F(x,y) = (1-x-y+xy)(1+(xy)+(xy)^2+(xy)^3+...)$$ It's clear that all odd coefficients are in form $x^ny^{n+1}$ and $x^{n+1}y^n$, which corresponds to $N(1)$ and $N(-1)$. Thus the answer is $\boxed{\{1,-1\}}$.
Edit after Donald Splutterwit answer. Can someone please explain
- What is $1$ in $F$ since rabbit must jump at least once? >Shouldn't it start with $T$ and not with $1$?
- Why there is no $1$ in $T$ since the rabbit can jump on the >spot?
- How come they never actually use $2019$ and $a$?
We are free to choose $F$ either starting with $1$ or starting with $T$. A value $1$ represents no jump at all and will simply be ignored when doing the analysis. Its benefit is to have a slightly simpler function. With \begin{align*} T(x,y)=\frac{x}{1-x}+\frac{y}{1-y} \end{align*} we have \begin{align*} \color{blue}{F(x,y)}&=\frac{1}{1-T(x,y)}=\frac{1}{1-\left(\frac{x}{1-x}+\frac{y}{1-y}\right)}\\ &=\frac{1-x-y+xy}{1-\left(2x+2y-3xy\right)}\\ &=\left(1-x-y+xy\right)\sum_{j=0}^\infty \left(2x+2y-3xy\right)^j\\ &\color{blue}{\equiv\left(1+x+y+xy\right)\sum_{j=0}^\infty\left(xy\right)^j\pmod{2}}\tag{1}\\ \end{align*}
On the other hand starting with $T$ we obtain \begin{align*} \color{blue}{G(x,y)}&=\frac{T(x,y)}{1-T(x,y)}=\frac{\frac{x}{1-x}+\frac{y}{1-y}}{1-\left(\frac{x}{1-x}+\frac{y}{1-y}\right)}\\ &=\frac{x+y-2xy}{1-\left(2x+2y-3xy\right)}\\ &=\left(x+y-2xy\right)\sum_{j=0}^\infty \left(2x+2y-3xy\right)^j\\ &\color{blue}{\equiv\left(x+y\right)\sum_{j=0}^\infty\left(xy\right)^j\pmod{2}}\tag{2}\\ \end{align*}
When answering the third question, we will see that (1) and (2) will lead to the same conclusion.
The problem states the rabbit can jump to any position corresponding to an integer but it cannot stand still. This implies that each jump has length $>0$.
The solution answers the prolem for any distance $d$, not only for the special case $d=2019$. We consider wlog the case $a>0$ which implies when looking at positive jumps $x^m$ and negative jumps $y^n$ we have \begin{align*} m+n&=d\tag{3}\\ m-n&=a \end{align*} We denote with $N(d,a)$ the number of ways to jump with a total distance of $d$ and stop at the position $a$.
We use the coefficient of operator $[x^m]$ to denote the coefficient of $x^m$ in a series. We obtain calculating in $\mathbb{Z}_2$ \begin{align*} \color{blue}{[x^my^n]}&\color{blue}{F(x,y)}\\ &=[x^my^n]\left(1+x+y+xy\right)\sum_{j=0}^{\infty}(xy)^j\\ &=\left([x^my^n]+[x^{m-1}y^n]+[x^my^{n-1}]+[x^{m-1}y^{m-1}]\right)\sum_{j=0}^\infty (xy)^j\\ &\color{blue}{=\begin{cases} 1&\qquad (m=n)\vee (m=n+1)\vee (m=n-1)\\ 0&\qquad\text{otherwise} \end{cases}}\tag{4} \end{align*}
This solution implicitly includes the value $d=2019$.
We also note that working with $G(x,y)$ results in (4) without the solution $m=n$ which is not admissible anyways.