Salta al contenuto
Note per Studenti Partial and Directional Derivatives Report

Partial and Directional Derivatives

In questa pagina 4

This note builds on Limits and Continuity in Several VariablesThe limit of a function of several variables exists if the value approaches L independently of the path; it is shown to exist with estimates in polar coordinates and shown not to exist by restricting to different curves. Continuity requires the limit to equal the value of the function at the point.Limits and Continuity in Several Variables →.

The idea is to reduce to one variable: we move from x0x_0 along a line and look at how ff varies. If the line is parallel to an axis we get a partial derivative, if it has an arbitrary direction a directional derivative.

Partial derivatives

Definition. Let f:D⊆Rn→Rf: D \subseteq \mathbb{R}^n \to \mathbb{R} be a function and x0x_0 an interior point of DD. The partial derivative of ff with respect to the variable xix_i at x0x_0 is the limit: ∂f∂xi(x0)=lim⁡h→0f(x0+hei)−f(x0)h\frac{\partial f}{\partial x_i}(x_0) = \lim_{h \to 0} \frac{f(x_0 + h e_i) - f(x_0)}{h} where eie_i is the ii-th unit vectora vector of norm one of the canonical basis.

Example. f(x,y)=x2yf(x,y) = x^2 y: ∂f∂x=2xy\frac{\partial f}{\partial x} = 2xy and ∂f∂y=x2\frac{\partial f}{\partial y} = x^2; at the point (1,1)(1,1) they equal 22 and 11.

In two variables, at the point (x0,y0)(x_0, y_0): ∂f∂x(x0,y0)=lim⁡h→0f(x0+h,y0)−f(x0,y0)h,∂f∂y(x0,y0)=lim⁡h→0f(x0,y0+h)−f(x0,y0)h\frac{\partial f}{\partial x}(x_0, y_0) = \lim_{h \to 0} \frac{f(x_0 + h, y_0) - f(x_0, y_0)}{h}, \qquad \frac{\partial f}{\partial y}(x_0, y_0) = \lim_{h \to 0} \frac{f(x_0, y_0 + h) - f(x_0, y_0)}{h}

Meaning. ∂f∂x(x0,y0)\frac{\partial f}{\partial x}(x_0, y_0) is the derivative of the one-variable function x↦f(x,y0)x \mapsto f(x, y_0), i.e. the slope of the curve obtained by cutting the graph with the vertical plane y=y0y = y_0. Other notations: fxf_x, ∂xf\partial_x f, D1fD_1 f.

Practical computation

In practice, to compute ∂f∂xi\frac{\partial f}{\partial x_i} we differentiate with respect to the variable xix_i treating all the other variables as constants, applying the differentiation rules of one-variable calculus.

Example: let f(x,y,z)=x2yz+sin⁡(xz)f(x, y, z) = x^2yz + \sin(xz).

  • With respect to xx: treat y,zy, z as constants   ⟹  ∂f∂x=2xyz+zcos⁡(xz)\implies \frac{\partial f}{\partial x} = 2xyz + z \cos(xz).
  • With respect to yy: treat x,zx, z as constants   ⟹  ∂f∂y=x2z\implies \frac{\partial f}{\partial y} = x^2z.
  • With respect to zz: treat x,yx, y as constants   ⟹  ∂f∂z=x2y+xcos⁡(xz)\implies \frac{\partial f}{\partial z} = x^2y + x \cos(xz).

In the term sin⁡(xz)\sin(xz), differentiating with respect to xx the chain rule gives cos⁡(xz)⋅z\cos(xz) \cdot z (the derivative of the argument xzxz with respect to xx is zz); differentiating with respect to zz gives cos⁡(xz)⋅x\cos(xz) \cdot x.

More examples.

  • f(x,y)=x3y+3x2y2+x+yf(x, y) = x^3y + 3x^2y^2 + x + y:  fx=3x2y+6xy2+1\ f_x = 3x^2y + 6xy^2 + 1,  fy=x3+6x2y+1\ f_y = x^3 + 6x^2y + 1.
  • f(x,y)=ex2y+3xf(x, y) = e^{x^2y} + 3x:  fx=2xy ex2y+3\ f_x = 2xy\,e^{x^2y} + 3,  fy=x2ex2y\ f_y = x^2 e^{x^2y} (the term 3x3x does not depend on yy, so its derivative with respect to yy is 00).

