Tell me more ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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?

share|improve this question
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

1 Answer

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.

share|improve this answer
Thank you, I already wrote a program to calculate answer using brute force but I could’d find formula from results , thanks man – user1667315 Nov 4 '12 at 5:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.