During Class

Brain Gains

  1. Find the derivative of each of the following:
    • $f_1(x) = (3x^2+4)^5$
    • $f_2(x) = e^{3x^2+4}$
    • $f_3(x) = \ln(3x^2+4)$
  2. Find $\frac{\partial f}{\partial x}$ and $\frac{\partial f}{\partial y}$ and $\frac{\partial f}{\partial z}$, given $f(x,y,z) = x^2 - 2xy - 3y^2 - 4xz + 5yz^2 - 12x + 4y - 3z$.
  3. Find $\frac{\partial g}{\partial x}$ and $\frac{\partial g}{\partial y}$, given $g(x,y) = \sqrt{x^3 - 3x^2y^2 + 2y^4}$.
  4. A farmer has a large barn, and wants to build a rectangular pen on one side of the barn. They currently have enough lumber to build 300 ft of fencing to cover the missing 3 sides (one side will be the barn). Write a function for the area of $A$ of the enclosed region using one of the sides as the input.
    • Once you've written the function, open R and plot the function to visually locate the dimensions that result in maximum area.

Group Meeting

Start by giving each person a moment to share what they chose to prepare for class. Help each other address any questions. When each person has had a chance to share, move on the other activities.

Activity - Partial Derivatives With the Chain Rule

  1. Given $S(x, y; a, b) = 3(ax + by)^{-3}$, find $\diff{S}{x}$ assuming all other variables and parameters are constant then find $\diff{S}{y}$ assuming all other variables and parameters are constant.
  2. Given $g(a_1, a_2; \textbf{x},\textbf{y}) = \sum_{i=1}^{7} \sqrt{a_1x_i + a_2y_i}$, find $\frac{\partial g}{\partial a_1}$ and $\frac{\partial g}{\partial a_2}$.
  3. Given $h(x, y; \textbf{a}, \textbf{b}) = \sum_{i=1}^{21} 3(a_ix + b_iy)^{-3}$, find $\frac{\partial h}{\partial x}$ and $\frac{\partial h}{\partial y}$.

Answer

  1. We have $\frac{\partial S}{\partial x}(x, y; a, b) = -9a(ax + by)^{-4}$ and $\frac{\partial S}{\partial y}(x, y; a, b) = -9b(ax + by)^{-4}$.
  2. We find $\frac{\partial g}{\partial a_1} = \sum_{i=1}^7 \frac{1}{2}(a_1x_i + a_2y_i)^{-1/2}(x_i)$ and $\frac{\partial g}{\partial a_2} = \sum_{i=1}^7 \frac{1}{2}(a_1x_i + a_2y_i)^{-1/2}(y_i)$.
  3. We compute $\frac{\partial h}{\partial x} = \sum_{i=1}^{21} -9a_i(a_ix + b_iy)^{-4}$ and $\frac{\partial h}{\partial y} = \sum_{i=1}^{21} -9b_i(a_ix + b_iy)^{-4}$

Activity - Second-Order Partial Derivatives

Second-Order Partial Derivatives

For a function $f(x,y)$ of two independent variables, the 4 second order partial derivatives are

  • $(f_x)_x = f_{xx} = \dfrac{\partial}{\partial x}\left(\dfrac{\partial f}{\partial x}\right) = \dfrac{\partial^2 f}{\partial x^2}$,
  • $(f_y)_y = f_{yy} = \dfrac{\partial}{\partial y}\left(\dfrac{\partial f}{\partial y}\right) = \dfrac{\partial^2 f}{\partial y^2}$,
  • $(f_x)_y = f_{xy} = \dfrac{\partial}{\partial y}\left(\dfrac{\partial f}{\partial x}\right) = \dfrac{\partial^2 f}{\partial y \partial x}$, and
  • $(f_y)_x = f_{yx} = \dfrac{\partial}{\partial x}\left(\dfrac{\partial f}{\partial y}\right) = \dfrac{\partial^2 f}{\partial x \partial y}$.
  • Given $f(x,y) = x^2 - 3xy + 5y^2$, compute the second-order partial derivatives of $f$.

Solution

We have

  • $f_x = 2x-3y$,
  • $f_y = -3x+10y$,
  • $f_{xx} = 2$,
  • $f_{yy} = 10$,
  • $f_{xy} = -3$, and
  • $f_{yx} = -3$.
  • Given $g(x,y) = 3(\pi x - \frac{1}{5}y)^{2}$, compute the second-order partial derivatives of $g$.

Solution

The first partials are $g_x(x,y) = 6(\pi x - \frac{1}{5}y)(\pi) = 6\pi(\pi x - \frac{1}{5}y)$ and $g_y(x,y) = 6(\pi x - \frac{1}{5}y)(-\frac{1}{5}) = -\frac{6}{5}(\pi x - \frac{1}{5}y)$.