Definition. If all the partial derivatives of ff exist at x0x_0, the function is said to be differentiable in the partial sense (it has all its partial derivatives) at x0x_0. The vector collecting them is the gradient, denoted by the symbol ∇\nabla (read "nabla"): ∇f(x0)=(∂f∂x1(x0),…,∂f∂xn(x0))\nabla f(x_0) = \left( \frac{\partial f}{\partial x_1}(x_0), \dots, \frac{\partial f}{\partial x_n}(x_0) \right)

Example. f(x,y,z)=xyzf(x,y,z) = xyz has ∇f=(yz,xz,xy)\nabla f = (yz, xz, xy), so ∇f(1,2,3)=(6,3,2)\nabla f(1,2,3) = (6, 3, 2).

Directional derivatives

When we want to know the variation of ff along a generic direction given by a unit vector vv (with ∥v∥=1\|v\|=1), we use the directional derivative.

Definition. The directional derivative of ff at x0x_0 along the unit vector vv is the limit: ∂f∂v(x0)=lim⁡h→0f(x0+hv)−f(x0)h\frac{\partial f}{\partial v}(x_0) = \lim_{h \to 0} \frac{f(x_0 + hv) - f(x_0)}{h}

The partial derivatives are the directional derivatives along the unit vectors of the axes: ∂f∂xi=∂f∂ei\frac{\partial f}{\partial x_i} = \frac{\partial f}{\partial e_i}. A unit vector is used so that hh measures exactly the distance travelled from x0x_0: with a vector of length 22 the difference quotient would be doubled.

Example (from the definition). f(x,y)=x2yf(x, y) = x^2y at (1,1)(1, 1) along v=(12,12)v = \left(\frac{1}{\sqrt2}, \frac{1}{\sqrt2}\right). Setting t=h2t = \frac{h}{\sqrt2}, we have x0+hv=(1+t,1+t)x_0 + hv = (1 + t, 1 + t) and f(1+t,1+t)−f(1,1)h=(1+t)3−1h=3t+3t2+t3h=12 (3+3t+t2)→h→032\frac{f(1+t, 1+t) - f(1,1)}{h} = \frac{(1+t)^3 - 1}{h} = \frac{3t + 3t^2 + t^3}{h} = \frac{1}{\sqrt2}\,(3 + 3t + t^2) \xrightarrow[h \to 0]{} \frac{3}{\sqrt2}

If the function is differentiablef is differentiable at x0 if f(x) = f(x0) + grad f(x0)·(x - x0) + o(‖x - x0‖), i.e. near x0 the graph is indistinguishable from the tangent plane z = f(x0) + grad f(x0)·(x - x0). Differentiable implies continuous, with partial derivatives and D_v f = grad f · v; continuous partial derivatives imply differentiable. The gradient gives the direction of steepest increase (slope ‖grad f‖) and is orthogonal to level curves.Differentiability and the Gradient → at x0x_0, there is no need to compute the previous limit.

Theorem. If ff is differentiable at x0x_0, then for every unit vector vv the directional derivative exists and equals the dot product of the gradient and the unit vector: ∂f∂v(x0)=∇f(x0)⋅v\frac{\partial f}{\partial v}(x_0) = \nabla f(x_0) \cdot v

Example. f(x,y)=x2yf(x,y) = x^2 y at (1,1)(1,1) along v=12(1,1)v = \frac{1}{\sqrt{2}}(1,1): ∇f(1,1)⋅v=(2,1)⋅(1,1)2=32\nabla f(1,1) \cdot v = (2,1) \cdot \frac{(1,1)}{\sqrt{2}} = \frac{3}{\sqrt{2}}.

In the example above ∇f=(2xy,x2)\nabla f = (2xy, x^2), so ∇f(1,1)=(2,1)\nabla f(1, 1) = (2, 1) and ∇f(1,1)⋅v=2+12=32\nabla f(1,1) \cdot v = \frac{2 + 1}{\sqrt2} = \frac{3}{\sqrt2}: same result, without limits. The proof and the geometric meaning (the gradient points in the direction of steepest increase) are in Differentiability and the Gradientf is differentiable at x0 if f(x) = f(x0) + grad f(x0)·(x - x0) + o(‖x - x0‖), i.e. near x0 the graph is indistinguishable from the tangent plane z = f(x0) + grad f(x0)·(x - x0). Differentiable implies continuous, with partial derivatives and D_v f = grad f · v; continuous partial derivatives imply differentiable. The gradient gives the direction of steepest increase (slope ‖grad f‖) and is orthogonal to level curves.Differentiability and the Gradient →.

