# Math Insight

### Introduction to partial derivatives

#### Video overview

Introduction to partial derivatives.

#### Ordinary derivatives in one-variable calculus

Your heating bill depends on the average temperature outside. If all other factors remain constant, then the heating bill will increase when temperatures drop. Let's denote average temperature by $T$, and define a function $h : \R \to \R$ (confused?) so that $h(T)$ gives the heating bill as a function of $T$.

We can then interpret the ordinary derivative (i.e., the derivative you learned about in first semester calculus) as indicating how much the heating bill will change as you change the temperature: \begin{align*} \diff{h}{T}(a) = \frac{\text{change in $h$}}{\text{change in $T$}} (\text{ at $T=a$}). \end{align*} If we graph $h$ as a function of $T$, then $\displaystyle \diff{h}{T}(a)$ gives the slope of the graph at the point where $T=a$. We say that $\displaystyle \diff{h}{T}$ is the derivative of $h$ with respect to $T$. If $T$ is given in degrees Celsius, then $\displaystyle \diff{h}{T}(a)$ is change in heating cost per degree Celsius of temperature increase when the temperature is $a$. Since $h$ decreases as $T$ increases, we expect $\displaystyle \diff{h}{T}$ to be negative. (The rate of change in heating cost per degree of Celsius of temperature decrease is positive. But this positive rate is equal to $\displaystyle -\diff{h}{T}$.)

Although I don't know what $h(T)$ should really look like, pretend it looks like the curve graphed in the below applet. We can visualize the derivative by drawing a line tangent to the curve at a point $(a,h(a))$. The slope of the line is equal to the slope of the graph when $T=a$; hence, the slope of the line is equal to the derivative $\displaystyle \diff{h}{T}(a)$.

Ordinary derivative of heating cost. Imagine the function $h(T)$ shown as a think green line was the cost of heating your house given the outside temperature $T$. The derivative $dh/dT$ is calculated at the temperature $T=a$. You can change $a$ by dragging the red point at $(a,h(a))$ with your mouse. The thin blue line is tangent to the graph of $h(T)$ at the point $T=a$, and its slope is the derivative $dh/dT$.

#### Partial derivatives are analogous to ordinary derivatives

Clearly, writing the heating bill as a function of temperature is a gross oversimplification. The heating bill will depend on other factors, not least of which is the amount of insulation in your house, which we'll denote by $I$. We can define a new function $h : \R^2 \to \R$ so that $h(T,I)$ gives the heating bill as function of both temperature $T$ and insulation $I$.

Who knows, maybe this function would look something like the below graph. Heating cost as a function of temperature and insulation. We could imagine that this is the graph of a function $h(T,I)$ that gives heating cost as a function of outside temperature $T$ and amount of insulation $I$.

Suppose you aren't changing the amount of insulation in your house, so that we view $I$ as a fixed number. Then, if we look at how the heating bill changes as temperature changes, we're back to our first case above. The only difference is that we now view $h$ as a function of both $T$ and $I$, and we are explicitly leaving one of the variables ($I$) constant. In this case, we call the change in $h$ the partial derivative of $h$ with respect to $T$, a term that reflects the fact some variables remain constant. We also change our notation by writing the $d$ as a $\partial$, so that \begin{align*} \pdiff{h}{T}(a,b) = \frac{\text{change in $h$}}{\text{change in $T$}} (\text{at $T=a$ while holding $I$ constant at $b$}). \end{align*} If $T$ is given in degrees Celsius, then $\displaystyle \pdiff{h}{T}(a,b)$ is change in heating cost per degree Celsius of temperature increase when the outside temperature is $a$ and the amount of insulation is $b$.

Now, imagine you are considering the possibility of lowering your heating bill by installing additional insulation. To help you decide if it will be worth your money, you may want to know how much adding insulation will decrease the heating bill, assuming the temperature remains constant. In other words, you want to know the partial derivative of $h$ with respect to $I$: \begin{align*} \pdiff{h}{I}(a,b) = \frac{\text{change in $h$}}{\text{change in $I$}} (\text{at $I=b$ while holding $T$ constant at $a$}). \end{align*} If $I$ is given in centimeters of insulation, then $\displaystyle \pdiff{h}{I}(a,b)$ is change in heating cost per added centimeter of insulation when the outside temperature is $a$ and the amount of insulation is $b$.

The partial derivative $\displaystyle \pdiff{h}{I}$ indicates how much effect additional insulation will have on the heating bill. Since additional insulation will presumably lower the heating bill, $\displaystyle \pdiff{h}{I}$ will be negative. If additional insulation will have a large effect, then $\displaystyle \pdiff{h}{I}$ will be a large, negative number. If, for your house, $\displaystyle \pdiff{h}{I}$ is large and negative, you may be inclined to add insulation to save money.

In the graph of $h(T,I)$, the partial derivatives can be viewed as the slopes of the graphs in the $T$ direction and in the $I$ direction, as illustrated in the below applet. Partial derivatives of heating cost. The partial derivatives of the heating cost $h(T,I)$ with respect to outside temperature $T$ and amount of insulation $I$ can be viewed as the slopes of the graph in the $T$ direction and in the $I$ direction. The partial derivative $\displaystyle \pdiff{h}{T}$ corresponds to the slope of the red line, and the partial derivative $\displaystyle \pdiff{h}{I}$ corresponds to the slope of the green line. You can drag the blue point around to change the values of $T$ and $I$ where the partial derivatives are calculated.

You can drag the change the values of $T$ and $I$ to see, for example, how the partial derivative $\displaystyle \pdiff{h}{I}$ depends on both temperature and insulation. Consequently, your decision to add insulation will be affected by what temperatures you expect and how much insulation your home has already. You might expect that additional insulation will have a larger effect (i.e., $\displaystyle \pdiff{h}{I}$ will be larger negative number) for lower temperatures and smaller amounts of insulation. So if you live in some cold place in Minnesota, USA, and have an old, poorly insulated house, it's likely that $\displaystyle \pdiff{h}{I}$ will be a very large, negative number so that adding a moderate amount of insulation could dramatically decrease your heating bill.

As mentioned above, a heating bill depends on many more factors than temperature and insulation. We could define a function $h$ of many variables to give a more accurate estimate of heating costs. However, the math is the same no matter how many variables $h$ depends on, as long as it depends on two or more. So, if you want to include the effect of the size $S$ of a house, you can define $h(T,I,S)$ to be the heating bill as a function of temperature, insulation, and size. Then $\displaystyle \pdiff{h}{S}(T,I,S)$ would tell you how much the heating costs change as you change the size, leaving temperature and insulation constant. (We can still make sense of these partial derivatives even if we cannot plot a graph of $h(T,I,S)$.) The value of $\displaystyle \pdiff{h}{S}$ would presumably be useful only if you are planning to move since you probably don't plan to cut a room off your house to save heating costs (though you could just not heat a room and effectively reduce the size).

You can study some examples of calculating partial derivatives.

#### Slope in arbitrary directions

The partial derivatives of a function $f(\vc{x})$ give the slopes of the function when you move in directions parallel to the coordinate axis, i.e., when you keep all variables fixed except one. What if you move in a diagonal direction, such as increasing both $x$ and $y$ at the same time for a function $f(x,y)$? To measure slopes in arbitrary directions, you need the directional derivative, a generalization of the partial derivative to the slope in the direction of any unit vector $\vc{u}$.