If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Estimating derivatives with two consecutive secant lines

Sal approximates the instantaneous rate of change of stores per year in a popular coffee chain. Created by Sal Khan.

Want to join the conversation?

  • mr pants teal style avatar for user Sean Robinson
    Why not (S(2004)-S(2002))/2?
    (71 votes)
    Default Khan Academy avatar avatar for user
    • purple pi purple style avatar for user doctorfoxphd
      Given that you are using the same information, but in a different order, you should get the same answer. What you are missing in that order of calculation is what the slopes are on either side of the point of interest, but you do end up with an average slope for the 2-year interval, of which the data for 2003 represents the midpoint.
      In other videos and exercises, we compare a wide variety of the secant slopes near a point. Rock on!
      (36 votes)
  • spunky sam blue style avatar for user Eesh Starryn
    What is a tangent line . I know that secant line intersects a curve but what about tangent?
    (6 votes)
    Default Khan Academy avatar avatar for user
    • mr pants teal style avatar for user Cameron Swartzell
      A tangent line is a one that touches a curve at one and only one point. A 3d example might be placing a flat ruler on a ball. The ruler will touch the ball at only one single point on the curve, the rest of the ball curves away from the ruler. Ruler in this case is "tangent" to the ball.

      Every point on a curve has exactly one tangent line that (locally at least) touches that single point, but none of the other points of the curve.
      (35 votes)
  • orange juice squid orange style avatar for user Muhammad Ibrahim
    I think it is easier to take slope of line from 2002 to 2004 as an average of instantaneous slope of 2003
    (11 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user peterrush42
      Think of it this way. Say you had a graph that looked kind of like a parabola. 2003 is at, say, y=2. 2002 has a value of y=2 as well, but 2004 has a value of y=6. If you took the average slope between 2002 and 2004, you would get something that is so far out from 2003 that it would be completely incorrect. This might be a bad example, but the point is that not all graphs are generally linear like this and it might just do something that you can't get just by taking the average of both sides.
      (17 votes)
  • ohnoes default style avatar for user Cyan Wind
    What if we collected data of the number of stores 2 times/year, one in Jan and one in Oct; and ended up with the data in Jan 2002, Oct 2002, Jan 2003, Oct 2003, Jan 2004 and Oct 2004. Which data should we use to approximate the instantaneous rate of change?
    (6 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Ron Wolf
      I believe you would take the weighted average. For instance, to approximate the instantaneous rate of change for January of 2003, you would use the approximations from October of 2002 to January of 2003 and from January to October of 2003. You would then multiply each derivative by a fraction corresponding to how close it is to the value you are approximating. These fractions should add to one. In this case, they would be 9/12 = 3/4 for the left derivative and 3/12 = 1/4 for the right derivative. Adding the weighted derivatives together would give you an approximation for the derivative at January of 2003.

      It would be interesting to do this in the abstract, with variables instead of numbers, so we could create a calculus of uneven derivatives on a discrete range (a function that’s defined by a list of coordinates, rather than a continuous function). I’m not sure it’s taught on Khan Academy, or even in the AP materials.
      (1 vote)
  • piceratops ultimate style avatar for user jgarciavenomelite
    What is Secant slopes? Sorry im trying to learn this but im in 8th grade
    (2 votes)
    Default Khan Academy avatar avatar for user
  • starky tree style avatar for user Christina
    In what video does he explain why taking the avg of the slopes of the surrounding secant lines gives us the slope at the middle point? Because I watched his previous videos and I still don't get this concept. I don't know if it's me or if there is another video with the explanation. Thank you.
    (4 votes)
    Default Khan Academy avatar avatar for user
    • leafers seed style avatar for user Travis Bartholome
      A simple answer first, then a more detailed/broad attempt at explaining why it works: in this case, the secant line to the left underestimates the tangent slope; the secant line to the right overestimates the tangent slope. By averaging the two together, we can somewhat negate the error on each side to find a more accurate answer. Mathematically, if x = tangent slope and e = error, we're finding [(x+e) + (x-e)] /2 = (2x + e - e)/2 = 2x/2 = x. (x+e) would be the slope of the secant line that overestimates, (x-e) the secant slope that underestimates; so the average of the secant slopes approximates the actual tangent slope.

      Here's the extra: to begin with, the method is based on the fact that the slope of a secant line from x to (x+h) approaches the slope of a tangent line at x as h approaches 0. Let's look at the graph at around . You can see that the points Sal chooses to approximate the slope of the tangent take the form of a secant line from x to (x+h) if (x+h) represents the surrounding year (2002 or 2004) and x represents the year of interest (2003). To calculate the slope of the tangent, we assume that both secant lines are good approximations of the slope of the tangent, so we calculate each; then, as a form of error correction, we take the average of the two slopes so that we end up with a line that represents a "blend" of the two secant lines. So that's the mathematical foundation of this.

      The average of the two slopes (what I called the "blend") is probably going to be a better approximation most of the time precisely because it uses the average of two data for the slope of the tangent rather than just finding one slope and assuming that particular slope is representative of what is actually going on. It's like trying to determine the average grade on a test; if you just ask one student, he/she may have gotten a 96 or a 32, and while that could be representative, it's less likely to be accurate than if you asked both and took the average of their grades (or asked even more people, for that matter). That's kind of a statistical way of thinking about Sal's process here, but I hope it helps answer your question.
      (3 votes)
  • blobby green style avatar for user I8know8
    "it is a function of time" can someone rephrase that please, in a very simple way @
    (2 votes)
    Default Khan Academy avatar avatar for user
  • male robot hal style avatar for user wael kilany
    can we calculate the instantaneous rate of change by getting the slope between S(2002) & S(2004) ?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • mr pants teal style avatar for user Cameron Swartzell
      Correct, we know ( by looking at the graph ) the rate of change is always increasing. We then know that the rate of change for 2003 is definitely more than that of 2002, and definitely less than 2004. What's a good method of finding a value that you know is (reasonably looking) about in the middle of 2 other values? Averaging of course!
      (3 votes)
  • piceratops ultimate style avatar for user peterrush42
    If you found a line of best fit or a least squares regression line for the plotted data, would it be more accurate?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Just Keith
      The best fit (also called linear regression) method only works if the data are linear. If they are not linear, then that is not going to be very accurate. There are other means of doing regression that are not linear, but all such methods are approximations.

      So, yes, you could do this kind of problem by linear regression, but ONLY if the data really are linear. If the data are not linear, you might try power regression, exponential regression, or logarithmic regression.
      (3 votes)
  • male robot hal style avatar for user Viktor Danilevicz
    isn't the slope dy/dx?

    then why does he uses 2003-2004 as nominator, considering that is the X axis.
    (1 vote)
    Default Khan Academy avatar avatar for user

Video transcript

The table shows the number of stores of a popular US coffee chain from 2000 to 2006. The number of stores recorded is the number at the start of each year on January 1. So in 2000, there was 1,996 stores, in 2005, 6,177, so on and so forth. Determine a reasonable approximation for the instantaneous rate of change, in coffee stores per year at the beginning of 2003-- so we care about 2003-- by taking the average of two nearby secant slopes. So let's visualize this. So this right over here, I've plotted all of the points. Now let me make sure that the axes are clear. This horizontal axis, this is my t-axis that tells us the year. And then the vertical axis is the number of stores. And we could even say that it is a function of time. So you see in the year 2000, there was 1,996 stores-- 2003, 4,272. 2003-- let me do that in that blue color. 2003, 4,272 stores. Now if you could imagine that they're constantly adding stores, you could even imagine minute by minute they're adding stores. So this is just sampling the number of stores they had on January 1. But if you were to really plot it as a more continuous function, it might look something like this. I'll do my best to approximate it. It might be more of some type of curve that looks something like this. And once again, I'm just approximating what it might actually look like. So when they're saying the instantaneous rate of change in coffee stores per year, so this is the change, the instantaneous rate of change of stores per time. They're really saying, we need to approximate the slope of the tangent line in 2003, when time is 2003. So the tangent line might look something like that. I want to draw it so you see that this line right over here is tangent. Now, they say approximate. We don't have the information to figure it out exactly. But we have some data around it, and we can figure out the slopes of the secant lines between this point and those points. And then we can take the average of the slopes of the secant lines to approximate the slope of this tangent line. So for example, we could find the slope of this secant line right over here as we go from 2002 to 2003. And then we can find the slope of this secant line as we go from 2003 to 2004. And if we average those, that should be a pretty good approximation for the instantaneous rate of change in 2003. So let's do that. So the slope of this pink secant line, as we go from 2002 to 2003, that's going to be the number of stores in 2003 minus the number of stores in 2002. So that's the change in our number of stores over the change in years, or the change in time. So this is going to be 2003 minus 2002. And so what is this going to be equal to? Let' see, in 2003 we have 4,272 stores. In 2002, we have 3,501. It's going to be that over-- well, the denominator is just 1. So this is going to simplify to, let's see. I can do a little bit of math on the side here just so I don't make a careless mistake. Minus 3501, 2 minus 1 is 1, 7 minus 0 is 7, 42 minus 35 is 7. So this is equal to 771. So their average rate of change from 2002 to 2003 was 771 stores per year. Now let's do the same thing for this red secant line between 2003 and 2004. The slope of that secant line is going to be the number of stores in 2004 minus the number of stores in 2003 over 2004 minus 2003, which is equal to, let's see. They had 5,239 stores in 2004. They have 4,272 stores in 2003. And then only one year changes, so 2004 minus 2003 is 1. So this is equal to-- I'll do the subtraction problem up here. So 5,239 minus 4,272. So this, let's see. 9 minus 2 is 7. Let's see, it looks like we're going to do a little bit of regrouping here. So let's say we take one of the thousands from the 5,000, so it's 4. And then that becomes 10 hundreds. So this becomes 1,200. And now let's take one of those 100s and give it to the 10. So now this becomes 1,100, and we give that 10. So then this becomes 13. We took 100 from here, and that gave us 10 tens. So now we're ready to subtract. 13 minus 7 is 6, 11 minus 2 is 9, and then 4 minus 4 is 0. So it's 967. So this is equal to 967 stores per year. So we really just have to take the average of this number and that number to approximate the instantaneous rate of change. So let's do that. So let's take 967 plus 771, and then we can divide by 2. So let's actually figure out what that is. So let me add 771 over here. 7 plus 1 is 8. 6 plus 7 is 13. And then 1, plus this is 17 right over here. And then we're going to divide that by 2. So 2 goes into 1,738, it goes into 17 8 times. 8 times 2 is 16. Subtract, we get a 13, it goes six times. 12. Subtract, we get an 18. It goes nine times. And then we don't have any remainder. So 18, no remainder. So our approximation for the instantaneous rate of change for the slope of our approximation for the slope of the tangent line right over here is 869 stores per year.