Pulse and Glide - Average Speed

Sometimes it takes an article to inspire me. I just read an article about Dale Earnhardt Jr using pulse-and-glide techniques in NASCAR and it got me to thinking. The basic idea of pulse and glide (as I understand it) is to not use your engine as much when it is at a low load because it is not as efficient. Instead, accelerate to 10 mph over your desired speed and coast to 10 mph under your speed limit. Apparently, this can save fuel.
Here is the question: How do you drive to make your average desired speed?
Suppose you drive such that your speed is like this:
screenshot_36
This would obviously give you an average speed of 50 mph. Here you are increasing your speed for 2 minutes and then coasting for 2 minutes. Note that the the following graph would be unrealistic:
screenshot_37
The biggest problem is the infinite accelerations going from 60 mph to 40 mph and back from 40 to 60. Well, perhaps this is just a very high acceleration. Then this would really defeat the goal of pulse and glide as you would be using your brakes to slow down and that would just be a dumb way to lose energy.
What if you did the following:
screenshot_38
Hey its the same as before! No, its not. In this graph, you increase your speed from 40 mph to 50 mph over 2 miles, not two minutes. You then decrease your speed for 2 miles. It turns out this does NOT give an average speed of 50 mph.
Clearly, we are talking about one dimensional motion here (and by we, I mean me). So, I will use the following:
screenshot_40 Suppose I drive 60 mph for 2 miles and then 40 mph for 2 miles (which is not what the above graph says (it has non-constant speeds - but I will proceed anyway). My average speed is NOT 50 mph. Why? Let me do this the long way. My average speed is my change in position over my change in time.
screenshot_41
Here, I know x1 and x2 (the distance traveled at each speed, but I do not explicitly know the times. I can find the times using:
screenshot_42
Substituting these in for the times:
screenshot_43
In this case, x1 = x2 so:
screenshot_44
So, if the driver drives 60 mph then 40 mph for the same DISTANCE, then the average speed would be:
screenshot_45
Great, you may say - but that doesn’t apply to pulse and glide, as you (I) stated above. Anyway, who would drive by watching the mileage markers instead of the clock?
Nonetheless, the same idea applies to second graph with regards to distance.

Really, I am just using this pulse and glide to talk about average velocity - see, I tricked you. But I think I would like to explore this pulse and glide technique a little more. I am confused on how this saves energy significantly. If you just drive slower, it seems that would be better (less energy loss to air resistance). It seems the claim is that the car engine is more efficient while speeding up than it is maintaining speed. This seems odd, but I am not too familiar with the efficiency characteristics of the car engine.

Hopefully I will return to this topic.