# A problem on generalization of a solution

Consider the following question:

Two cars A and B start simultaneously from two different cities P and Q respectively and move back and forth between the cities.(As soon as car A reaches city Q it turns and starts for city P and as soon as it reaches city P it leaves for city Q. Similarly for car B) The speeds of the cars A and B are in the ratio of $2:1$ . Find the number of distinct meeting points at which cars A and B can meet.

Now, I know that they will meet in two points. I solved this by dividing the distance between the two cities into 3 segments and then manually finding their common points by the logic that B will travel $1$ unit for every $2$ units A travels.
However, what if the speed ratio was something like $7:9$ or something even more intractable. Manually finding their meeting points would be too lengthy and inelegant. How do I generalize the method to find common points to unwieldy ratios?

-
I suspect if the ratio is m:n , that all the possible meetings will happen between the 1st trip and the lcm(m,n)th trip, so that for the ratio 9:7 , all the possible meetings will happen every 63 trips. Also interesting, if the ratio was irrational, I suspect the two will meet infinitely-often. Notice if A has completed 7 trips and B is 9/7 times faster, then B will have completed 9/7(7)=9 trips. –  BFD Oct 17 '13 at 6:31
@BFD: We’re not actually counting the times that they meet, but rather the number of points at which they can meet. However, it’s true that if the ratio is irrational, this set is infinite; in fact it’s dense in $PQ$. –  Brian M. Scott Oct 17 '13 at 7:45
@Brian, I agree, but what I meant is that (I think) my post suggests there is a "periodicity"; so that, say for m:n =9/7, after 9 trips, the scenario meeting-wise will be the same as it is after 0 trips. –  BFD Oct 17 '13 at 7:48
@BFD: Yes, that part is fine (except that you mean $63$ trips, as in the original comment); that’s why there are only finitely many possible meeting-points when the ratio is rational. But no matter what the ratio is, they actually meet infinitely many times iff they travel forever! –  Brian M. Scott Oct 17 '13 at 7:52