The second partial are $g_{xx} = \frac{\partial}{\partial x}(6\pi(\pi x - \frac{1}{5}y)) = 6\pi^2$, $g_{yy} = \frac{\partial}{\partial y}(-\frac{6}{5}(\pi x - \frac{1}{5}y)) = \frac{6}{25}$, $g_{xy} = \frac{\partial}{\partial y}(6\pi(\pi x - \frac{1}{5}y)) = -\frac{6\pi}{5}$, and $g_{yx} = \frac{\partial}{\partial x}(-\frac{6}{5}(\pi x - \frac{1}{5}y)) = -\frac{6\pi}{5}$.

  • Given $S(x, y; \mathbf{b}) = \sum_{i=1}^{3} 5(\pi x + b_iy)^{4}$, find $\frac{\partial S}{\partial x}$, $\frac{\partial^2 S}{\partial x^2}$, $\frac{\partial^2S}{\partial y \partial x}$, and $\frac{\partial^2S}{\partial x \partial y}$.
  • Given $H(x, y; \mathbf{a}, \mathbf{b}) = \sum_{i=1}^{5} 2(a_ix + b_iy)^{3}$, find $H_y$, $H_{yy}$, $H_{xy}$, and $H_{yx}$.

Activity - Partial Derivatives for $\ell_2$.

The loglikelihood function for $f_2(t; a_1,a_2) = 100 + a_1t +a_2t^2$ is $$\ell_2(a_1,a_2; \mathbf{t},\mathbf{y}) = 44\ln\left(\frac{1}{\sqrt{2\pi}}\right) - \frac{1}{2}\sum_{i}^{44} (y_i- 100 - a_1t_i - a_2t_i^2)^2.$$

  1. Compute $\dfrac{\partial \ell_2}{\partial a_1}$. We avoid using $(\ell_2)_{a_1}$ notation here, because the double subscript is awkward. We could let $\ell = \ell_2$ and then write $\ell_{a_1}$ to resolve this.
  2. Compute $\dfrac{\partial \ell_2}{\partial a_2}$.
  3. Compute $\dfrac{\partial^2 \ell_2}{\partial a_1^2}$. You computed $\dfrac{\partial \ell_2}{\partial a_1}$ above, so now compute its partial derivative with respect to $a_1$.
  4. Compute $\dfrac{\partial^2 \ell_2}{\partial a_2\partial a_1}$. You computed $\dfrac{\partial \ell_2}{\partial a_1}$ above, so now compute its partial derivative with respect to $a_2$.
  5. Compute $\dfrac{\partial^2 \ell_2}{\partial a_2^2}$.
  6. Compute $\dfrac{\partial^2 \ell_2}{\partial a_1\partial a_2}$.

If you finish early, pick another function from Project 2, and compute all the partial derivatives. You are essentially working through Project 2 Task 2.

Activity - Derivative Practice

Use the remaining time to practice working with higher order derivatives and the chain rule. Both of these activities are carried over from previous days. Please spend time with each one (maybe half the rest of class on higher order derivatives, and the other half on the chain rule).

Higher order derivatives

Open this Higher Order Derivatives worksheet and take turns computing derivatives, passing the chalk after each problem.

Activity - Chain Rule Practice

For each pair of functions $f(x)$ and $g(x)$ below, write out the compositions $f(g(x))$ and $g(f(x))$. Then compute the derivative of each composite function. As a suggestion, compute both $f'(x)$ and $g'(x)$ first, and then show how you can combine $f,g,f',g'$ to get the derivative of each composite function. Remember to pass the chalk between each problem.

  1. $f(x) = 3x + 4$, $g(x) = x^2 + 1$
  2. $f(x) = e^x$, $g(x) = \sqrt{2x-5}$
  3. $f(x) = \frac{1}{x}$, $g(x) = 2\ln(x)$
  4. $f(x) = (x-5)^4$, $g(x) = \sqrt[3]{x^2}$
  5. $f(x) = e^{3x}$, $g(x) = x^4 - 1$
  6. $f(x) = \frac{x}{x-3}$, $g(x) = \ln(5x)$
  7. $f(x) = 2x^3 - 10x^2 + 2x$, $g(x) = \sqrt{\frac{x-4}{2}}$
  8. $f(x) = \frac{1}{x^5}$, $g(x) = 4e^x$
  9. $f(x) = \sqrt{8-x}$, $g(x) = (2x-1)(x+5)$
  10. $f(x) = e^{x/2}$, $g(x) = 5x^3$
  11. $f(x) = 1 - \frac{3}{x^4}$, $g(x) = 2 - \sqrt{x}$
  12. $f(x) = \frac{3}{x^2}$, $g(x) = \ln(x)$
  13. $f(x) = 27 - x^3$, $g(x) = x^2 - x - 12$
  14. $f(x) = \sqrt[3]{4-x^2}$, $g(x) = 5x + 7$
  15. $f(x) = \frac{x+1}{x-2}$, $g(x) = e^{-x}$