Partial Derivatives
[b][size=150]Partial derivatives[/size][/b][br][br]Let [math]f(x,y)[/math] be a function of two variables. We define the [b]partial derivative[/b] of [math]f[/math] with respect to [math]x[/math] as follows:[br][br][math]\frac{\partial f}{\partial x}=f_x=\lim_{h\to 0}\frac{f(x+h,y)-f(x,y)}h[/math][br][br]It means that it is the rate of change of [math]f(x,y)[/math] with respect to [math]x[/math] when [math]y[/math] is fixed.[br][br]Similarly, the [b]partial derivative[/b] of [math]f[/math] with respect to [math]y[/math] is as follows:[br][br][math]\frac{\partial f}{\partial y}=f_y=\lim_{h\to 0}\frac{f(x,y+h)-f(x,y)}h[/math][br][br]It means that it is the rate of change of [math]f(x,y)[/math] with respect to [math]y[/math] when [math]x[/math] is fixed.[br][br][br]Suppose we find the values of the partial derivatives of [math]f[/math] at point [math](a,b)[/math]. We can use the one of the following notations:[br][br][math]\frac{\partial f}{\partial x}(a,b)=\left.\frac{\partial f}{\partial x}\right|_{(a,b)}=f_x(a,b)=\lim_{h\to 0}\frac{f(a+h,b)-f(a,b)}h[/math][br][br][math]\frac{\partial f}{\partial y}(a,b)=\left.\frac{\partial f}{\partial y}\right|_{(a,b)}=f_y(a,b)=\lim_{h\to 0}\frac{f(a,b+h)-f(a,b)}h[/math][br][br]All the differentiation rules for ordinary derivatives can be used to compute partial derivatives:[br][br]To compute [math]f_x[/math], [math]y[/math] is treated as a constant and differentiate with respect to [math]x[/math].[br][br]To compute [math]f_y[/math], [math]x[/math] is treated as a constant and differentiate with respect to [math]y[/math].[br][br][br][u]Examples[/u]:[br][br]Let [math]f(x,y)=4x^2y^3-3x\sin y+e^{xy}[/math]. Find [math]f_x[/math] and [math]f_y[/math].[br][br][u]Answer[/u]:[br][br][math]f_x=8xy^3-3\sin y+ye^{xy}[/math][br][math]f_y=12x^2y^2-3x\cos y+xe^{xy}[/math][br][br][br]The partial derivatives for functions of three variables are similarly defined. For example, let [math]g(x,y,z)[/math] be a function of three variables. Then we have [br][br][math]\frac{\partial g}{\partial z}=g_z=\lim_{h\to 0}\frac{g(x,y,z+h)-g(x,y,z)}h[/math][br][br]i.e. it is the rate of change of [math]g(x,y,z)[/math] with respect to [math]z[/math] while both [math]x[/math] and [math]y[/math] are kept fixed.[br][br][br][u]Example[/u]:[br][br]Let [math]g(x,y,z)=x^3y^2z-6xz\cos(zy)[/math]. Find [math]g_x, g_y[/math] and [math]g_z[/math].[br][br][u]Answer[/u]:[br][br][math]g_x=3x^2y^2z-6z\cos(zy)[/math][br][math]g_y=2x^3yz+6xz^2\sin(zy)[/math][br][math]g_z=x^3y^2-6x\cos(zy)+6xzy\sin(zy)[/math][br][br][br]The following applet, the surface is the graph of [math]z=f(x,y)[/math]. The red and green curves on the graph are the curves cut out by the vertical plane through the point [math]P[/math] in the direction of x-axis and y-axis respectively. And the partial derivatives with respect to [math]x[/math] and [math]y[/math] can be interpreted as the slope of the red and green curves i.e the slope of the graph in x-direction and y-direction respectively.[br]
[u]Exercise[/u]: Let [math]g(x,y,z)=e^{xyz}\sin(xy)-y\ln(2x^2+z^4)[/math]. Find [math]g_x, g_y[/math] and [math]g_z[/math].[br]
[u]Exercise[/u]: Let [math]z=f(x,y)=3x^2y+4y^3[/math]. Find the slope of the graph of [math]z=f(x,y)[/math] in x-direction at [math](1,2)[/math].[br]
[u]Implicit partial differentiation[/u][br][br]The technique of implicit differentiation can also be applied to partial derivatives. For example, consider the equation of sphere [math]x^2+y^2+z^2=1[/math]. We would like to find the slope of the sphere in x-direction at the point [math]\left(\frac 23, \frac 13, \frac 23\right)[/math]. As the point is on the upper hemisphere, we can rewrite the equation into the following:[br][br][math]z=\sqrt{1-x^2-y^2}=f(x,y)[/math][br][br]Then the required slope of the sphere is [math]\left.\frac{\partial f}{\partial x}\right|_{\left(\frac 23, \frac 13, \frac 23\right)}[/math]. The calculation is as follows:[br][br][math]\frac{\partial f}{\partial x}=\frac 12 (1-x^2-y^2)^{-\frac 12}(-2x)=\frac{-x}{\sqrt{1-x^2-y^2}}=-\frac{x}{z}[/math][br][br]Hence, [math]\left.\frac{\partial f}{\partial x}\right|_{\left(\frac 23, \frac 13, \frac 23\right)}=-\frac 23 \bigg/ \frac 23=-1[/math][br][br][br]Alternatively, we can use implicit differentiation as follows: Regarding [math]z[/math] as an implicit function of [math]x[/math] and [math]y[/math] i.e. [math]z=z(x,y)[/math], we differentiate the equation of sphere with respect to [math]x[/math] and we have[br][br][math]2x+2z \frac{\partial z}{\partial x}=0[/math][br][math]\implies \frac{\partial z}{\partial x}=-\frac xz \implies \left.\frac{\partial z}{\partial x}\right|_{\left(\frac 23, \frac 13, \frac 23\right)}=-\frac 23 \bigg/ \frac 23=-1 [/math][br][br][br]
[u]Partial derivatives and continuity[/u][br][br]For functions of one variable, it is well known that if a function is differentiable at a point, then it is continuous at the point. However, for multivariable functions, the existence of partial derivatives [b]does not[/b] guarantee the continuity of the function. The following is one such example:[br][br][math]f(x,y)=\begin{cases} \frac{xy}{x^2+y^2} \ \ & \text{if } (x,y)\ne (0,0) \\ 0 \ \ & \text{if } (x,y)=(0,0)\end{cases}[/math][br][br]First we find the partial derivatives of [math]f[/math] at [math](0,0)[/math]:[br][br][math]\left.\frac{\partial f}{\partial x}\right|_{(0,0)}=\lim_{h\to 0}\frac{f(0+h,0)-f(0,0)}h=\lim_{h\to 0}\frac{\frac{h\cdot 0}{h^2+0^2}-0}h=0[/math][br][br][math]\left.\frac{\partial f}{\partial y}\right|_{(0,0)}=\lim_{h\to 0}\frac{f(0,0+h)-f(0,0)}h=\lim_{h\to 0}\frac{\frac{0\cdot h}{0^2+h^2}-0}h=0[/math][br][br]i.e. both partial derivatives at [math](0,0)[/math] exist. However, [math]f[/math] is not continuous at [math](0,0)[/math] because we already know that [math]\lim_{(x,y)\to (0,0)}f(x,y)[/math] does not exist! (See the example in "limit along a curve")[br][br][br]In view of this example, we need a notion of [b]differentiability[/b] of multivariable functions which is stronger than the existence of partial derivatives. We will talk about differentiability later.[br][br]
[b][size=150]Higher order partial derivatives[/size][/b][br][br]For a function [math]f(x,y)[/math], [math]f_x[/math] and [math]f_y[/math] are also functions of [math]x[/math] and [math]y[/math]. Therefore, we can take partial derivatives of them as follows:[br][br][math]\frac{\partial}{\partial x}\left(\frac{\partial f}{\partial x}\right)=\frac{\partial^2f}{\partial x^2}, \ \ (f_x)_x=f_{xx}[/math][br][br][math]\frac{\partial}{\partial y}\left(\frac{\partial f}{\partial y}\right)=\frac{\partial^2f}{\partial y^2}, \ \ (f_y)_y=f_{yy}[/math][br][br][math]\frac{\partial}{\partial x}\left(\frac{\partial f}{\partial y}\right)=\frac{\partial^2f}{\partial x \partial y}, \ \ (f_y)_x=f_{yx}[/math][br][br][math]\frac{\partial}{\partial y}\left(\frac{\partial f}{\partial x}\right)=\frac{\partial^2f}{\partial y \partial x}, \ \ (f_x)_y=f_{xy}[/math][br][br](Note: [math]f_{xy}[/math] and [math]f_{yx}[/math] are sometimes called the [b]mixed partial derivatives[/b].)[br][br][br][br][u]Example[/u]:[br][br]Let [math]f(x,y)=3x^4y-2xy+5xy^3[/math]. Find [math]f_{xx}, f_{yx}, f_{xy}[/math] and [math]f_{yy}[/math].[br][br][u]Answer[/u]:[br][br][math]f_x=12x^3y-2y+5y^3, \ \ f_y=3x^4-2x+15xy^2[/math][br][br][math]f_{xx}=36x^2y[/math][br][br][math]f_{yx}=12x^3-2+15y^2[/math][br][br][math]f_{xy}=12x^3-2+15y^2[/math][br][br][math]f_{yy}=30xy[/math][br][br][br]Notice that [math]f_{xy}=f_{yx}[/math] in the above example. In fact, it can be shown that if both [math]f_{xy}[/math] and [math]f_{yx}[/math] are continuous, then [math]f_{xy}=f_{yx}[/math]. In other words, for functions that are "nice" enough, the order of taking mixed partial derivatives does not matter.[br][br][u]Remark[/u]: For functions of three variables, similar notations and definitions apply. For example, suppose [math]g(x,y,z)[/math] is function of three variables. Then [math]\frac{\partial}{\partial z}\left(\frac{\partial g}{\partial x}\right)=\frac{\partial^2 g}{\partial z\partial x}=(g_x)_z=g_{xz}[/math].[br][br][br]
[u]Exercise[/u]: Let [math]f(x,y)=x^2\sin(3xy)[/math]. Find all second-order partial derivatives of [math]f[/math].[br]
[b][size=150]Differentiability[/size][/b][br][br]Let us recall that for a function of one variable, say [math]y=f(x)[/math], we say [math]f[/math] is differentiable at [math]x_0[/math] if the following limit exists:[br][br][math]f'(x_0)=\lim_{\Delta x\to 0}\frac{f(x_0+\Delta x)-f(x_0)}{\Delta x}[/math][br][br]We can rewrite it as follows:[br][br][math]\lim_{\Delta x\to 0}\frac{f(x_0+\Delta x)-f(x_0)-f'(x_0)\Delta x}{\Delta x}=\lim_{\Delta x\to 0}\frac{E(\Delta x)}{\Delta x}=0[/math][br][br]where [math]E(\Delta x)=f(x_0+\Delta x)-f(x_0)-f'(x_0)\Delta x[/math], which can be regarded as the "error" in the [b]linear approximation[/b] of [math]\Delta y=f(x_0+\Delta x)-f(x_0)[/math] by [math]f'(x_0)\Delta x[/math] (the approximation using the tangent line at [math](x_0,f(x_0))[/math]). In other words, [math]f[/math] is differentiable at [math]x_0[/math] if such error goes to [math]0[/math] faster than [math]\Delta x[/math] goes to [math]0[/math].[br][br][br]For a function of two variables [math]z=f(x,y)[/math], we can use the same idea to define what it means to say [math]f(x,y)[/math] is [b]differentiable[/b] at [math](x_0,y_0)[/math]. [br][br]In the applet below, we consider [math]\Delta x[/math] and [math]\Delta y[/math] to be the small change from [math](x_0,y_0)[/math]. Then we use the tangent plane at [math](x_0,y_0,f(x_0,y_0))[/math] to the graph of [math]z=f(x,y)[/math] to approximate [math]f(x_0+\Delta x,y_0+\Delta y)-f(x_0,y_0)[/math]. It can be shown that linear approximation of [math]f(x_0+\Delta x,y_0+\Delta y)-f(x_0,y_0)[/math] is [br][br][math]f_x(x_0,y_0)\Delta x+f_y(x_0,y_0)\Delta y[/math] [br][br](Note: In the applet below, [math]f_x(x_0,y_0)[/math] and [math]f_y(x_0,y_0)[/math] are abbreviated as [math]f_x[/math] and [math]f_y[/math] respectively)[br][br]We can define the error of linear approximation as follows:[br][br][math]E(\Delta x,\Delta y)=f(x_0+\Delta x,y_0+\Delta y)-f(x_0,y_0)-(f_x(x_0,y_0)\Delta x+f_y(x_0,y_0)\Delta y)[/math] [br][br]Therefore, we have the following definition:[br][br][u]Definition[/u]: [math]f[/math] is [b]differentiable[/b] at [math](x_0,y_0)[/math] if [math]\lim_{(\Delta x,\Delta y)\to (0,0)} \frac{E(\Delta x,\Delta y)}{|\langle \Delta x,\Delta y\rangle|}=0[/math] i.e.[br][br][math]\lim_{(\Delta x,\Delta y)\to (0,0)} \frac{f(x_0+\Delta x,y_0+\Delta y)-f(x_0,y_0)-(f_x(x_0,y_0)\Delta x+f_y(x_0,y_0)\Delta y)}{\sqrt{\Delta x^2+\Delta y^2}}=0[/math] [br][br][u]Remark[/u]: In the above definition, for [math]f[/math] to be differentiable, the existence of its partial derivatives is required. But we will see that the existence of partial derivatives cannot guarantee that the function is differentiable.[br][br]
[u]Example[/u]: Suppose [math]f(x,y)=x^2+y^2[/math]. Prove that [math]f[/math] is differentiable at [math](1,2)[/math].[br][br][u]Answer[/u]:[br][br]First of all, [math]f_x=2x[/math] and [math]f_y=2y[/math].[br][br]We need to compute the following limit:[br][br][math]\lim_{(\Delta x,\Delta y)\to (0,0)}\frac{f(1+\Delta x,2+\Delta y)-f(1,2)-(f_x(1,2)\Delta x+f_y(1,2)\Delta y)}{\sqrt{\Delta x^2+\Delta y^2}}=\lim_{(\Delta x,\Delta y)\to (0,0)}\frac{(1+\Delta x)^2+(2+\Delta y)^2-5-(2\Delta x+4\Delta y)}{\sqrt{\Delta x^2+\Delta y^2}}[/math][br][math]=\lim_{(\Delta x,\Delta y)\to (0,0)}\frac{\Delta x^2+\Delta y^2}{\sqrt{\Delta x^2+\Delta y^2}}=\lim_{(\Delta x,\Delta y)\to (0,0)}\sqrt{\Delta x^2+\Delta y^2}=0[/math][br][br][br][u]Example[/u]: Suppose [math]f(x,y)=|x+y|[/math]. Prove that [math]f[/math] is not differentiable at [math](0,0)[/math].[br][br][u]Answer[/u]:[br][br]First of all, we compute [math]f_x(0,0)[/math]:[br][br][math]\lim_{h\to 0}\frac{f(h,0)-f(0,0)}{h}=\lim_{h\to 0}\frac{|h|}h[/math][br][br]It is well known that such limit does not exist. Therefore, [math]f_x(0,0)[/math] does not exist and hence [math]f[/math] is not differentiable at [math](0,0)[/math].[br][br][br][u]Example[/u]: Suppose [math]f(x,y)=\begin{cases} \frac{xy^2}{x^2+y^2} \ \ & \text{if } (x,y)\ne (0,0) \\ 0 \ \ & \text{if } (x,y)=(0,0)\end{cases}[/math]. Show that its partial derivatives exist at [math](0,0)[/math] but it is not differentiable at [math](0,0)[/math].[br][br][br][u]Answer[/u]:[br][br]First of all, we compute [math]f_x(0,0)[/math] and [math]f_y(0,0)[/math]:[br][br][math]f_x(0,0)=\lim_{h\to 0}\frac{f(h,0)-f(0,0)}{h}=\lim_{h\to 0}\frac{0-0}{h}=0[/math][br][br][math]f_y(0,0)=\lim_{h\to 0}\frac{f(0,h)-f(0,0)}{h}=\lim_{h\to 0}\frac{0-0}{h}=0[/math][br][br]Hence, both partial derivatives exist.[br][br]To check whether [math]f[/math] is differentiable at [math](0,0)[/math], we consider the following limit:[br][br][math]\lim_{(\Delta x,\Delta y)\to (0,0)}\frac{f(\Delta x,\Delta y)-f(0,0)-(0\cdot \Delta x+0\cdot \Delta y)}{\sqrt{\Delta x^2+\Delta y^2}}=\lim_{(\Delta x,\Delta y)\to (0,0)}\frac{\frac{\Delta x\Delta y^2}{\Delta x^2+\Delta y^2}}{\sqrt{\Delta x^2+\Delta y^2}}=\lim_{(\Delta x,\Delta y)\to (0,0)}\frac{\Delta x\Delta y^2}{(\sqrt{\Delta x^2+\Delta y^2})^3}[/math][br][br]Consider the curve [math]C_1[/math]: [math]\langle x(t),y(t)\rangle=\langle t,0\rangle[/math] as [math]t\to 0^+[/math]. Then [math]\lim_{(\Delta x,\Delta y)\to (0,0) \atop \text{along }C_1}\frac{\Delta x\Delta y^2}{(\sqrt{\Delta x^2+\Delta y^2})^3}=\lim_{t\to 0^+} \frac{0}{t^3}=0[/math][br][br]Consider the curve [math]C_2[/math]: [math]\langle x(t),y(t)\rangle=\langle t,t\rangle[/math] as [math]t\to 0^+[/math]. Then [math]\lim_{(\Delta x,\Delta y)\to (0,0) \atop \text{along }C_2}\frac{\Delta x\Delta y^2}{(\sqrt{\Delta x^2+\Delta y^2})^3}=\lim_{t\to 0^+} \frac{t^3}{2^{\frac 32}t^3}=\frac{1}{2^{\frac 32}}[/math][br][br]Hence, the limit does not exist and [math]f[/math] is not differentiable at [math](0,0)[/math].[br][br]([u]Note[/u]: You can use GeoGebra to plot the graph of this function to see why there is no tangent plane to the graph at [math](0,0)[/math].)[br][br]
[u]Exercise[/u]: Let [math]f(x,y)=|xy|[/math]. Prove the it is differentiable at [math](0,0)[/math] but not differentiable at [math](1,0)[/math].[br]
[u]Theorems about differentiability[/u][br][br]It is usually quite tedious to check whether a function of two variables is differentiable at a point using the above definition. The following is a theorem which gives a sufficient condition for a function of two variables to be differentiable at a point:[br][br][u]Theorem[/u]: Let [math]f(x,y)[/math] be a function such that all its partial derivatives [math]f_x[/math] and [math]f_y[/math] exist and continuous at [math](x_0,y_0)[/math], then [math]f[/math] is differentiable at [math](x_0,y_0)[/math].[br][br][br][u]Example[/u]: Suppose [math]f(x,y)=x^2y+y^4\cos x[/math]. Show that [math]f[/math] is differentiable everywhere.[br][br][u]Answer[/u]:[br][br][math]f_x=2xy-y^4\sin x[/math][br][math]f_y=x^2+4y^3\cos x[/math][br][br]Since polynomial functions and trigonometric functions are continuous, [math]f_x[/math] and [math]f_y[/math] are continuous everywhere.[br][br]By the above theorem, [math]f[/math] is differentiable everywhere.[br][br][br][br]The following theorem says that differentiability is a stronger condition than continuity:[br][br][u]Theorem[/u]: If [math]f[/math] is differentiable at [math](x_0,y_0)[/math], then [math]f[/math] is continuous at [math](x_0,y_0)[/math].[br][br][u]Proof[/u]:[br][br]It suffice to verify that [math]\lim_{(x,y)\to (x_0,y_0)}f(x,y)=f(x_0,y_0)[/math].[br][br]Let [math]x=x_0+\Delta x[/math] and [math]y=y_0+\Delta y[/math]. We can rewrite the above limit and the condition becomes as follows:[br][br][math]\lim_{(\Delta x,\Delta y)\to (0,0)}(f(x_0+\Delta x,y_0+\Delta y)-f(x_0,y_0))=0[/math][br][br]Since [math]f[/math] is differentiable at [math](x_0,y_0)[/math], we have[br][br][math]\lim_{(\Delta x,\Delta y)\to (0,0)}\frac{E(\Delta x,\Delta y)}{|\langle \Delta x,\Delta y\rangle|}=\lim_{(\Delta x,\Delta y)\to (0,0)} \frac{f(x_0+\Delta x,y_0+\Delta y)-f(x_0,y_0)-(f_x(x_0,y_0)\Delta x+f_y(x_0,y_0)\Delta y)}{\sqrt{\Delta x^2+\Delta y^2}}=0[/math] [br][br]Then we compute the following limit:[br][br][math]\lim_{(\Delta x,\Delta y)\to (0,0)}(f(x_0+\Delta x,y_0+\Delta y)-f(x_0,y_0))=\lim_{(\Delta x,\Delta y)\to (0,0)}(f_x(x_0,y_0)\Delta x+f_y(x_0,y_0)\Delta y+E(\Delta x,\Delta y))[/math][br][math]=\lim_{(\Delta x,\Delta y)\to (0,0)}(f_x(x_0,y_0)\Delta x+f_y(x_0,y_0)\Delta y+\frac{E(\Delta x,\Delta y)}{|\langle \Delta x,\Delta y\rangle|}|\langle \Delta x,\Delta y\rangle|)=0[/math] (since all the terms tend to zero)[br][br]This completes the proof.[br][br][br][u]Remarks[/u]: [br][list][*]The contrapositive of this theorem is useful - if a function is not continuous at a point, then it is not differentiable at the point.[/*][br][*]The converse of the above theorem is certainly false. Consider the previous example [math]f(x,y)=\begin{cases} \frac{xy^2}{x^2+y^2} \ \ & \text{if } (x,y)\ne (0,0) \\ 0 \ \ & \text{if } (x,y)=(0,0)\end{cases}[/math]. It can be shown that it is continuous at [math](0,0)[/math] (left as exercise). However, we have already shown that it is not differentiable at [math](0,0)[/math].[/*][/list][br][br][br]