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:
- You can move only in horizontal, vertical directions (diagonal is not possible)
- you can only move to the point $(a,b)$ such that $0 \leq a \leq x$ and $0\leq b\leq y$
- $a, b$ can be only natural numbers