Two sets of number ranges where one influences the other, how to find the intersection point?

61 Views Asked by At

Suppose I have the following number ranges:

a = [x = 1, y = 5] b = [x = 9, y = 3]

Now say a donkey is travelling between the number range 'a' and a horse is moving between number ranges 'b'.

The amount the horse has moved is directly proportional to the amount the donkey hsa moved between its range, so for example if the donkey has moved half way from 1 to 5 (i.e. 3) the horse is at position 6 (i.e. half way between 9 and 3).

How can I calculate at what point the horse and donkey will meet if at all?

1

There are 1 best solutions below

0
On BEST ANSWER

From what I can tell, what you are asking is as follows:

In an hour, a donkey travels from $a_1$ to $a_2$ at a constant rate. A horse travels from $b_1$ to $b_2$ at a constant rate. Do they ever meet?

The easiest way to answer this, would be to draw a graph where the $y-$axis represents the position, and the $x-$axis represents the time taken. For the donkey, we are drawing a line from $ (0, a_1)$ to $(1, a_2)$. For the horse, we are drawing a line from $(0, b_1)$ to $(1, b_2)$. If the lines intersect, then that defines a meeting point.

The equation of the line for the donkey is $ y = (a_2 - a_1) x + a_1$ and the equation of the line for the horse is $ y = (b_2 - b_1) x + b_1$. The intersection point of these lines is given by $ x^* = \frac{ a_1 - b_1} { (b_2 - b_1) - (a_2 - a_1) } $ and it's corresponding $y $ value.

Subject to the condition of this question, the animals will meet during their journey if and only if $ 0 \leq x^* \leq 1 $, or equivalently

$$ 0 \leq \frac{ a_1 - b_1} { (b_2 - b_1) - (a_2 - a_1) } \leq 1.$$