# Finding number of different paths

Consider a finite grid, suppose points a and b have positive x and y components ,and a has coordination of (x1,y1) and b has coordination of (x2,y2) and we want to go from a to b, how many possible paths exist if our movement is just going up and going right?

-
 actually this is not HW question , this is part of my php programing for graphing calculator, – user1667315 Nov 4 '12 at 5:06 Thanks man, very helpful – user1667315 Nov 4 '12 at 5:08 is there a formula that i can plug in x y coordinate for a and b ? – user1667315 Nov 4 '12 at 5:12 If these answers are helpful to you, they may be helpful to others as well. Please do not vandalize the question after it is answered. – Ross Millikan Nov 13 '12 at 19:05 rolled back edit to give answer context. – robjohn♦ Nov 13 '12 at 21:48

I assume you mean for this problem to deal only with integer coordinates and also $x_1 \leq x_2$ and $y_1 \leq y_2$ (otherwise, one cannot move only up and right).
Let $x = x_2 - x_1$ and $y = y_2 - y_1$ (the horizontal and vertical distance between the points). We can imagine a path from the two points as a binary string of with exactly $x$ 0's and exactly $y$ 1's, where we interpret a 0 as "move right" and a 1 as "move up". Notice the string has total length $x+y$.
To form such a string, we need only pick the locations for the 0's and then fill the remaining locations with 1's. That is, we choose exactly $x$ locations (without order) out of the total $x+y$ locations, which can be done in $\binom{x+y}{x}$ ways.