Number of ways of reaching a point from origin

17.6k Views Asked by At

Possible Duplicate:
How can I find the number of the shortest paths between two points on a 2D lattice grid?

If we have a point $P(x,y)$ in a coordinate system $[$with $x \geq 0$, $y \geq 0$; that is, in the 1st quadrant$]$

How can we find the number of ways of reaching $P$ from the origin $(0,0)$.

Ex: If P(2,1); 

way1: 0,0 -> 1,0 -> 2,0 -> 2,1
way2: 0,0 -> 1,0 -> 1,1 -> 2,1 
way3: 0,0 -> 0,1 -> 1,1 -> 2,1

Is it possible to have a mathematical equation for it? and How? if we don't have one, what's the best possible way to find those.

Rules:

  1. You can move only in horizontal, vertical directions (diagonal is not possible)
  2. you can only move to the point $(a,b)$ such that $0 \leq a \leq x$ and $0\leq b\leq y$
  3. $a, b$ can be only natural numbers
2

There are 2 best solutions below

10
On BEST ANSWER

It is well known that the number of ways to get to the lattice point $(x,y)$ (supposing $x, y \geq 0$) by taking steps of one unit each either in the eastward or northward direction is exactly $$ {x + y \choose x} = {x+y \choose y} = \frac{(x+y)!}{x! y!}. $$

Such paths are called lattice paths. See, for example, here.

0
On

It is a combinatorial question, where you have $x+y$ things and you have to pick $x$ (or $y$, both are symmetric) times when you can make a choice. In other words, you have $x$ ways to move in $x$ direction, $y$ way to move in $y$ direction. However, once you pick any $x$ direction, the choices for $y$ is fixed. Therefore, the total number of way you can do the above is $(x+y)$ choose $x$ (or $y$, respectively). Mathematically, it will be

$$\left( \begin{matrix} x+y \\ x \end{matrix} \right) = \left( \begin{matrix} x+y \\ y \end{matrix} \right).$$