Having derivatives does not imply continuity

In one variable a differentiable function is continuous. In several variables it is not so: partial derivatives only look along the axes, and the function may behave badly along the other directions.

Example 1 (partial derivatives exist but not continuous). f(x,y)=xyx2+y2f(x,y) = \frac{xy}{x^2+y^2} for (x,y)≠(0,0)(x,y) \neq (0,0), f(0,0)=0f(0,0)=0. On the axes the function equals 00: f(h,0)=0f(h, 0) = 0 and f(0,h)=0f(0, h) = 0. Hence fx(0,0)=lim⁡h→0f(h,0)−f(0,0)h=lim⁡h→00h=0,fy(0,0)=0f_x(0,0) = \lim_{h \to 0} \frac{f(h,0) - f(0,0)}{h} = \lim_{h\to 0} \frac{0}{h} = 0, \qquad f_y(0,0) = 0 The partial derivatives exist, but the function is not continuous at the origin: along y=mxy = mx it equals m1+m2\frac{m}{1+m^2} identically (see Limits and Continuity in Several VariablesThe limit of a function of several variables exists if the value approaches L independently of the path; it is shown to exist with estimates in polar coordinates and shown not to exist by restricting to different curves. Continuity requires the limit to equal the value of the function at the point.Limits and Continuity in Several Variables →).

Example 2 (all directional derivatives exist, but not continuous). f(x,y)=x2yx4+y2f(x,y) = \frac{x^2y}{x^4+y^2}, f(0,0)=0f(0,0) = 0. For a unit vector v=(v1,v2)v = (v_1, v_2) with v2≠0v_2 \neq 0: f(hv1,hv2)h=h3v12v2h (h4v14+h2v22)=v12v2h2v14+v22→h→0v12v2\frac{f(hv_1, hv_2)}{h} = \frac{h^3 v_1^2 v_2}{h\,(h^4v_1^4 + h^2v_2^2)} = \frac{v_1^2 v_2}{h^2 v_1^4 + v_2^2} \xrightarrow[h\to 0]{} \frac{v_1^2}{v_2} and for v2=0v_2 = 0 the function vanishes on the xx axis, so the derivative is 00. All directional derivatives exist, and yet ff is not continuous at (0,0)(0,0) (along y=x2y = x^2 it equals 12\frac12).

Example 3 (continuous but not differentiable). The norm f(x,y)=x2+y2f(x, y) = \sqrt{x^2 + y^2} is continuous, but at the origin f(h,0)−f(0,0)h=∣h∣h\frac{f(h, 0) - f(0, 0)}{h} = \frac{|h|}{h} equals 11 for h>0h > 0 and −1-1 for h<0h < 0: the limit does not exist, as for ∣x∣|x| in one variable. The graph is a cone with its tip at the origin.

The right notion, which implies continuity and directional derivatives, is differentiability: Differentiability and the Gradientf is differentiable at x0 if f(x) = f(x0) + grad f(x0)·(x - x0) + o(‖x - x0‖), i.e. near x0 the graph is indistinguishable from the tangent plane z = f(x0) + grad f(x0)·(x - x0). Differentiable implies continuous, with partial derivatives and D_v f = grad f · v; continuous partial derivatives imply differentiable. The gradient gives the direction of steepest increase (slope ‖grad f‖) and is orthogonal to level curves.Differentiability and the Gradient →.

Common mistakes

  1. Not checking that the vector is a unit vector: the formula ∇f⋅v\nabla f \cdot v holds only if vv is a unit vectora vector of modulus one. If a vector ww with ∥w∥≠1\|w\| \neq 1 is given, it must be normalized by dividing by its norm: v=w∥w∥v = \frac{w}{\|w\|}.
  2. Confusing having partial derivatives with differentiability: in one-variable calculus the two notions coincide, but in several variables they do not. Do not deduce continuity from the mere existence of partial derivatives.
  3. Using the differentiation rules where the function is piecewise defined: at the junction point (often the origin) the partial derivatives are computed from the definition, using the value assigned at that point.
  4. Forgetting terms that are constant in the variable: when differentiating ex2y+3xe^{x^2y} + 3x with respect to xx the 33 is there, with respect to yy the term 3x3x disappears.

