From (1) M =50A/(2A+40)=25A/(A+20). Substitute this value of M in (2) to get:

A-25A/(A+20)=5 .

Multiply by A+20 to get:

A(A+20)-25A=5(A+20)

A^2-5A=5A+100

Add -5A+25 to both sides:

A^2-10A+25 =100+25 =125

(A-5)^2 = 125

A-5 =sqrt(125)=5sqrt5

A= 5+5sqrt5 = 16.18033989 kmph

M = A-5 = 5sqrt5 = 11.18033989 kmph.

Tally:

Time taken for M to complete 50 km = 50 /(5sqrt5) =2qsrt5.Time take. for A to mplete 40 km = 40/{5+5sqrt5} = 8/{ 1+sqrt5} =(8/4){sqrt5-1}=2{sqrt5-1}, which is less than 2hrs of M's time to go 50 kms. So it is talleyed.