# Math Insight

### Examples of calculating the derivative

#### Example 1

Let $f(x,y)=x^2+y^2$. Find $Df(1,2)$ and the equation for the tangent plane at $(x,y)=(1,2)$. Find the linear approximation to $f(x,y)$ at $(x,y)=(1,2)$.

Solution: \begin{align*} \pdiff{f}{x}(x,y) &= 2x\\ \pdiff{f}{x}(1,2) &= 2\\ \pdiff{f}{y}(x,y) &= 2y\\ \pdiff{f}{y}(1,2) &= 4 \end{align*} So $Df(1,2)=\left[\ 2 \ \ 4\ \right]$.

Since both partial derivatives $\pdiff{f}{x}(x,y)$ and $\pdiff{f}{y}(x,y)$ are continuous functions, we know that $f(x,y)$ is differentiable. Therefore, $Df(1,2)$ is the derivative of $f$, and the function has a tangent plane there.

To calculate the equation of the tangent plane, the only additional calculation is the value of $f$ at $(x,y)=(1,2)$, which is $f(1,2) = 1^2+2^2=5$. The equation for the tangent plane is \begin{align*} z &= f(1,2)+\pdiff{f}{x}(1,2)(x-1) + \pdiff{f}{y}(1,2)(y-2) \\ &= 5 + 2(x-1) + 4(y-2) \end{align*}

For a scalar-valued function of two variables such as $f(x,y)$, the tangent plane is the linear approximation. We can write the linear approximation as \begin{align*} L(x,y) = 5 + 2(x-1) + 4(y-2). \end{align*}

#### Example 1'

If looked at the point $(2,3)$, what changes?

Solution: The partial derivatives change, so the derivative becomes \begin{align*} \pdiff{f}{x}(2,3) &= 4\\ \pdiff{f}{y}(2,3) &= 6\\ Df(2,3) &= \left[\ 4 \ \ 6\ \right]. \end{align*} The equation for the tangent plane, i.e., the linear approximation, becomes \begin{align*} z &= L(x,y) = f(2,3)+\pdiff{f}{x}(2,3)(x-2) + \pdiff{f}{y}(2,3)(y-3) \\ &= 13 + 4(x-2) + 6(y-3) \end{align*}

#### Example 2

Find the derivative of \begin{align*} \vc{f}(x,y,z)=(x^2y^2z,y+\sin z) \end{align*} at the point $(1,2,0)$.

Solution: $\vc{f}: \R^3 \rightarrow \R^2$ (confused?), so the derivative (assuming the function is differentiable) is the $2 \times 3$ matrix of partial derivatives. The partial derivatives of the matrix are \begin{align*} \pdiff{f_1}{x} &= 2xy^2z\\ \pdiff{f_1}{y} &= 2x^2yz\\ \pdiff{f_1}{z} &= x^2y^2\\ \pdiff{f_2}{x} &= 0\\ \pdiff{f_2}{y} &= 1\\ \pdiff{f_2}{z} &= \cos z. \end{align*} Since all these functions are continuous, $\vc{f}$ is differentiable.

For any point $(x,y,z)=(a,b,c)$, the derivative is \begin{align*} D\vc{f}(a,b,c) = \left[ \begin{array}{ccc} 2ab^2c & 2a^2bc & a^2b^2\\ 0 & 1 & \cos c \end{array} \right]. \end{align*} At $(1,2,0)$, the derivative is \begin{align*} D\vc{f}(1,2,0) = \left[ \begin{array}{ccc} 0 & 0 & 4\\ 0 & 1 & 1 \end{array} \right]. \end{align*}

#### Example 3

For the function of example 2, calculate the linear approximation to $\vc{f}$ at the point $(1,2,0)$.

Solution: We've already calculated almost everything we need. We also need the value of the function at (1,2,0): \begin{align*} \vc{f}(1,2,0) = &=((1^2) (2^2) 0, 2+\sin 0)\\ &= (0,2) \end{align*} Then, the linear approximation to $\vc{f}$ at (1,2,0) is A linear approximation to $\vc{f}$ is \begin{align*} L(x,y,z) & = \vc{f}(1,2,0) + D\vc{f}(1,2,0) (x-1, y-2, z) \\ &= \left[ \begin{array}{c} 0 \\ 2 \end{array} \right] + \left[ \begin{array}{ccc} 0 & 0 & 4\\ 0 & 1 & 1 \end{array} \right] \left[ \begin{array}{c} x-1 \\ y-2 \\z \end{array} \right] \\ &= \left[ \begin{array}{c} 0 \\ 2 \end{array} \right] + \left[ \begin{array}{c} 4z \\ y-2+z \end{array} \right] \\ &=(4z, y+z) \end{align*}

#### Example 4

Use the linear approximation of $\vc{f}(x,y,z)$ from Example 3 to approximate the value of $\vc{f}$ at the point $(1.1,1.9,0.1)$.

Solution: The above linear approximation at $(x,y,z) = (1.1,1.9,0.1)$ is \begin{align*} L(1.1,1.9,0.1) &= (4(0.1), 1.9+0.1)\\ & = (0.4, 2.0) \end{align*}

Note that $(1.1,1.9,0.1)$ is very close to $(1,2,0)$, which is the point around which we computed the linear approximation. So, we expect this linear approximation to be close to the true value of $\vc{f}$ at $(1.1,1.9,0.1)$. Let's compare the above answer to the actual value of $\vc{f}$ at $(1.1,1.9,0.1)$: \begin{align*} \vc{f}(1.1,1.9,0.1) &= ((1.1)^2(1.9)^2(0.1), 1.9+\sin (0.1))\\ &\approx (0.4368,1.9998). \end{align*} In this case, the approximation is quite close.