total time, t = 4hours
1st speed, a = 6 mph
2nd speed, b = 15mph
total distance covered, d = 30miles
time spent at 6mph, x
time at 15mph, y
total time, t = x + y
=》4 = x +y...eqn 1
total dist, d = ax + by
=》30 = 6x + 15y...eqn 2
subst for y (= 4 -x) in eqn 2
30 = 6x + 15(4-x)
= 》 9x = 30
x = 3 1/3 = 3 hrs 20mins
y = 4 - 3 1/3 = 2/3 = 40mins