TITLE: Riddle about dog running in company of soliders
QUESTION [3 upvotes]: A group of soldiers march together straight in square formation $50 \times 50$ meters. There is the dog at the back of the formation. Dog starts to run towards the first line of soldiers and then when it reaches front of the formation it starts run to the back. Meanwhile(from the beginning of dog run to the end of it) the soldiers covered $50$ meters distance. What was the distance that dog covered?
$v_d$ - speed of dog
$v_f$ - speed of formation 
$x$ - distance which soldiers covered in time $t_1$ 
$t_1$ - time from dog's start to reaching first line of soldiers 
$t_2$ - time of dog's coming back.
Then, I assume:
$$
v_d \cdot t_1 = 50+x
$$
$$
v_f \cdot t_1 = x
$$
$$
v_d \cdot t_2 = x
$$
$$
v_f \cdot t_2 = 50-x
$$
Are my equations right? Is there better way to do it?

REPLY [1 votes]: Define the variables as follows:

$v_d, v_s$: speed of dog, soldiers, resp.
$t_f, t_b$: time for dog to reach frontline, to go from first line to back, resp.

Then the dog moves 50m relative to the soldiers both ways, at two different relative velocities, so
$\boxed{\dfrac{50}{v_d-v_s} + \dfrac{50}{v_d+v_s} = \dfrac{50}{v_s}}$
This simplifies to
$100\cdot v_d\cdot v_s = 50({v_d}^2-{v_s}^2)$ which after letting $\boxed{\lambda = \dfrac{v_d}{v_s}}$ gives $\lambda^2-2\lambda-1=0$
So $\lambda = \dfrac{2\pm\sqrt{8}}{2} = 1 \pm \sqrt2$. Take $\boxed{\lambda = 1 + \sqrt2}$ since the velocity is positive.
Since the dog was running all the times it must have covered $50(1+\sqrt2) \approx 120.7$ meters.
{"set_name": "stack_exchange", "score": 3, "question_id": 726679}