Let's call the distance to the appointment 'd', and the time of the first travel (going to the appointment) 't'.
Now, we need to use the formula for the distance:
For the first part of the trip, we have the distance 'd', the average speed is 40 mph and the time is 't':
Then, for the second part of the trip (return trip), the distance is also 'd', the average speed is 30 mph, and the time is 't + 1/3', because she took 1/3 hour longer than the first trip.
So we have that:
Now, we just need to equate both 'd':
So the time 't' is 1 hour. Now we can use that to find the distance 'd':
So the distance to the appointment is 40 miles.