Versione ripasso

Partial derivative. For f:D⊆Rn→Rf: D \subseteq \mathbb{R}^n \to \mathbb{R} and x0x_0 interior: ∂f∂xi(x0)=lim⁡h→0f(x0+hei)−f(x0)h\frac{\partial f}{\partial x_i}(x_0) = \lim_{h \to 0} \frac{f(x_0 + h e_i) - f(x_0)}{h} with eie_i the ii-th vector of the canonical basis. In practice one differentiates with respect to xix_i treating the other variables as constants. Example: f=x2yf = x^2y has fx=2xyf_x = 2xy, fy=x2f_y = x^2, so (2,1)(2, 1) at (1,1)(1,1).

Gradient. ∇f(x0)=(∂f∂x1(x0),…,∂f∂xn(x0))\nabla f(x_0) = \left(\frac{\partial f}{\partial x_1}(x_0), \dots, \frac{\partial f}{\partial x_n}(x_0)\right). Example: f=xyzf = xyz has ∇f(1,2,3)=(6,3,2)\nabla f(1,2,3) = (6, 3, 2).

Directional derivative along a unit vector vv (∥v∥=1\|v\| = 1): ∂f∂v(x0)=lim⁡h→0f(x0+hv)−f(x0)h\frac{\partial f}{\partial v}(x_0) = \lim_{h \to 0} \frac{f(x_0 + hv) - f(x_0)}{h} Partial derivatives are directional derivatives along the axes. The unit vector makes hh the distance travelled.

Gradient theorem. If ff is differentiable at x0x_0, for every unit vector vv: ∂f∂v(x0)=∇f(x0)⋅v\frac{\partial f}{\partial v}(x_0) = \nabla f(x_0) \cdot v Example: f=x2yf = x^2y at (1,1)(1,1) with v=12(1,1)v = \frac{1}{\sqrt2}(1,1): (2,1)⋅v=32(2,1)\cdot v = \frac{3}{\sqrt2}. The limit computation, (1+t)3−1h\frac{(1+t)^3 - 1}{h} with t=h2t = \frac{h}{\sqrt2}, gives the same result. See Differentiability and the Gradientf is differentiable at x0 if f(x) = f(x0) + grad f(x0)·(x - x0) + o(‖x - x0‖), i.e. near x0 the graph is indistinguishable from the tangent plane z = f(x0) + grad f(x0)·(x - x0). Differentiable implies continuous, with partial derivatives and D_v f = grad f · v; continuous partial derivatives imply differentiable. The gradient gives the direction of steepest increase (slope ‖grad f‖) and is orthogonal to level curves.Differentiability and the Gradient →.

Having derivatives does not imply continuity.

Continuous does not imply having derivatives. f=x2+y2f = \sqrt{x^2+y^2} at the origin: f(h,0)−f(0,0)h=∣h∣h\frac{f(h,0)-f(0,0)}{h} = \frac{|h|}{h} has no limit.

Differentiability, which implies continuity and directional derivatives, is the right notion: Differentiability and the Gradientf is differentiable at x0 if f(x) = f(x0) + grad f(x0)·(x - x0) + o(‖x - x0‖), i.e. near x0 the graph is indistinguishable from the tangent plane z = f(x0) + grad f(x0)·(x - x0). Differentiable implies continuous, with partial derivatives and D_v f = grad f · v; continuous partial derivatives imply differentiable. The gradient gives the direction of steepest increase (slope ‖grad f‖) and is orthogonal to level curves.Differentiability and the Gradient →.

Typical mistakes.

  • Using a vector ww with ∥w∥≠1\|w\| \neq 1 in ∇f⋅v\nabla f \cdot v: normalize first, v=w∥w∥v = \frac{w}{\|w\|}.
  • Using the ordinary rules at the junction point of a piecewise function: there the definition must be used.
  • Deducing continuity from the mere existence of partial derivatives.
  • When differentiating ex2y+3xe^{x^2y} + 3x with respect to yy, the term 3x3x disappears.

Teoria collegata