What is the ratio of the speed of the cow and speed of the train given the following conditions? There is a bridge of $40\,\text m$ length. A cow is standing $5\,\text m$ away from the middle of the bridge. A train is coming from the direction nearest to the cow. If the cow runs towards the opposite direction of the train then he escapes the bridge when the train is $2\,\text m$ away from the bridge and if the cow runs towards the same direction of the train then the train hits the cow $2\,\text m$ before the other end of the bridge. What is the ration of speed of the cow and the train?


My Approach

Let the train speed be $x$ and the cow speed be $y$

Therefore, $$\frac{d-2}x=\frac{15}y\tag1$$

Similarly $$\frac{d+38}x=\frac{d-23}y\tag2$$

From $(1)$ and $(2)$ I get $d=77$

Therefore, $$\frac{15}{d-2}=\frac{15}{75}=1:5$$

This is how I solved this problem.
A simple intuitive way with practically no algebra is to imagine two cows, simultaneously  running towards bridge ends $A$ and $B$ respectively.

train -----> $A$ .. $15m$ ..$\bullet$..... $25m$ ..... $B$

By the time one cow has reached $A$, the other is $(25-15) =10m$ from $B$, and by the time this cow has travelled another $8m,$ the train hits it, having travelled $2+40-2 = 40m.$

Thus ratio of speed of cow: speed of train $= 8:40 = 1:5$
f x is distance the train is from the bridge, c is cow speed and t is treen speed then from the first sentence we get: 

13m / c = (2m + x) / t

from the second: 

25m / c = (38 m + x) / t

Then t / c = (2m + x)  / 13m  = (38m + x) / 25m, x = 37m, t / c = 3, c / t = 1 / 3

Well, if I read this question now, it looks like my cow swapped the directions... I guess you right, true blue anil, to have 2 cows running in opposite directions, this way at least one will do the right thing... and I will never do questions while at work again, Karma and things like that.