0
$\begingroup$

There is a bug at the origin. It wants to get to $(8, 8)$. It can move either one unit to the right or one unit upwards. If the bug is on a point $(x,y)$ and if $x+y$ is an even number, the bug can move diagonally i.e. go to the point $(x+1,y+1)$. In how many ways can the bug reach $(8,8)$?

If the even sum condition wasn't imposed, the bug goes to $(8,8)$ in $\frac{16!}{(8!)^2}$. This is done using binary systems. My approaches included putting 2's in places which had an even number of 1's and zero's preceding it. However, the number of pathways explodes very quickly and it just became unviable to try that method. Any advice towards a more efficient method would be appreciated.

The plan is to expand upon the idea and generalize it to any point $(h,k)$.

  • 0
    Are there cycles allowed? Does it always have to move closer to the desired spot? Please be a bit more rigorous in describing the problem, i.e. the limitations of the bugs movement.2017-01-30
  • 0
    $8\times8$ is small enough that you can probably go systematically through all squares and write down the binder of ways to reach that specific square.2017-01-30
  • 0
    @David I think he's rigourous enough. The bug can at any time move one unit up, or one unit to the right, or some times one unit diagonally up and to the right. That leaves no room for loops whatsoever.2017-01-30
  • 0
    My bad, I read the question in a hurry, Thanks!2017-01-30
  • 0
    Without the even sum condition, Pascal's triangle gives you the right values. That is: to get to $(m,n)$ there are ${m+n} \choose {m}$ ways. Maybe the triangle can be your starting point to which you add the even sum condition.2017-01-30

2 Answers 2

2

You can solve this problem easily with a recursion, if let $f(x,y)$ be the number of ways to get to $x,y$.

If $x+y$ is odd we have $f(x,y)=f(x-1,y)+f(x,y-1)$

If $x+y$ is even we have $f(x,y)=f(x-1,y)+f(x,y-1)+f(x-1,y-1)$

So all you have to do is draw a rectangular array and start to calculate each term inductively, going through each column, left to right and then down to up:

enter image description here

  • 0
    Thought of something similar. Very lengthy and not particularly efficient if you are not allowed to use a computer2017-02-02
  • 0
    It is pretty fast if you have a bit off practice It took me less than 5 minutes.2017-02-02
0

Here is an alternative solution with generating functions. If you are currently at a location $(x,y)$ with $x+y=k$, $k$ even, then you can get to a point on the line $x+y=k+2$ in 5 ways: a diagonal move, two rights, two ups, up then right, and right then up. Thus letting $a$ denote a rightward step and $b$ an upward step, we can encode such a move as $(a+b)^2 + ab$. Since picking one of these moves gets us to a point where the sum of the coordinates is again even, we get to repeat this choice indefinitely.

So if we start at $(0,0)$, the number of ways to get to $(8,8)$ is the coefficient of $a^8b^8$ in the polynomial $\left((a+b)^2+ab\right)^8$, which is 86515 as previously calculated. By the same logic, if we want to end up at point $(h,k)$, with $h+k$ even, the number of paths is the coefficient of $a^hb^k$ in $\left((a+b)^2+ab\right)^m$, where $m = \frac{h+k}2$.

To count the number of paths to $(h,k)$ where $h+k$ is odd, note that there is no diagonal move to get to this point. So the number of paths to $(h,k)$ is simply the number of paths to $(h-1,k)$ (followed by a rightward move) plus the number of paths to $(h,k-1)$ (followed by an upward move). Both of these numbers can be calculated as above.