Answer:
He pays to the cab driver for 25 miles.
Step-by-step explanation:
Consider the provided information.
Let us consider he walks x miles at the rate of 4 miles per hour.
As we know 
Therefore, time taken is: 
He get a taxi for (31-x) miles at the rate of 50 miles per hour.
Therefore, time taken is: 
It took 2 hours after he started.
That means the sum of time take is 2 hours.





Hence he walk 6 miles and he get a taxi for 31-6=25 miles.
He pays to the cab driver for 25 miles.