Chapter 4 Block 3

4.1 Lesson 27: Rates of Change

4.1.1 Objectives

  1. Compute the average rate of change of a function over a given interval, including the dimension and units of the rate.

  2. Compute the average rate of change over multiple small intervals to estimate the instantaneous rate of change at a given input.

  3. Describe the derivative of a function at a given input as the instantaneous rate of change and as the slope of a tangent line.

  4. Given a function and a scenario, interpret the meaning of the derivative at a given input, including units.

  5. Write and understand the following derivative notations: Lagrange (“prime”) notation and Leibniz (“fraction”) notation.

  6. Given a function and input value, give the equation of the tangent line to the graph of the function at the input.

4.1.2 Reading

Section 4.1

4.1.3 In class

  1. Intro. We’ve covered functions and how to use them to model data. Now we are going to get into how functions change with respect to their input(s).

  2. Average Rate of Change. First, we use our knowledge of rise over run to approximate the rate of change of a function over a given interval. Cadets should practice this over and over in order to 1) reinforce the idea of rate of change so that when we get to derivatives, rate of change will come to mind, and 2) allow them to use R to build and apply a function computing average rate of change.

  3. Instantaneous Rate of Change. Distinguish between average and instantaneous rate of change. We can approximate or “conjecture” instantaneous rate of change by finding average rate of change across very small intervals. The cadets should use their function to approximate instantaneous rate of change.

  4. Derivative. The instantaneous rate of change of a function \(f(x)\) when \(x = a\) is called the derivative of \(f(x)\) when \(x = a\) and is denoted by \(f'(a)\). We’ll get into the derivative as a function next lesson, but for now, they should know that the instantaneous rate of change is denoted as \(f'(a)\) and is called the derivative.

  5. Equation of the Tangent Line. Obtain the equation of the line tangent to a function at a particular point. We’ll need to use our approximate or conjectured derivative as the slope of this line: \(y = f(a) + f'(a)(x - a)\)

4.1.4 R Commands

makeFun, plotFun

4.1.5 Problems & Activities

  1. Start with the function \(f(x) = x^{3} - 5x\). Create this in R using makeFun. Next plot this function on the domain (-3,3). Discuss how to find the average rate of change in \(f(x)\) between two points, say from \(x = 0\) to \(x = 2\). Tie this to the familiar “rise over run”. Now find the average rate of change from \(x = 1\) to \(x = 2\) and from \(x = -2\) to \(x = -1\).

    f=makeFun(x^3-5*x~x)
    plotFun(f(x)~x,xlim=range(-3,3))
    mathaxis.on()
    grid.on()

    (f(2)-f(0))/(2-0)
    ## [1] -1
    (f(2)-f(1))/(2-1)
    ## [1] 2
    (f(-1)-f(-2))/(-1--2)
    ## [1] 2

    We can build a function that does this for us:

    f_change=makeFun((f(b)-f(a))/(b-a)~a & b)
    
    f_change(0,2)
    ## [1] -1
    f_change(1,2)
    ## [1] 2
    f_change(-2,-1)
    ## [1] 2
  2. What is the instantaneous rate of change at \(x = 0\)? Talk about the difference between this and average rate of change. Graphically approximate it. It looks to be about -4. We can also approximate it by finding the average rate of change across very small intervals around \(x = 0\):

    f_change(-1,1)
    ## [1] -4
    f_change(-0.5,0.5)
    ## [1] -4.75
    f_change(-0.25,0.25)
    ## [1] -4.9375
    f_change(-0.1,0.1)
    ## [1] -4.99
    f_change(-0.01,0.01)
    ## [1] -4.9999

    Based on the progress of these approximations, I think the rate of change at \(x = 0\) is -5. We denote this as \(f'(0) = -5\). This is called the derivative of \(f(x)\) at \(x = 0\).

    Have the cadets use a similar process to speculate the values of \(f'(-1)\) and \(f'(2)\).

  3. We can use the derivative at a particular value to find the equation of the line tangent to the curve at that point: \(y = f(a) + f'(a)(x - a)\)

    The equation of the line tangent to \(f(x)\) at \(x = 0\) is:

    \[y = f(0) + f'(0)(x - 0) = -5x\]

    Plotting on the same graph:

    plotFun(-5*x~x,add=TRUE,col="red")

  4. Have them work through exercises 76-77. The function models weight of a male fetus given gestational week. Have them pay special attention to the dimension of the function and its rate of change.

4.2 Lesson 28: The Derivative as a Function I

4.2.1 Objectives

  1. Describe that in general, the derivative of a function is also a function.

  2. Given a function, use R to approximate and plot the derivative of that function.

  3. Given the plot of a function, approximate the derivative of that function graphically by hand.

4.2.2 Reading

Section 4.2.

4.2.3 In class

  1. Derivative at a Point. Start with a reminder of instantaneous rate of change. Go through an example from last time. We’re spending multiple lessons on section 4.2, so there’s some time for review if needed. Remind them that the instantaneous rate of change of a function at a given point is referred to as the derivative of the function at that point.

  2. Derivative as a Function. Start by building a new function in R, similar to the one we built last time (f_change()). This function will be an approximation of the instantaneous rate of change at a given input \(x\). Emphasize that this is a function. The input is \(x\) and the output is the approximate derivative of \(f\) at the input \(x\). A function can have different instantaneous rates of change at different inputs. Thus, the derivative itself is also a function. We use the notations \(f'(x)\) and \(\frac{d}{dx}f(x)\).

  3. Graphical Representation of Derivative. Given a function, go over how to approximate its derivative graphically. Similarly, given a function’s derivative, discuss how to find the original function.

  4. Differentiability. (If there is time.) Lead a discussion on when functions do/do not have a derivative. Some functions are considered non-differentiable at certain points.

4.2.4 R Commands

makeFun, plotFun

4.2.5 Problems & Activities

  1. Consider the function \(f(x) = x^{3} - 5x\).

    1. Define the function in R and plot it on the domain (-3,3).
    f=makeFun(x^3-5*x~x)
    
    plotFun(f(x)~x,xlim=range(-3,3))
    mathaxis.on()
    grid.on()

    1. Visually, and using f_change(), estimate the instantaneous rate of change at \(x = 1\).
    f_change=makeFun((f(b)-f(a))/(b-a)~a & b)
    
    f_change(0.9,1.1)
    ## [1] -1.99
    1. Build an R function that estimates the instantaneous rate of change. To do this, we will utilize f_change(), which we built last time. The newly built R function will input one value and output the average rate of change from that value to a value nearby, thus approximating the instantaneous rate of change. Since the instantaneous rate of change is referred to as the derivative at a given input, let’s call this R function f_deriv().
    f_deriv1=makeFun(f_change(x,x+0.8)~x)
    1. Use this function to estimate the instantaneous rate of change at \(x = 1\).
    f_deriv1(1)
    ## [1] 1.04
    1. Note that f_deriv is a function with an input and output. Given an inputted value of \(x\), the output is the approximate instantaneous rate of change of \(f(x)\). Plot this function on top of \(f(x)\). Also, change the value 0.1 to a lower value and see what happens.
    plotFun(f_deriv1(x)~x,col="firebrick",add=TRUE)
    
    f_deriv2=makeFun(f_change(x,x+0.3)~x)
    plotFun(f_deriv2(x)~x,col="darkseagreen4",add=TRUE)
    
    f_deriv3=makeFun(f_change(x,x+0.001)~x)
    plotFun(f_deriv3(x)~x,col="darkslateblue",add=TRUE)

    As that increment decreases, f_deriv approaches \(f'(x)\), the derivative function of \(f(x)\).

  2. Spend some time on this plot. Note that the vertical position of the red line is telling me the rate of change of the blue line at that point. When the blue line is decreasing/increasing, the red line is below/above the x-axis. Similarly, when the blue line reaches a min/max, the red line is at zero (no change). In order to solidify their understanding of the derivative as describing rate of change of a function, go through some examples where they are given a graph of \(f(x)\) and asked to plot \(f'(x)\). I recommend any of the plots from Exercises 29-41 in Section 4.2.

  3. End with Exercise 42. This function looks different than the others in that it is not as smooth. We’ll discuss smoothness and differentiability next time, but this is a good opportunity to motivate that with this example.

4.3 Lesson 29: The Derivative as a Function II

4.3.1 Objectives

  1. Describe the term differentiable and identify at what inputs a function is or is not differentiable.

  2. Given a function, use R to approximate and plot its first derivative and higher order derivatives.

  3. Given a function’s first derivative, identify where the function is increasing or decreasing and identify any local extrema.

  4. Given a function’s first or second derivative, determine the function’s concavity and identify any inflection points.

4.3.2 Reading

Section 4.2.

4.3.3 In class

  1. Differentiability. Start with Exercise 42 from section 4.2. In this example, the cadets should recognize that the derivative is a piecewise constant function. Think about it like this, say at the point \(x = -4\). We want to estimate \(f'(-4)\). Cadet A estimates \(f'(-4)\) by taking successively smaller average rates of change, and happens to do so over the intervals \([-4.1,4]\), \([-4.01,4]\), \([-4.001,4]\), etc. Cadet A comes up with average rate of change 1 every time, so Cadet A is convinced that \(f'(-4) = 1\). Cadet B proceeds similarly, but uses intervals \([-4, -3.9]\), \([-4, -3.99]\), \([-4, -3.99]\), etc. Cadet B calculates average rate of change \(0\) every time, so Cadet B is convinced that \(f'(-4) = 0\). Because these two, perfectly reasonable, cadets can’t agree on the value of the derivative, no matter how small they make their intervals, there must be no acceptable value of the derivative there. We say that \(f\) is not differentiable at \(-4\) in this case.

  2. Higher Order Derivatives. Cadets should recognize that we can find the derivative of the derivative of a function. We call this the second derivative and denote it as \(f''(x)\). The second derivative describes how the first derivative changes. Thus, it describes the concavity of the original function. Give them functions and have them draw first and second derivatives.

  3. Describing Functions Given Derivatives. Next, we’ll work in the opposite direction. Given \(f'(x)\) and \(f''(x)\), describe the behavior of the function. Where is it increasing/decreasing? Are there any extrema? Describe the concavity. Are there any inflection points?

4.3.4 R Commands

makeFun, plotFun

4.3.5 Problems & Activities

  1. Start with Exercise 42. They should be able to sketch the derivative of this function on the board or at their desks. Proceed along the lines of reasoning above. Because the derivative does not exist for all values in the domain of \(x\), we say that the function is not differentiable.

  2. Next, do an example using R. Consider the function \(g(x) = |x|\).

    1. Define and plot the function in R. Plot it on the domain (-3,3). Also, demonstrate how to customize the vertical range of the plot using ylim=. Plot on the range (-3,3). Note that plotFun leaves a gap at \(x = 0\). This can be fixed by adding the discontinuity=Inf argument. This is not required knowledge. This argument turns off discontinuity detection in plotFun, which actually fixes the problem here.
    g=makeFun(abs(x)~x)
    
    plotFun(g(x)~x,xlim=range(-3,3),ylim=range(-3,3),discontinuity=Inf)
    mathaxis.on()
    grid.on()

    1. As we did last time, create the approximation to the derivative. Plot this in red, adding to the existing plot. Note that plotFun adds a vertical line at the discontinuity. This is due to the nature of plotFun. Also not required knowledge, but you can remove this by restricting npts to be 80.
    g_deriv=makeFun((g(x+0.01)-g(x))/0.01~x)
    
    plotFun(g_deriv(x)~x,col="red",add=TRUE,npts=80)

  3. Now we pivot a little and discuss higher order derivatives. Since derivatives are functions, they also have derivatives themselves. The derivative of the derivative of \(f(x)\) is known as the second derivative as is denoted as \(f''(x)\). Let \(f(x) = x^{3} - 5x\). Define this function in R and plot it, along with the approximations of \(f'(x)\) and \(f''(x)\).

    f=makeFun(x^3-5*x~x)
    
    plotFun(f(x)~x,xlim=range(-3,3),col="darkslateblue")
    mathaxis.on()
    grid.on()
    
    f_deriv=makeFun((f(x+0.001)-f(x))/0.001~x)
    
    f_deriv2=makeFun((f_deriv(x+0.001)-f_deriv(x))/0.001~x)
    
    plotFun(f_deriv(x)~x,col="deepskyblue4",add=TRUE)
    
    plotFun(f_deriv2(x)~x,col="goldenrod4",add=TRUE)

    Discuss what this means with respect to concavity of \(f(x)\).

  4. If there’s time, they should go back to Exercises 29-41 and sketch the first AND second derivatives of these functions.

4.4 Lesson 30: Derivatives of Basic Functions

4.4.1 Objectives

  1. Use the 1st & 2nd derivatives to characterize a function (increasing/decreasing, local extrema, concavity, inflection points).

  2. Find the derivatives of basic power functions using the power rule by hand.

  3. Find the derivatives of basic modeling functions by hand (exponential, sinusoidal, logarithmic, etc.).

  4. Compute derivatives of linear combinations of functions using the constant rule, constant multiple rule, and sum/difference rules.

  5. In R, use the D command to find the derivative of a given function.

4.4.2 Reading

Section 4.3.

4.4.3 In class

  1. Review. Start with a review of the relationships of functions and their derivatives. They should notice that the derivative of a cubic function looked parabolic. Also its second derivative appeared linear.

  2. Power Rule. Introduce the power rule. Note that the derivative of a linear function is a constant (the line’s slope), and the derivative of a constant is 0 (constant = unchanging). Also point out the arithmetic rules on page 393.

  3. Derivatives of Basic Functions. Introduce the derivatives of basic functions (page 395). They should know these off the top of their heads. The text also gives an “extended” version of the exponential rule on page 396. You don’t need to go over the generalized chain rule yet, since we’ll cover that later.

  4. Using R to Obtain a Derivative. Introduce the D function. We can use this to obtain the derivative of a function. The output of this function is a function as we’ve been using them. We can use the result to plot the derivative, evaluate at certain inputs, etc.

4.4.4 R Commands

makeFun, plotFun, D

4.4.5 Problems & Activities

  1. Start with the same cubic example as before. Approximate the first and second derivatives and plot them. Discuss the relationship between the three with respect to increasing, decreasing, minimum, maximum, concavity, and inflection points.

    Discuss the behavior of the derivative of this cubic function. Note it looks quadratic. Also, note the second derivative looks linear. This suggests that as we take derivatives of polynomials, the order of the resulting polynomials is reduced. This leads us to the power rule.

  2. They should be able to remember that \(\frac{d}{dx}x^{n} = nx^{n-1}\). Also, they should be able to remember the rules on derivatives of linear combinations. For practice, they should spend about 5 minutes at their desks or at the board finding the derivatives of basic polynomials. I recommend any of exercises 9-24.

  3. Go over the derivatives of other basic functions. As an example start with \(f(x) = e^{x}\). Define it in R, plot it, and then define and plot its approximate derivative. Note that the derivative is the same function, \(e^{x}\).

    f=makeFun(exp(x)~x)
    
    
    plotFun(f(x)~x,xlim=range(-3,3))
    mathaxis.on()
    
    f_deriv=makeFun((f(x+0.001)-f(x))/0.001~x)
    
    plotFun(f_deriv(x)~x,col="red",add=TRUE)

  4. Do the same thing with \(f(x) = \sin x\). This is a good time to remind them that the derivative is describing instantaneous rate of change of \(f\) at a given input.

    f=makeFun(sin(x)~x)
    
    plotFun(f(x)~x,xlim=range(-5,5))
    mathaxis.on()
    
    f_deriv=makeFun((f(x+0.001)-f(x))/0.001~x)
    
    plotFun(f_deriv(x)~x,col="red",add=TRUE)

  5. Also note that \(\frac{d}{dx}\cos x = -\sin x\), \(\frac{d}{dx}\log x = \frac{1}{x}\) (when \(x > 0\)), and \(\frac{d}{dx}a^{x} = a^{x}\log(a)\). Also introduce the extended exponential rule: \(\frac{d}{dx}e^{mx + b} = me^{mx + b}\).

  6. Spend a little more time practicing these skills. For exercises 33-52, they should be able to find the derivative of each function.

  7. Introduce the D function. This function requires a tilde expression. The left side of this can be either a mathematical expression or a previously defined function. Suppose \(f(x) = x^{3} - 5x\):

    D(x^3-5*x~x)
    ## function (x) 
    ## 3 * x^2 - 5

    Is the same as:

    f=makeFun(x^3-5*x~x)
    
    D(f(x)~x)
    ## function (x) 
    ## 3 * x^2 - 5

    Emphasize that the D function outputs a usable function that we can plot and evaluate at certain inputs. As an example:

    Df=D(f(x)~x)
    
    plotFun(f(x)~x,xlim=range(-3,3))
    mathaxis.on()
    
    plotFun(Df(x)~x,col="red",add=TRUE)

    f(0)
    ## [1] 0
    Df(0)
    ## [1] -5

4.5 Lesson 31: Product & Quotient Rules I

4.5.1 Objectives

  1. Use the derivative of a function at a given input to obtain a linear approximation of that function at the given input.

  2. Use the product and quotient rules to find derivatives of functions by hand.

  3. In R, use the D command to find the derivative of a given function.

4.5.2 Reading

Section 4.4.

4.5.3 In class

  1. Review of Basic Derivative Rules. Start with a basic derivative practice. Give the first 15 minutes or so to the cadets to practice finding derivatives by hand AND in R.

  2. Linear Approximations. We’ve already covered tangent lines in the first lesson of this block. Now we will use the actual derivative evaluated at a point to obtain a linear approximation (or tangent line) to a function. We won’t go into Taylor polynomials, but we should note that we can add additional terms (higher order derivatives) to obtain a more accurate approximation.

  3. Product Rule. Introduce the product rule (page 409). Note that unlike linear combinations, the derivative of a product of functions is not the product of the derivatives. Go through an example.

  4. Quotient Rule. Introduce the quotient rule (page 413). We will “prove” this when we get to the chain rule. Also, some of your cadets might have seen calculus before and have heard of “lo-di-hi, hi-di-lo”. Feel free to discuss this. Go through an example.

  5. Examples. Give the rest of the class to practice. Cadets should know that they will be expected to demonstrate proficiency in the product & quotient rules BY HAND as well as with R.

4.5.4 R Commands

makeFun, plotFun, D

4.5.5 Problems & Activities

  1. The first 10 minutes or so of this lesson should be dedicated to review and practice. Any of exercises 9-52 are recommended. They should be able to do all of these by hand and in R. I typically let them choose which method to use based on what they feel they need to practice, but feel free to organize the practice as you see fit.

  2. Going back to our previous example: \(f(x) = x^{3} - 5x\). We can build a line tangent to this function at \(x = 1\) by using the method from lesson 27: \(y = f(1) + f'(1)(x - 1)\). To do this, we simply need to find the derivative of \(f\) evaluated at 1:

    f=makeFun(x^3-5*x~x)
    
    Df=D(f(x)~x)
    
    tangent=makeFun(f(1)+Df(1)*(x-1)~x)
    
    plotFun(f(x)~x,xlim=range(-3,3))
    mathaxis.on()
    
    plotFun(tangent(x)~x,add=TRUE,col="coral3")

    Note that this tangent line is an approximation to \(f(x)\) in the neighborhood of \(x = 1\). It takes advantage of the output at \(x = 1\) AND the instantaneous rate of change at \(x = 1\).

    We can refine our approximation by considering behavior specified by higher order derivatives.

  3. Introduce the product rule. Don’t worry about the proof of this, and if they ask, tell them this requires the limit definition of the derivative, which is covered in section 4.7 for their perusal. There are also online resources that explain this well. Our focus should be on application of this rule.

    Let \(f(x) = 3x^{2}e^{x}\). This function is the product of two other functions, \(g(x) = 3x^{2}\) and \(h(x) = e^{x}\). We find \(f'(x)\) using the product rule:

    \[f'(x) = g'(x)h(x) + g(x)h'(x) = 6xe^{x} + 3x^{2}e^{x}\]

    We can confirm this using D. Also we should plot it as well.

    f=makeFun(3*x^2*exp(x)~x)
    
    Df=D(f(x)~x)
    
    Df
    ## function (x) 
    ## 3 * (x^2 * exp(x) + 2 * x * exp(x))
    plotFun(f(x)~x,xlim=range(-1,1),ylim=range(-4,12))
    mathaxis.on()
    
    plotFun(Df(x)~x,col="red",add=TRUE)

  4. Now introduce the quotient rule. Again, our focus should be on application of this, but we’ll come back to this when we get to the chain rule. Demonstrate an example:

    Let \(f(x) = \frac{\sin x}{x^{2}}\). Note that this is a quotient between two functions, \(g(x) = \sin x\) and \(h(x) = x^{2}\). We find \(f'(x)\) using the quotient rule:

    \[f'(x) = \frac{g'(x)h(x) - g(x)h'(x)}{[h(x)]^{2}} = \frac{x^{2}\cos x - 2x\sin x}{x^{4}} = \frac{\cos x}{x^{2}} - \frac{2\sin x}{x^{3}}\]

    f=makeFun(sin(x)/x^2~x)
    
    Df=D(f(x)~x)
    
    Df
    ## function (x) 
    ## (cos(x) * x - 2 * sin(x))/x^3
    plotFun(f(x)~x,xlim=range(-3,3),ylim=range(-5,5))
    mathaxis.on()
    
    plotFun(Df(x)~x,col="red",add=TRUE)

  5. The rest of this lesson should be dedicated to practice (1-52). The text has a wealth of example problems. Keep in mind that we have four lessons dedicated to the product, quotient and chain rules, so there is time for creative practice. They should be sound in doing this “by hand” and with R.

4.6 Lesson 32: Product & Quotient Rules II

4.6.1 Objectives

  1. Use basic derivative rules and the product/quotient rules to find derivatives of functions by hand.

  2. Using R, obtain and plot the derivative of a function.

4.6.2 Reading

Section 4.3-4.4.

4.6.3 In class

  1. Derivatives Practice. Start with a reminder of the basic derivative rules and of the product/quotient rules. The rest of the time should be dedicated to practice (on the board, at their desks, however you like).

4.6.4 R Commands

makeFun, plotFun, D

4.6.5 Problems & Activities

  1. This lesson should be dedicated to practice. Exercises 9-52 from section 4.3 as well Exercises 1-52 from section 4.4. Cadets should be able to complete these by hand and by using R. For each problem, they should find the derivative by hand and by creating a function in R and using the D function to obtain the derivative.

  2. If you would like, you can introduce or motivate the chain rule prior to the end of the lesson. We will cover this next time.

4.7 Lesson 33: Chain Rule I

4.7.1 Objectives

  1. Given two functions, find the specified composition of the two functions. Recognize that the order of composition matters.

  2. Given a composition of functions, identify the inside function and the outside function.

  3. Use the chain rule to find the derivative of a composition of functions by hand.

4.7.2 Reading

Section 4.5.

4.7.3 In class

  1. Derivatives Practice. Start the lesson with a little practice. Spend about 10-15 minutes on this.

  2. Compositions of Functions. Introduce the idea of composition of functions. Spend some time focusing on the “inside” and “outside” function. Being able to identify these will help with the chain rule.

  3. Chain Rule. Introduce the chain rule (Page 428). Demonstrate on a function and then allow them some time to practice. They should identify the inside and outside functions prior to executing the chain rule.

4.7.4 R Commands

makeFun, plotFun, D

4.7.5 Problems & Activities

  1. Start with some practice problems. Perhaps any of 25-44 from section 4.4.

  2. We’ve talked about linear combinations of functions and we’ve talked about products of functions. Another way to combine functions is through composition: applying an input to a function and then applying that output as the input of another function. Symbolically, the composition of a function \(f\) with a function \(g\) is \(f \circ g (x) = f[g(x)]\). The first function (in this case \(f\)) is the “outside” function. The second function is the “inside” function.

    Consider \(f(x) = x^{2}\) and \(g(x) = \sin x\). Then \(f \circ g(x) = f[g(x)] = f(\sin x) = (\sin x)^{2}\).

  3. Note that while \(f(x) + g(x) = g(x) + f(x)\) and \(f(x)g(x) = g(x)f(x)\), this does not hold with compositions: \(f \circ g(x)\) is not necessarily equal to \(g \circ f(x)\).

    Consider \(f\) and \(g\) as defined above. \(g \circ f(x) = g(x^{2}) = \sin x^{2}\).

    plotFun((sin(x^2))~x,xlim=c(-6,6))
    mathaxis.on()
    plotFun((sin(x))^2~x,add=TRUE,col="coral3")

  4. Given a composition, we should identify the “outside” and “inside” functions. For example, consider the function \(h(x) = (x^{2} - 3)^{5}\). This is a composition. The inside function is \(g(x) = x^{2} - 3\), while the outside function is \(f(x) = x^{5}\). So,

    \[h(x) = f[g(x)] = f(x^{2} - 3) = (x^{2} - 3)^{5}\]

  5. Example 2 in text. For the following compositions, identify the inside and outside functions:

    \[h(x) = e^{x^{2} + 3x + 1}\]

    \[m(x) = \sin(x^{2}) + 1\]

  6. The Chain Rule. To take the derivative a composition of functions, we need to use the chain rule:

    \[\frac{d}{dx}[f(g(x))] = f'[g(x)] \cdot g'(x)\]

    We take the derivative of the outside function (leaving the inside function unchanged), then multiply by the derivative of the inside function. As a demonstration, let \(h(x) = (x^{2} - 3)^{5}\). The inside function is \(g(x) = x^{2} - 3\) and the outside function is \(f(x) = x^{5}\). So, we take the derivative of \(g(x)^{5}\) first, leaving \(g(x)\) unchanged: \(5g(x)^{4} = 5(x^{2} - 3)^{4}\). Then we multiply by the derivative of the inside function: \(g'(x) = 2x\). Putting it together:

    \[h'(x) = 5(x^{2} - 3)^{4} \times 2x = 10x(x^{2} - 3)^{4}\]

  7. The rest of the class should be dedicated to practice. First, I recommend Example 3 from page 429. Then Example 4 on the same page. Next I recommend Exercises 19-36 on page 437.

4.8 Lesson 34: Chain Rule II

4.8.1 Objectives

  1. Use basic rules, the product/quotient rules, and the chain rule to find derivatives of functions by hand.

  2. Using R, obtain and plot the derivative of a function.

4.8.2 Reading

Section 4.5.

4.8.3 In class

  1. Derivatives Practice. Start with a reminder of the basic derivative rules, the product/quotient rules, and the chain rule. The rest of the time should be dedicated to practice (on the board, at their desks, however you like).

4.8.4 R Commands

makeFun, plotFun, D

4.8.5 Problems & Activities

  1. This lesson should be dedicated to derivative practice. Any of the fundamental skills derivative practice problems from Sections 4.3, 4.4, and 4.5 are great. Remind the cadets that they will be assessed on their ability to find derivatives using the product and chain rules without using R.

  2. Also, exercises 67-70 from Section 4.5 are a great opportunity to remind them of the meaning of the derivative.

4.9 Lesson 35: Derivative Review

4.9.1 Objectives

  1. Use basic rules, the product/quotient rules, and the chain rule to find derivatives of functions by hand.

  2. Using R, obtain and plot the derivative of a function.

4.9.2 Reading

N/A

4.9.3 In class

  1. Derivatives Practice. Start with a reminder of the basic derivative rules, the product/quotient rules, and the chain rule. The rest of the time should be dedicated to practice (on the board, at their desks, however you like).

  2. Practice, practice, practice.

4.9.4 R Commands

N/A

4.9.5 Problems & Activities

  1. N/A

4.10 Lesson 37: Partial Derivatives I

4.10.1 Objectives

  1. Given a tabular function or contour plot, approximate the rate of change at a given point with respect to each input variable.

  2. Describe the partial derivative of a multivariable function as the instantaneous rate of change with respect to a single input.

  3. Compute partial derivatives of a multivariable function by hand using derivative rules.

  4. Write and understand the following partial derivative notations: Leibniz (“fraction with curly d”) and subscript notation.

4.10.2 Reading

Section 4.6.

4.10.3 In class

  1. Derivatives Practice. Start the lesson with derivatives practice. Spend about 5 minutes on this.

  2. Refresher on Functions with Multiple Inputs. Remind them that in Block 1, we introduced functions with more than one input. We presented these in tabular, functional, and graphical forms. We also used tabular and graphical representations to determine whether a function was increasing or decreasing with respect to one of the input variables.

  3. Quantifying Change in Multivariable Function. Starting with the tabular function then moving to contour plots, go over how to approximate how the function changes with respect to a particular variable. Emphasize that how the function changes can depend on the value of the other variable.

  4. Partial Derivatives. Introduce partial derivatives as an extension of derivatives in the single variable case. To speak of rate of change of a multivariable function, we focus on one input variable at a time. The derivative of a multivariable function exists, but we must specify which input variable this derivative is with respect to, thus the term “partial derivative”.

  5. Finding Partial Derivatives. Discuss how finding a partial derivative requires applying familiar techniques, but treating other input variables as constants. Demonstrate with our example function, and allow them to practice.

4.10.4 R Commands

makeFun, plotFun

4.10.5 Problems & Activities

  1. Start with some practice problems. Perhaps any of 37-60 from section 4.5.

  2. Move into a refresher of multivariable functions. Just like in Block 1, all of the concepts we’ve covered thus far apply to the functions with more than one input. As a quick reminder, consider Example 2 on page 445 (the wind chill example).

    1. Find the windchill at 10 degrees and wind speed of 25 mph.

    2. At a temperature of 5 degrees, if the wind speed increases, what happens to windchill?

    3. At a temperature of 5 degrees, what is the approximate rate of change in wind chill between wind speeds of 10 and 15 mph?

    4. At a windspeed of 25 mph, what is the approximate rate of change in wind chill between temperatures -10 and 0 degrees?

  3. Now introduce a multivariable function in analytic or equation form:

    \[f(x,y) = xy^{2} + x^{3}\]

    We can define this function in R and then plot it:

    f=makeFun(x*y^2+x^3 ~ x & y)
    plotFun(f(x,y) ~ x & y)

    I don’t want the colors, so I’ll add a filled=F argument. I can also control the input limits using xlim and ylim.

    plotFun(f(x,y) ~ x & y,filled=FALSE,xlim=range(0,2),ylim=range(0,2))

    I could also control where the contours appear if I like, or the width, color, and type of the contour lines.

    plotFun(f(x,y) ~ x & y, filled=FALSE, xlim=range(0,2), ylim=range(0,2), 
            levels=c(0:15),lwd=3,col="black",lty=2)

    1. What is the value of \(f(1,1)\)?

    2. If \(y = 0.5\), describe the change in \(f(x,y)\) along the \(x\)-axis. Approximate the rate of change in \(f(x,y)\) at \(x = 1\).

  4. The rate of change of a multivariable function is described by partial derivatives. Given a function \(f(x,y)\), the partial derivative of \(f\) with respect to \(x\) describes how the function changes as \(x\) changes, holding \(y\) constant, and can be denoted by \(\frac{\partial}{\partial x}f(x,y)\). Similarly the partial derivative of \(f\) with respect to \(y\) can be denoted by \(\frac{\partial}{\partial y}f(x,y)\). For this class, please introduce and use the notation \(\mathbf{f}_{\mathbf{x}}\mathbf{(x,\ y)}\) and \(\mathbf{f}_{\mathbf{y}}\mathbf{(x,\ y)}\) as in the textbook.

  5. Introduce how to find partial derivatives by taking the derivative using familiar techniques, treating the other variable as a constant.

  6. Allow students to practice taking partial derivatives. You can use Example 4 on page 447, and Question 4 and Example 5 on page 449.

4.11 Lesson 38: Partial Derivatives II

4.11.1 Objectives

  1. Using R, compute partial derivatives of a multivariable function.

  2. Obtain higher order partial derivatives of multivariable functions by hand.

  3. Use partial derivatives to obtain a linear approximation of a multivariable function at a given point.

4.11.2 Reading

Section 4.6.

4.11.3 In class

  1. Partial Derivatives. From last time, re-introduce partial derivatives. Starting with our function from last time, talk about the partial derivatives with respect to \(x\) and \(y\) and how to interpret these functions.

  2. Finding Partial Derivatives. Discuss how finding a partial derivative requires applying familiar techniques, but treating other input variables as constants. Demonstrate with our example function and allow them to practice.

  3. Finding Partial Derivatives with R. Demonstrate how we use D to find partial derivatives. Plot a partial derivative and interpret it. Allow them to practice.

  4. Higher Order Partial Derivatives. Just like univariate functions have higher order derivatives, so do multivariable. They should know that higher order partial derivatives are effectively a sequence of individual partial derivatives. They should also know that, as in the univariate case, higher order derivatives describe the behavior of multivariable functions. However, per the objective, they will only have to obtain the higher order partial derivative, not interpret.

  5. Linear Approximations. The linear approximation (equation to tangent line) we found earlier in this block can be extended to multivariable functions. They should be able to apply the approximation formula from page 455.

4.11.4 R Commands

makeFun, plotFun, D

4.11.5 Problems & Activities

  1. Revisit the example from last time:

    \[f(x,y) = xy^{2} + x^{3}\]

    We can define this function in R:

    f=makeFun(x*y^2+x^3 ~ x & y)
    1. Find and plot the derivative of \(f\) with respect to \(x\), or \(f_{x}(x,y)\).

      We find this by using familiar derivative techniques, but by treating the other variable, \(y\), as a constant. So,

      \[f_{x}(x,y) = y^{2} + 3x^{2}\]

    2. Let’s plot this function when \(y = 1\). You can think of this as the rate of change of a slice of \(f\), when \(y = 1\). Demonstrate this graphically.

    Df=makeFun(y^2 + 3*x^2 ~ x & y)
    plotFun(Df(x,y=1) ~ x, xlim=c(0,2))

    1. Find the partial derivative of \(f\) with respect to \(y\). Plot this when \(x = 1.5\).

      \[f_{y}(x,y) = 2xy\]

    Dfy=makeFun(2*x*y~x & y)
    plotFun(Dfy(x=1.5,y)~y,xlim=range(0,2))

  2. Give them time to work on a couple practice exercises (Sec 4.6 33-62).

  3. We can do this in R as well. Given a multivariable function, we can use D to find a partial derivative, making sure to specify which variable we are differentiating with respect to. There is a noticeable difference in using D for multivariable functions. When we apply D, we need to input the original tilde expression, not the defined function f. If we reference the defined function, we will get a numerical function. This works for finding instantaneous rate of change and for plotting, but if you want the formulaic expression, we need to use the original tilde expression. For example:

    f=makeFun(x*y^2+x^3 ~ x & y)
    Dfx=D(f(x,y)~x)
    Dfx
    ## function (x, y) 
    ## 3 * x^2 + y^2

    This is different than

    Dfx=D(x*y^2+x^3~x)
    Dfx
    ## function (x, y) 
    ## 3 * x^2 + y^2
    Dfy=D(x*y^2+x^3~y)
    Dfy
    ## function (x = 2, y) 
    ## 2 * x * y
  4. Practice with Exercises 63-74 in Section 4.6.

  5. Now introduce the concept of higher order partial derivatives. Just like in the single variable case, we can take higher order partial derivatives. The second derivative with respect to an input variable represents the concavity of the function with respect to that variable. A “mixed partial” is one that involves taking the partial derivative with respect to multiple input variables. Finding a higher order partial derivative is straightforward: take one derivative at a time.

  6. Example (Question 9 from text page 453): Let \(g(x,y) = x^{4}\sin y\). Find all second partials of \(g\).

    \[g_{xx}(x,y) = \frac{\partial^{2}}{\partial x^{2}}g(x,y) = \frac{\partial}{\partial x}\frac{\partial}{\partial x}x^{4}\sin y = \frac{\partial}{\partial x}4x^{3}\sin y = 12x^{2}\sin y\]

    \[g_{yy}(x,y) = \frac{\partial^{2}}{\partial y^{2}}g(x,y) = \frac{\partial}{\partial y}\frac{\partial}{\partial y}x^{4}\sin y = \frac{\partial}{\partial y}x^{4}\cos y = - x^{4}\sin y\]

    \[g_{xy}(x,y) = \frac{\partial}{\partial y}\frac{\partial}{\partial x}x^{4}\sin y = \frac{\partial}{\partial y}4x^{3}\sin y = 4x^{3}\cos y\]

    \[g_{yx}(x,y) = \frac{\partial}{\partial x}\frac{\partial}{\partial y}x^{4}\sin y = \frac{\partial}{\partial x}x^{4}\cos y = 4x^{3}\cos y\]

  7. Practice with Exercises 79-86 in Section 4.6.

  8. Just like in the univariate case, we can build a linear approximation to a function at a particular point. You can use Example 10 or Question 11 on page 455.