First set the distance between home and work as the value x miles.The time takento get from home to work is the value y hours.The time takento get from work to home is the value z hours.Then (as timeis equal to distance divided by speed),x/30 = yandx/40 = z
The averagespeed while travelling can be calculated by taking the total distance travelled(2x miles) divided by the total time taken (y+z hours). Therefore,(Average speed)= (2x)/(y+z)Substituting yand z gives,(Average speed)= (2x)/((x/30)+(x/40))=(2x)/((40x +30x)/(1200))= 2400x / 70x= 2400 / 70= 240 / 7
David's averagespeed while travelling is 240/7 miles per hour.