1
$\begingroup$

The Full Question

Find a recurrence for the number of lattice paths beginning at $(0,0)$ with steps N and W, and which contain an even number of N steps.

My Work

A string of length $n$ can end in W or N. If it ends in W, all we are doing is adding W to the end of a string of length $n-1$. If it ends in N, then the $n-1$ sting before it must have an odd number of N moves. All strings of length n-1 with an odd number of steps is just all the possible strings minus all the strings with even N, mathematically put: $2^{n-1}-a_{n-1}$.

$a_n = 2^{n-1}$ By rule of sum

But this is not correct because we know $a_3 = 2 \neq 2^2$

Where did I go wrong in my reasoning, and can anyone suggest a better approach?

$\endgroup$
3
  • $\begingroup$ Unless I misunderstood the question, the possibilities for $n=3$ are NNW, NWN, WNN, WWW, so $a_3=4$. $\endgroup$
    – David
    Commented Mar 12, 2015 at 4:48
  • $\begingroup$ @David maybe I'm just stupid and didn't compute my cases correctly! $\endgroup$
    – Dunka
    Commented Mar 12, 2015 at 4:53
  • $\begingroup$ I suggest you check the question. As you have shown, there is an easy non-recursive answer, so it's a bit strange that they would ask for a recurrence. $\endgroup$
    – David
    Commented Mar 12, 2015 at 4:55

1 Answer 1

1
$\begingroup$

Your argument is correct; you simply miscounted the valid paths of length $3$. As noted in the comments, there are four of them: WWW, WNN, NWN, and NNW.

Note that you don’t actually need a recurrence here. Suppose that $n>0$, and $s_1s_2\ldots s_n$ is a path, not necessarily valid, of length $n$. The N steps can occupy any subset of the $n$ positions in the path. There are $2^n$ such subsets, and half of them have even cardinality, so $a_n=2^{n-1}$. (Of course, you can view your argument as another proof of the fact that half of the subsets of a non-empty finite set have even cardinality.)

$\endgroup$
2
  • $\begingroup$ Well it's good to know I at least have the human part of the math taken care of. Do you know what the recurrence relation would be? $\endgroup$
    – Dunka
    Commented Mar 12, 2015 at 5:17
  • $\begingroup$ @Dunka: Only after the fact: the sequence satisfies the recurrence $a_n=2a_{n-1}$ for $n>1$, with $a_0=a_1=1$. $\endgroup$ Commented Mar 12, 2015 at 5:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .