2

A boy is standing at $x=0$ and he wants to go position at $x=n$, he can jump either 2 or 3 steps forwards. The probability of taking 2 steps is $p$ and probability of taking 3 steps is $1-p$. What is probability that he arrive exactly at $x=n$?

For example, $n=5$ and $p=0.2$:

1st way: 2+3, probability $=0.2\times 0.8=0.16$.

2nd way: 3+2, probability $= 0.8\times0.2=0.16$.

Total probability $=0.16+0.16=0.32$.

chandu
  • 23
  • It would help to know what you have tried, so that one can focus on your source of difficulty. – André Nicolas Jun 05 '15 at 23:42
  • Some questions come to mind. Is it even possible to always get to $n$, when you can use only steps of length $2$ and $3$? Yes, it is, unless $n=1$. Generally, this follows from the Frobenius problem, but I suppose it's obvious here. Also, how do you count the number of ways to get to $n$? This amounts to solving a linear Diophantine equation $n=2x+3y$ for integers $x,y\geq 0$. Given one solution of this equation, there is a general parametrization of all solutions that may be useful, but remember that you want only the positive solutions. – Mankind Jun 05 '15 at 23:47
  • 1
    @HowDoIMath For even $n$, $(n/2, 0)$ is a solution. For odd $n$, $(\frac{n-3}{2}, 1)$ is a solution. – Elliot Gorokhovsky Jun 05 '15 at 23:50
  • @RenéG good, one can use that in the parametrization of all solutions. – Mankind Jun 06 '15 at 00:00
  • @HowDoIMath Can you please post the details? – Elliot Gorokhovsky Jun 06 '15 at 00:00
  • See this answer http://math.stackexchange.com/a/20727/118767 – Elliot Gorokhovsky Jun 06 '15 at 00:48

1 Answers1

3

Let $a_n$ be the probability of landing on $n$. The event "we land on $n$" can happen in two ways: (i) we land on $n-2$ and then make a jump of $2$ or (ii) We land on $n-3$ and then make a jump of $3$. That yields the recurrence $$a_n=pa_{n-2}+(1-p)a_{n-3}.\tag{1}$$ The initial conditions are $a_1=0, a_2=p, a_3=1-p$ (or, if one prefers, one can use $a_0=1$.) Recurrence (1) gives us an efficient algorithm for computing $a_n$ exactly if $n$ is not too large.

We now outline how to get a closed form for $a_n$. The characteristic equation of (1) is $x^3-px-(1-p)=0$. This has the obvious root $1$. Then we divide the polynomial by $x-1$, obtaining a quadratic with roots $\frac{-1\pm \sqrt{4p-3}}{2}$. Thus the general solution of the recurrence is $$a_n=A\left(\frac{-1+ \sqrt{4p-3}}{2}\right)^n +B\left(\frac{-1- \sqrt{4p-3}}{2}\right)^n +C$$ for some constants $A, B, C$. These can be evaluated by using the initial conditions.

Remark: The formula has some unpleasant features. For $p\lt 3/4$, it involves powers of non-real numbers. One can sneak around that by using trigonometric functions and the deMoivre formula.

André Nicolas
  • 507,029
  • Brilliant! Simple and elegant (until you try to find a closed form :)). – Elliot Gorokhovsky Jun 06 '15 at 00:50
  • What is a characteristic equation? – Elliot Gorokhovsky Jun 06 '15 at 00:52
  • This is a "trick" (method) which is useful for linear recurrences with constant coefficients, most commonly for congruences of the form $a_n=ca_{n-1}+d a_{n-2}$. You may already have seen the same idea in linear differential equations with constant coefficient. Briefly we "hope" (in our case) that before initial conditions are applied, there is a solution of type $a_n=r^n$. Plug in, we get $r^n=pr^{n-2}+(1-p)^{r-3}$. Divide by $r^{n-3}$. We get $r^3=pr+(1-p)$, which is essentially the characteristic equation I wrote down. – André Nicolas Jun 06 '15 at 00:59
  • Andre's previous comment has some typos: when you plug in $r^n$ you get $r^n=pr^{n-2} + (1-p)r^{n-3}$, and when you divide by $r^{n-3}$ you get $r^3=pr+(1-p)$. – Ian Jun 06 '15 at 15:53
  • Thanks for noticing. Unfortunately old comments cannot be edited. – André Nicolas Jun 06 '15 at 15:59