question id: grass-grows-orange-1
Chap 25 Exercises
\[ \newcommand{\dnorm}{\text{dnorm}} \newcommand{\pnorm}{\text{pnorm}} \newcommand{\recip}{\text{recip}} \]
Exercise 1 The graphics that follow are contour plots of functions of two inputs overlaid with variously colored arrows. In each graphic, your task is to identify the color arrow, if any, that correctly corresponds to the gradient of the function being graphed.
- Which color arrow is drawn correctly to represent the gradient at that point of function (A)?
- Which color arrow is drawn correctly to represent the gradient at that point of function (B)?
question id: grass-grows-orange-2
- Which color arrow is drawn correctly to represent the gradient at that point of function (C)?
question id: grass-grows-orange-3
- Which color arrow is drawn correctly to represent the gradient at that point of function (D)?
question id: grass-grows-orange-4
Exercise 2 In Figure 1, the contour plot of function \(g(y, z)\) is overlaid with vectors. The black vector is a correct representation of the gradient (at the root of the vector). The other vectors are also supposed to represent the gradient, but might have something wrong with them (or might not). You’re job is to say what’s wrong with each of those vectors.
- What’s wrong with the red vector?
nothing
too long
too short
points downhill
points uphill
wrong direction entirely
question id: grass-grows-red-1
- What’s wrong with the green vector?
nothing
too long
too short
points downhill
points uphill
wrong direction entirely
question id: grass-grows-red-2
- What’s wrong with the blue vector?
nothing
too long
too short
points downhill
points uphill
wrong direction entirely
question id: grass-grows-red-3
- What’s wrong with the orange vector?
nothing
too long
too short
points downhill
points uphill
wrong direction entirely
question id: grass-grows-red-4
- What’s wrong with the gray vector?
nothing
too long
too short
points downhill
points uphill
question id: grass-grows-red-5
Exercise 3 The gradient plot below is marked with several colored lines which represent slices through the surface. Your job is to match these up with the slice plots presented below.
In the slice plots, the input \(t\) reflects the position on the slice. At \(t=0\), position is at the leftmost point of the slice, while at \(t=1\) position is at the right terminus of the slice.
- Which color line corresponds to slice 1?
black
gray
blue
tan
yellow
question id: gradient-field-violet-1
- Which color line corresponds to slice 2?
black
gray
blue
tan
yellow
question id: gradient-field-violet-2
- Which color line corresponds to slice 3?
black
gray
blue
tan
yellow
question id: gradient-field-violet-3
- Which color line corresponds to slice 4?
black
gray
blue
tan
yellow
question id: gradient-field-violet-4
Exercise 4 It is relatively easy to assess partial derivatives when you know the gradient. After all, the gradient is the vector of \((\partial_x\,f(x,y), \partial_y f(x,y))\). To train your eye, Figure 2 shows contour plot and a corresponding gradient plot.
- What is the rule for determining \(\partial_x f(x,y)\) from the direction of the gradient vector?
If the vector has a component pointing right, \(\partial_x f\) is positive.
If the vector has a component pointing left, \(\partial_x f\) is positive
If the vector has a vertical component pointing up, \(\partial_x f\) is positive.
If the vector has a component pointing downward, the partial derivative \(\partial_x f\) is positive.
question id: gradient-field-orange-1
- What is the rule for determining \(\partial_y f(x,y)\) from the direction of the gradient vector?
If the vector has a component pointing right, \(\partial_y f\) is positive.
If the vector has a component pointing left, \(\partial_y f\) is positive.
If the vector has a vertical component pointing up, \(\partial_y f\) is positive.
If the vector has a component pointing downward, the partial derivative \(\partial_y f\) is positive.
question id: gradient-field-orange-2
Exercise 5 Here are contour maps and gradient fields of several functions with input \(x\) and \(y\). But any row of graphs may show two different functions. Your job is to match the contour plot with the gradient field, which may be in another row.
- Which contour plot matches gradient field 1?
question id: gradient-field-red-1
- Which contour plot matches gradient field 2?
question id: gradient-field-red-2
- Which contour plot matches gradient field 3?
question id: gradient-field-red-3
- Which contour plot matches gradient field 4?
question id: gradient-field-red-4
- Which contour plot matches gradient field 5?
question id: gradient-field-red-5
- Which contour plot matches gradient field 6?
question id: gradient-field-red-6
Exercise 6 Figure 4 shows the gradient field of a function. Imagine that the function represents the height of a smooth surface and that a drop of water has been placed at one of the lettered points. That drop will slide down the surface. Your job is to figure out where the drop ends up.
- A drop is placed at point F. Which point does it slide by (or stop at)?
question id: gradient-field-tan-1
- A drop is placed at point A. Where will it end up?
question id: gradient-field-tan-2
- If many drops fell at random on the surface, a lake would form at one of these points. Which one?
question id: gradient-field-tan-3
Exercise 7 For the gradient field in Figure 5, what is the sign of the partial derivatives at the labeled points? We will use “neg” to refer to negative partial derivatives, “pos” to refer to positive partial derivatives, and “zero” to refer to partials that are so small that you cannot visually distinguish them from zero.
- Which is \(\partial_y f\) at point A?
question id: bid3-1
- Which is \(\partial_x f\) at point A?
question id: bid3-2
- Which is \(\partial_x f\) at point B?
question id: bid3-3
- Which is \(\partial_x f\) at point C?
question id: bid3-4
- Which is \(\partial_y f\) at point E?
question id: bid3-5
- Which is \(\partial_x f\) at point E?
question id: bid3-6
- At which letter are both the partial with respect to \(x\) and the partial with respect to \(y\) negative.?
question id: bid3-7
Exercise 8 Each of the figures below shows a contour plot and a gradient field. For some of the figures, the contour plot and the gradient field show the same function, for others they do not. Your task is to identify whether the contour plot and the gradient field are of the same or different functions.
- For Figure A, do the contour plot and the gradient field show the same function?
question id: child-hide-lamp-1
- For Figure B, do the contour plot and the gradient field show the same function?
question id: child-hide-lamp-2
- For Figure C, do the contour plot and the gradient field show the same function?
question id: child-hide-lamp-3
- For Figure D, do the contour plot and the gradient field show the same function?
question id: child-hide-lamp-4
For Figure E, do the contour plot and the gradient field show the same function?
question id: child-hide-lamp-5
For Figure F, do the contour plot and the gradient field show the same function?
question id: child-hide-lamp-6
Exercise 9 Figure 6 shows a contour plot of a function \(g(x,y)\). You will be presented with several gradient fields. Your task is to determine whether the gradient field corresponds to the contour plot and, if not, say why not.
- What’s wrong with gradient field 1?
arrows point down the hill instead of up it
magnitude of arrows are wrong, but direction is right
arrows don’t point in the right direction
nothing is wrong
question id: gradient-field-blue-1
- What’s wrong with gradient field 2?
arrows point down the hill instead of up it
magnitude of arrows are wrong, but direction is right
arrows don’t point in the right direction
nothing is wrong
question id: gradient-field-blue-2
- What’s wrong with gradient field 3?
arrows point down the hill instead of up it
magnitude of arrows are wrong, but direction is right
arrows don’t point in the right direction
nothing is wrong
question id: gradient-field-blue-3
- What’s wrong with gradient field 4?
arrows point down the hill instead of up it
magnitude of arrows are wrong, but direction is right
arrows don’t point in the right direction
nothing is wrong
question id: gradient-field-blue-4
Exercise 10 When discussing functions with a single input, it was easy to distinguish between the function itself and the output of the function for a specific input. We use the following conventions, some of which may be obvious and others not so much.
- \(f()\) — Function itself. Since there is only one input it does not matter what the name is.
- \(f(x)\) — Function itself. \(x\) is the name of an input, not the specific value an input.
- \(f(2)\) — The value of the output when \(f()\) is applied to the input value 2.
- \(f(x)\left.{\Large\strut}\right|_{x=2}\). This distinct vertical bar notation means, take the function \(f(x)\) and evaluate it at input value 2.
- \(f(x=2)\) — Same thing as (d).
These conventions don’t tell us how to read expressions involving \(\partial_x\) or \(\partial_t\), etc.
To avoid ambiguity we need to stipulate the meaning of different notation forms. We will frame this as a question of “operator precedence” of the same sort used in interpreting an expression like \(3 x^2\) as meaning \(3 \left(x^2\right)\).
- When the prime notation is used, as in \(f'(2)\), the prime has precedence over everything else except parentheses. Thus, the product rule is \[(fg)' = f'g + fg'\] where the right-side of the equation means “the function \(f'\) multiplied by the function \(g\) plus the function \(g'\) multiplied by the function \(f\).”
- When using the \(\partial_x\) notation, \(\partial_x\) has precedence over evaluation whenever there is a matching \(x\) in the expression being evaluated. For instance:
- \(\partial_x f(x=2)\) means, “apply the function \(\partial_x f(x)\) to the specific input 2.”
- \(\partial_x f(x) \left.{\Large\strut}\right|_{x=2}\) means the same thing as (i).
- \(\partial_x f(2)\) means something different: “Evaluate \(f()\) on the specific input 2. The result will be a specific output value. The derivative of a specific output value will always be zero.”
That leaves the question of \(\partial_x f()\). There is no mention of \(x\) being the input to \(f()\). So we will deem \(\partial_x f()\) to be sloppy and ambiguous. We will try to avoid this usage. Draw any such cases to the authors’ attention so they can be corrected.
Suppose we define two functions: \(f(x) \equiv x^2/2\) and \(g(x) \equiv x/2\). With these definitions, evaluate the expressions given below.
- \(\partial_t g(t=2)\)
question id: crow-begin-bottle-1
- \(\partial_x g(t=2)\)
question id: crow-begin-bottle-2
- \(\partial_t f(x=2) g(t=2)\)
question id: crow-begin-bottle-3
- \(\partial_x f(2)\, g(t=2)\)
question id: crow-begin-bottle-4
- \(\partial_x f(x=1)\)
question id: crow-begin-bottle-5
- \(\partial_x f() g()\)
question id: crow-begin-bottle-6
Exercise 11 Figure 7 shows a close up of a function around a reference point at the center of the graph.
For the following questions, estimate by eye these derivatives of the function at the reference point \((x_0=-2, y_0=-5)\).
- What is the numerical value of \(\partial_x g(x,y)\) at the reference point?
question id: partial-tan-1
- What is the numerical value of \(\partial_y g(x,y)\) at the reference point?
question id: partial-tan-2
The next questions ask about second-order partial derivatives. As you know, the second derivative is about how the first derivative changes with x or y. Insofar as the function is a simple inclined plane, where the contours would be straight, parallel, and evenly spaced, the second derivatives would all be zero. But you can see that it is not such a plane: the contours curve a bit.
In determining the second derivatives by eye from the graph, you are encouraged to compare first derivatives at the opposing edges of the graph, as opposed to at very nearby points.
- What is the sign of \(\partial_{xx} g(x,y)\) at the reference point?
question id: partial-tan-3
- What is the sign of \(\partial_{yy} g(x,y)\) at the reference point?
question id: partial-tan-4
- What is the sign of \(\partial_{xy} g(x,y)\) at the reference point?
question id: partial-tan-5
- What is the sign of \(\partial_{yx} g(x,y)\) at the reference point?
question id: partial-tan-6
Exercise 20 For almost everyone, a house is too expensive to buy with cash, so people need to borrow money. The usual form of the loan is called a “mortgage”. Mortgages extend over many years and involve paying a fixed amount each month. That amount is calculated so that, by paying it each month for the duration of the mortgage, the last payment will completely repay the amount borrowed plus the accumulated interest.
The monthly mortgage payment in dollars, \(P\), for a house is a function of three quantities, \[P(A, r, N)\] where \(A\) is the amount borrowed in dollars, \(r\) is the interest rate (percentage points per year), and \(N\) is the number of years before the mortgage is paid off.
A studio apartment is selling for $220,000. You will need to borrow $184,000 to make the purchase.
- Suppose \(P(184000,4,10) = 2180.16\). What does this tell you in financial terms?
The monthly cost of borrowing $184,000 for 10 years at 4% interest per year.
The monthly cost of borrowing $184,000 for 4 years at 10% interest per year.
The annual cost of the mortgage at 4% interest for 10 years.
The annual cost of the mortgage at 10% interest for 4 years
question id: partial-house-1
The next two questions involve what happens to the monthly mortgage payments if you change either the amount or duration of the mortgage. (Hint: Common sense works wonders!)
Exercise 12
- What would you expect about the quantity \(\partial P / \partial A\), the partial derivative of the monthly mortgage payment with respect to the amount of money borrowed?
It is positive
It is zero
It is negative
question id: partial-house-2
- What would you expect about the quantity \(\partial P / \partial N\), the partial derivative of the monthly mortgage payment with respect to the number of years the mortgage lasts?
It is positive
It is zero
It is negative
question id: partial-house-3
- Suppose \(\partial_r P (184000,4,30) =\) $145.65. What is the financial significance of the number $145.65??
If the interest rate \(r\) went up from 4 to 5, the monthly payment would increase by $145.65.
If the interest rate \(r\) went up from 4 to 4.001, the monthly payment would increase by $145.65.
If the interest rate \(r\) went up from 4 to 4.001, the monthly payment would increase by $0.001 imes $145.65.
question id: partial-house-4
Exercise 13 Use Active R chunk 1 to make a contour plot of the function \(g(x)\) centered on the reference point \((x_0\!=\!0,\, y_0\!=\!0)\).
By making size
smaller, you can zoom in around the reference point. Zoom in gradually (say, size =
1.0, 0.5, 0.1, 0.05, 0.01) until you reach a point where the surface plot is (practically) a pretty simple inclined plane.
From the contour plot, zoomed in so that the graph shows an inclined plane, figure out the sign of \(\partial_x g(0,0)\) and \(\partial_y g(0,0)\).
Which answer best describes the signs of the partial derivatives of \(g(x,y)\) at the reference point \((x_0=0, y_0=0)\)?
\(\partial_x g(0,0)\) is pos, \(\partial_y g(0,0)\) is pos
\(\partial_x g(0,0)\) is pos, \(\partial_y g(0,0)\) is neg
\(\partial_x g(0,0)\) is neg, \(\partial_y g(0,0)\) is neg
\(\partial_x g(0,0)\) is neg, \(\partial_y g(0,0)\) is pos.
\(\partial_x g(0,0)\) is 0, \(\partial_y g(0,0)\) is pos
question id: partial-purple-1
Exercise 14 In economic theory, the quantity of the demand for any good is a decreasing function of the price of that good and an increasing function of the price of a competing good.
The classical example is that apple juice competes with orange juice. The demand for orange juice is in units of thousands of liters of orange juice. The price is in units of dollars per liter.
Here’s a graph with the input quantities unlabeled. The contour labels indicate the demand for orange juice.
The concept of partial derivatives makes it much easier to think about the situation. There are two partial derivative functions relevant to the function in the graph. Well denote the inputs apple
and orange
, but remember that these are the prices of those commodities in dollars per liter.
- \(\partial_\text{apple} \text{demand}()\) – how the demand changes when apple-juice price goes up, holding orange-juice price constant. (Another notation that is more verbose but perhaps easier to read \(\frac{\partial\, \text{demand}}{\partial\,\text{apple}}\))
- \(\partial_\text{orange} \text{demand}()\) – how the demand changes when orange-juice price goes up, holding apple-juice price constant. (Another notation: \(\frac{\partial\, \text{demand}}{\partial\,\text{orange}}\))
Notice that the notation names both the output and the single input which is to be changed–the other inputs will be held constant.
The first paragraph of this problem gives the economic theory which amounts to saying that one of the partial derivatives is positive and the other negative.
- What is the proper translation of the notation \(\partial_\text{apple}\text{demand}()\)?
The partial derivative of orange-juice demand with repect to apple-juice price
The partial derivative of apple-juice price with respect to demand for orange juice
The partial derivative of apple-juice demand with respect to price of apple juice
The partial derivative of orange-juice price with respect to apple-juice price.
question id: spider-blow-lamp-1
- According to the economic theory described above, one of the partial derivatives will be positive and the other negative. Which will be positive.
\(\partial_\text{apple} \text{demand}()\)
\(\partial_\text{orange} \text{demand}()\)
question id: spider-blow-lamp-2
- What does the vertical axis measure?
Price of orange juice
Quantity of apple juice
Quantity of orange juice
Price of apple juice
question id: spider-blow-lamp-3
- Consider the magnitude (absolute value) of the partial derivative of demand with respect to orange-juice price. Is this magnitude greater toward the top of the graph or the bottom?
top
bottom
neither
question id: spider-blow-lamp-4
Activities
Exercise 15 For \(f(x)\), a function with one input, the fundamental definition o the derivative of is: \[\partial_x f(x) \equiv \lim_{h\rightarrow 0} \frac{f(x+h) - f(x)}{h}\ .\]
Using this same style, write out the three forms of the derivatives of \(g(x, y, z)\) with respect to each of the inputs in turn.
\[\partial_x g(x, y, z) \equiv \lim_{h\rightarrow 0}\ \frac{g(x+h, y, z) - g(x, y, z)}{h}\]
\[\partial_y g(x, y, z) \equiv \lim_{h\rightarrow 0}\ \frac{g(x, y+h, z) - g(x, y, z)}{h}\]
\[\partial_z g(x, y, z) \equiv \lim_{h\rightarrow 0}\ \frac{g(x, y, z+h) - g(x, y, z)}{h}\]
Exercise 16 Figure 8 shows the effect of an imagined drug on heart rate. Each of the lines shows heart rate as a function of dose for a given age. The drug’s effect depends both on the dose of the drug and on the age of the person taking the drug.
Using the information shown in Figure 8, estimate numerically each of the following partial derivatives, giving proper units for each. (Heart rate is measured in “bpm” (beats per minute) and dose in “mg”.)
- The derivative \(\partial_\text{dose} HR\)
- at dose\(=275\), age\(=20\)
- at dose\(=275\), age\(=30\)
- at dose\(=275\), age\(=40\)
- \(\partial_\text{age} HR\) at dose\(=275\), age\(=30\).
- \(\partial_\text{dose} \partial_\text{dose} HR\) at dose\(=275\), age\(=30\).
- \(\partial_\text{age} \partial_\text{age} HR\) at dose\(=275\), age\(=30\).
- \(\partial_\text{age} \partial_\text{dose} HR\) at dose\(=275\), age\(=30\).
Figure 8 shows three slices through the function HR(dose, age). One slice is for age 20, one slice for age 30, and the last for age 40. This is a standard graphical format in the technical literature, sometimes called an interaction plot since it emphasizes the interaction between age and dose.
Figure 9 shows three contour plots. One of them corresponds to the function shown in Figure 8.
Exercise 17 The US National Weather Service provides this graphic for calculating the “heat index.” The output is the heat index, shown both quantitatively (the labels on the contours) and with color.
At a relative humidity of 30% and a temperature of 90 F give a numerical estimate (with units!) for the following quantities:
- The partial derivative of heat index with respect to temperature. ii. The partial derivative of heat index with respect to humidity.
Is the gradient vector longer on the left side of the graph than on the right side of the graph?
Is the gradient vector longer for high temperatures than for low temperatures?
Exercise 18 At numerous occasions in your professional life, you will be in one or both of these positions:
- You are a decision-maker being presented with the results of analysis conducted by a team of unknown reliability, and you need to figure out whether what they are telling you is credible.
- You are a member of the analysis team needing to demonstrate to the decision-maker that your work should be believed.
As an example, consider one of the functions presented in a comedy book, Geek Logic: 50 Foolproof Equations for Everyday Life (2006), by Garth Sundem. The particular function we will consider here is Dr()
, intended to help answer the question, “Should you go to the doctor?”
\[\text{Dr}(d, c, p, e, n, s) = \frac{\frac{s^2}{2} + e(n-e)}{100 - 3(d + \frac{p^3}{70} - c)}\] where
- \(d\) = How many days in the past month have you been incapacitated? \(d_0 \equiv 3\)
- \(c\) = Does the issue seem to be getting better or worse. (-10 to 10 with -10 being “circling the drain” and 10 being “dramatic improvement”) \(c_0 \equiv -2\)
- \(p\) = How much pain or discomfort are you currently experiencing? (1-10 with 10 being “currently holding detached toe in Ziploc bag”) \(p_0 = 3\)
- \(e\) = How embarrassing is this issue? (1-10 with 10 being “slipped on ice and fell on 1972 Mercedes-Benz hood ornament, which is now part of my body”) \(e_0 = 4\)
- \(n\) = How noticeable is the issue? (1-10 with 10 being “fell asleep on waffle iron”) \(n_0 = 5\)
- \(s\) = How serious does the issue seem? (1-10 with 10 being “may well have nail embedded in frontal lobe [of brain]”) \(s_0 = 3\)
Although the function is offered tongue-in-cheek, let’s examine it to see if it even roughly matches common sense. The tool we will use relates to low-order polynomial approximation around a reference point and examining appropriate partial derivatives. To save time, we stipulate a reference point for you, noted in the description of quantities above.
The code creates an R implementation of the function that is set up so that the default values of the inputs are those at the given reference point. You can use this in a sandbox to try different changes in each of the input quantities.
According to the instructions in Geek Logic, if Dr()
\(> 1\), you should go to the doctor.
Essay 1: The value of Dr()
at the reference point is 0.10, indicating that you shouldn’t go to the doctor. But we don’t yet know whether 0.10 is very close to the decision threshold of 1 or very far away. Describe a reasonable way to figure this out. Report your description and the results here.
Essay 2: There are six inputs to the function. Go through the list of all six and (without thinking too hard about it) write down for all of them your intuitive sense of whether an increase of one point in that input should raise or lower the output of Dr() at the reference point. Also write down whether you think the input should be a large or small determinant of whether to go to the doctor. (You don’t need to refer to the Dr() function itself, just to your own intuitive sense of what should be the effect of each of the inputs.)
The operator D()
can calculate partial derivatives. You can calculate the value of a partial derivative very easily at the reference point, using an expression like this, which gives the value of the partial of Dr() with respect to input \(s\) at the reference point:
We are now going to use these partial derivatives to compare your intuition about going to the doctor to what the function has to say. Of course, we don’t know yet whether the function is reasonable, so don’t be disappointed if your intuition conflicts with the function.
Essay 3: Calculate the numerical value of each of the partial derivatives at the reference point. List them here and say, for each one, whether it accords with your intuition.
Exercise 19 Let’s return to the water skier in XREF not implemented yet. When we left her, the rope was being pulled in at 10 feet per second and her corresponding speed on the water was 10.05 feet per second. The relationship between the rope speed and the skier’s speed was \[dx = \frac{L}{x} dL\] and, due to the right-angle configuration of the tow system, \(x^2 = L^2 - H^2\).
What happens to \(dx\) as \(L\) gets smaller with \(dL\) being the same? We need to keep in mind that \(dx\) depends on three things: \(dL\), \(L\), and \(x\). But we can substitute in the Pythagorean relationship between \(x\), \(L\), and (fixed) \(H\) to get \[dx = \frac{L}{\strut\sqrt{L^2 - H^2}}\ dL\ .\] This is bad news for the skier who holds on too long! As \(L\) approaches \(H\), the rope becomes more and more vertical and the skier’s water speed becomes greater and greater, approaching \(\infty\) as \(L \rightarrow H\).
You, an engineer brought in to solve this dangerous possibility, have proposed to have the winch slow down as the rope is reeled in. How should the speed of the rope be set so that the skier’s water speed remains safely constant?
What formula for \(dL\) will allow \(dx\) to stay constant at a value \(v\)?
\(dL = dx\)
\(dL = v \sqrt{L^2 - H^2}{L}\)
\(dL = v \sqrt{L^2 - H^2}\)
There is no such formula.
question id: shark-bite-sheet-1