Answer :

abcxyz
Speeds for 1st half= 50km/h
2nd half= 40 km/h
Let total distance to be travelled=2s km (skm at 50km/h + skm at 40 km/h)
We know, 
time=dist/speed, t=s/v
t for 1st half= t₁=s/50 
t for 2nd half= t₂=s/40
Now, we know, Average speed= Total dist/Total time
Avg speed= 2s/(t₁+t₂)
=2s/(s/50 + s/40)
=2s/[(4s+5s)/200]
=2s*200/9s
=2*200/9
=44.44km/h
Let the total distance be "2d"
Then total time taken by the car = d/50 + d/40
Average Speed = Total distance / total time taken
=[tex] \frac{2d}{ \frac{d}{40} + \frac{d}{50} } [/tex]
= 44.44 km/hr