Salta al contenuto
Note per Studenti Jacobian Matrix and the Chain Rule Report

Jacobian Matrix and the Chain Rule

In questa pagina 5

This note builds on 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 →.

Vector-valued functions and differentiability

Let F:Ω⊆Rn→RmF: \Omega \subseteq \mathbb{R}^n \to \mathbb{R}^m be a vector-valued function, written F(x)=(f1(x),f2(x),…,fm(x))F(x) = (f_1(x), f_2(x), \dots, f_m(x)), where each fi:Ω→Rf_i: \Omega \to \mathbb{R} is a scalar function.

Definition. The function FF is differentiable at x0∈Ωx_0 \in \Omega if each of its components fif_i is differentiable at x0x_0. In that case the differential of FF at x0x_0 is the linear map represented by the Jacobian matrix JF(x0)J_F(x_0).

Example. F(x,y)=(x2y, x+y)F(x,y) = (x^2 y,\ x + y) has JF=(2xyx211)J_F = \begin{pmatrix} 2xy & x^2 \\ 1 & 1 \end{pmatrix}; at (1,2)(1,2) it equals (4111)\begin{pmatrix} 4 & 1 \\ 1 & 1 \end{pmatrix}.

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 → provides the conceptual basis for the differentiability of scalar functions, which is here extended to vector-valued ones.

Jacobian matrix

The Jacobian matrix is the m×nm \times n matrix containing all the first-order partial derivatives of FF:

JF(x)=(∂f1∂x1…∂f1∂xn⋮⋱⋮∂fm∂x1…∂fm∂xn)J_F(x) = \begin{pmatrix} \frac{\partial f_1}{\partial x_1} & \dots & \frac{\partial f_1}{\partial x_n} \\ \vdots & \ddots & \vdots \\ \frac{\partial f_m}{\partial x_1} & \dots & \frac{\partial f_m}{\partial x_n} \end{pmatrix}

Each row ii of the Jacobian matrix is the gradient of the component fif_i. Rows = components of FF (how many outputs, mm), columns = variables (how many inputs, nn).

As in the scalar case, differentiability means F(x)=F(x0)+JF(x0) (x−x0)+o(∥x−x0∥)F(x) = F(x_0) + J_F(x_0)\,(x - x_0) + o(\|x - x_0\|), with x−x0x - x_0 written as a column vector: the Jacobian is the "derivative" of FF.

Example. F(x,y)=(xy, x+y2, ex)F(x, y) = (xy,\ x + y^2,\ e^{x}), from R2\mathbb{R}^2 to R3\mathbb{R}^3: JF(x,y)=(yx12yex0)J_F(x, y) = \begin{pmatrix} y & x \\ 1 & 2y \\ e^x & 0 \end{pmatrix} a 3×23 \times 2 matrix. For m=1m = 1 the Jacobian is the gradient written as a row; for n=1n = 1 (a curve γ(t)\gamma(t)) it is the column of derivatives γ′(t)\gamma'(t).

Chain rule

Let g:Rn→Rkg: \mathbb{R}^n \to \mathbb{R}^k and f:Rk→Rmf: \mathbb{R}^k \to \mathbb{R}^m be differentiable functions. The composite function H=f∘gH = f \circ g (defined by H(x)=f(g(x))H(x) = f(g(x))) has Jacobian matrix equal to the product of the Jacobian matrices of the individual functions:

JH(x)=Jf(g(x))⋅Jg(x)J_H(x) = J_f(g(x)) \cdot J_g(x)

The product of an m×km \times k by a k×nk \times n matrix gives an m×nm \times n matrix, as it must for a function from Rn\mathbb{R}^n to Rm\mathbb{R}^m. It generalizes (f∘g)′(x)=f′(g(x)) g′(x)(f \circ g)'(x) = f'(g(x))\, g'(x): the Jacobian of ff must be evaluated at the point g(x)g(x), not at xx.

Special cases

  1. Derivative along a curve: if g(t)=γ(t)g(t) = \gamma(t) is a curve in Rn\mathbb{R}^n and ff is scalar (m=1m=1), the rule becomes: ddtf(γ(t))=∇f(γ(t))⋅γ′(t)\frac{d}{dt} f(\gamma(t)) = \nabla f(\gamma(t)) \cdot \gamma'(t) This is the dot product of the gradient of ff and the velocity vector of the curve.

    Example. f(x,y)=x2yf(x, y) = x^2y along the circle γ(t)=(cos⁡t,sin⁡t)\gamma(t) = (\cos t, \sin t). ∇f=(2xy,x2)\nabla f = (2xy, x^2), γ′(t)=(−sin⁡t,cos⁡t)\gamma'(t) = (-\sin t, \cos t): ddtf(γ(t))=2cos⁡tsin⁡t (−sin⁡t)+cos⁡2tcos⁡t=cos⁡3t−2cos⁡tsin⁡2t\frac{d}{dt} f(\gamma(t)) = 2\cos t \sin t\,(-\sin t) + \cos^2 t \cos t = \cos^3 t - 2\cos t\sin^2 t Direct check: f(γ(t))=cos⁡2tsin⁡tf(\gamma(t)) = \cos^2 t \sin t, whose derivative is −2cos⁡tsin⁡t⋅sin⁡t+cos⁡2tcos⁡t-2\cos t\sin t \cdot \sin t + \cos^2 t\cos t, the same result.

  2. Functions of two variables: if f=f(u,v)f = f(u, v) with u=u(x,y)u = u(x, y) and v=v(x,y)v = v(x, y), the matrix JfJ_f is 1×21 \times 2 and JgJ_g is 2×22 \times 2. The derivative with respect to xx is: ∂f∂x=∂f∂u∂u∂x+∂f∂v∂v∂x\frac{\partial f}{\partial x} = \frac{\partial f}{\partial u}\frac{\partial u}{\partial x} + \frac{\partial f}{\partial v}\frac{\partial v}{\partial x} (and the same with yy in place of xx): one sums over all the "routes" through which xx influences ff.

    Example (derivatives in polar coordinates). If g(ρ,θ)=f(ρcos⁡θ,ρsin⁡θ)g(\rho, \theta) = f(\rho\cos\theta, \rho\sin\theta), with x=ρcos⁡θx = \rho\cos\theta and y=ρsin⁡θy = \rho\sin\theta: ∂g∂ρ=fxcos⁡θ+fysin⁡θ,∂g∂θ=−fx ρsin⁡θ+fy ρcos⁡θ\frac{\partial g}{\partial \rho} = f_x \cos\theta + f_y \sin\theta, \qquad \frac{\partial g}{\partial \theta} = -f_x\,\rho\sin\theta + f_y\,\rho\cos\theta with fx,fyf_x, f_y evaluated at (ρcos⁡θ,ρsin⁡θ)(\rho\cos\theta, \rho\sin\theta). For f=x2+y2f = x^2 + y^2: gρ=2xcos⁡θ+2ysin⁡θ=2ρg_\rho = 2x\cos\theta + 2y\sin\theta = 2\rho and gθ=0g_\theta = 0, consistent with g=ρ2g = \rho^2.

Changes of coordinates and invertibility

A change of coordinates F:Ω⊆Rn→RnF: \Omega \subseteq \mathbb{R}^n \to \mathbb{R}^n is regulara C^1 function whose Jacobian determinant is nonzero (except at most on a set of measure zero).

Local invertibility theorem. Let FF be a regular transformation. If det⁡(JF(x0))≠0\det(J_F(x_0)) \neq 0, then there locally exists an inverse function F−1F^{-1} whose Jacobian matrix is: JF−1(y)=[JF(x)]−1with y=F(x)J_{F^{-1}}(y) = [J_F(x)]^{-1} \quad \text{with } y = F(x)

Example. F(x,y)=(x+y, x−y)F(x,y) = (x + y,\ x - y) has det⁡JF=−2≠0\det J_F = -2 \ne 0 and JF−1=JF−1=(1/21/21/2−1/2)J_{F^{-1}} = J_F^{-1} = \begin{pmatrix} 1/2 & 1/2 \\ 1/2 & -1/2 \end{pmatrix}.

Example: polar coordinates in R2\mathbb{R}^2

Given x=ρcos⁡θx = \rho \cos\theta and y=ρsin⁡θy = \rho \sin\theta, the Jacobian is: JF(ρ,θ)=(cos⁡θ−ρsin⁡θsin⁡θρcos⁡θ)J_F(\rho, \theta) = \begin{pmatrix} \cos\theta & -\rho \sin\theta \\ \sin\theta & \rho \cos\theta \end{pmatrix} The determinant is det⁡(JF)=ρcos⁡2θ+ρsin⁡2θ=ρ\det(J_F) = \rho \cos^2\theta + \rho \sin^2\theta = \rho. It is nonzero where ρ≠0\rho \neq 0: there the transformation is locally invertible; all points with ρ=0\rho = 0 go to the origin.

Cylindrical and spherical coordinates in R3\mathbb{R}^3

  • Cylindrical: x=ρcos⁡θx = \rho\cos\theta, y=ρsin⁡θy = \rho\sin\theta, z=zz = z. The Jacobian has the polar block and a 11 at the bottom right, so det⁡J=ρ\det J = \rho; singular on the zz axis.
  • Spherical: x=ρsin⁡φcos⁡θx = \rho\sin\varphi\cos\theta, y=ρsin⁡φsin⁡θy = \rho\sin\varphi\sin\theta, z=ρcos⁡φz = \rho\cos\varphi, with ρ≥0\rho \geq 0, φ∈[0,π]\varphi \in [0, \pi] (angle from the zz axis), θ∈[0,2π]\theta \in [0, 2\pi]. With the variables in the order (ρ,φ,θ)(\rho, \varphi, \theta) the determinant equals ρ2sin⁡φ\rho^2\sin\varphi (swapping the order of two variables only changes the sign); in absolute value, which is what is needed in integrals, ∣det⁡J∣=ρ2sin⁡φ|\det J| = \rho^2 \sin\varphi. Singular for ρ=0\rho = 0 and for sin⁡φ=0\sin\varphi = 0, i.e. on the zz axis.

Local does not mean global

F(x,y)=(excos⁡y, exsin⁡y)F(x, y) = (e^x\cos y,\ e^x\sin y) has JF=(excos⁡y−exsin⁡yexsin⁡yexcos⁡y),det⁡JF=e2x(cos⁡2y+sin⁡2y)=e2x>0J_F = \begin{pmatrix} e^x\cos y & -e^x\sin y \\ e^x\sin y & e^x\cos y \end{pmatrix}, \qquad \det J_F = e^{2x}(\cos^2 y + \sin^2 y) = e^{2x} > 0 at every point, so it is locally invertible everywhere. But it is not injective: F(x,y)=F(x,y+2π)F(x, y) = F(x, y + 2\pi). The theorem guarantees an inverse only in a neighbourhood of each point.

Common mistakes

  • Order of the product: remember that the Jacobian of the composite follows the order Jf⋅JgJ_f \cdot J_g (outer-inner). Reversing the order leads to incompatible dimensions or wrong results.
  • Confusing singular points and globality: det⁡(JF)≠0\det(J_F) \neq 0 guarantees only local invertibility. For instance, in polar coordinates the origin (ρ=0\rho=0) is not invertible and the map is not globally injective (because of the periodicity of θ\theta).
  • Matrix dimensions: getting the number of rows and columns wrong. If f:Rn→Rmf: \mathbb{R}^n \to \mathbb{R}^m, the matrix must always be m×nm \times n.

Versione ripasso

Jacobian. For F=(f1,…,fm):Ω⊆Rn→RmF = (f_1,\dots,f_m): \Omega \subseteq \mathbb{R}^n \to \mathbb{R}^m the m×nm \times n matrix is JF(x)=(∂fi∂xj(x))ijJ_F(x) = \left(\frac{\partial f_i}{\partial x_j}(x)\right)_{ij} Each row is the gradient of a component. Example: F=(x2y,x+y)F = (x^2y, x+y) has JF=(2xyx211)J_F = \begin{pmatrix}2xy & x^2\\ 1 & 1\end{pmatrix}, which at (1,2)(1,2) equals (4111)\begin{pmatrix}4&1\\1&1\end{pmatrix}. With n=1n = 1 (a curve) it is the column of the γ′(t)\gamma'(t).

Chain rule. For H=f∘gH = f\circ g: JH(x)=Jf(g(x))⋅Jg(x)J_H(x) = J_f(g(x))\cdot J_g(x) The Jacobian of ff is evaluated at the point g(x)g(x), and the product is m×km\times k times k×nk\times n.

  • Along a curve: ddtf(γ(t))=∇f(γ(t))⋅γ′(t)\frac{d}{dt}f(\gamma(t)) = \nabla f(\gamma(t))\cdot\gamma'(t). Example: f=x2yf = x^2y on (cos⁡t,sin⁡t)(\cos t,\sin t) gives cos⁡3t−2cos⁡tsin⁡2t\cos^3 t - 2\cos t\sin^2 t, which matches the derivative of cos⁡2t sin⁡t\cos^2 t\,\sin t.
  • Two variables: ∂f∂x=∂f∂u∂u∂x+∂f∂v∂v∂x\frac{\partial f}{\partial x} = \frac{\partial f}{\partial u}\frac{\partial u}{\partial x} + \frac{\partial f}{\partial v}\frac{\partial v}{\partial x}, summing over all the routes through which xx acts.
  • Polar: if g(ρ,θ)=f(ρcos⁡θ,ρsin⁡θ)g(\rho,\theta) = f(\rho\cos\theta,\rho\sin\theta), then gρ=fxcos⁡θ+fysin⁡θg_\rho = f_x\cos\theta + f_y\sin\theta and gθ=ρ(−fxsin⁡θ+fycos⁡θ)g_\theta = \rho(-f_x\sin\theta + f_y\cos\theta). For f=x2+y2f = x^2+y^2 we get gρ=2ρg_\rho = 2\rho, gθ=0g_\theta = 0.

Local invertibility. If F:Ω→RnF: \Omega \to \mathbb{R}^n is C1C^1 and det⁡JF(x0)≠0\det J_F(x_0) \neq 0, there is locally an inverse with JF−1(y)=[JF(x)]−1J_{F^{-1}}(y) = [J_F(x)]^{-1}, y=F(x)y = F(x).

  • Example: F=(x+y,x−y)F = (x+y, x-y) has det⁡=−2\det = -2 and JF−1=(121212−12)J_{F^{-1}} = \begin{pmatrix}\frac12 & \frac12\\ \frac12 & -\frac12\end{pmatrix}.

Jacobians of the coordinate systems.

  • Polar: det⁡J=ρ\det J = \rho, vanishing only at the origin.
  • Cylindrical: det⁡J=ρ\det J = \rho, singular on the zz axis.
  • Spherical, with order (ρ,φ,θ)(\rho,\varphi,\theta): ∣det⁡J∣=ρ2sin⁡φ|\det J| = \rho^2\sin\varphi, singular for ρ=0\rho = 0 and on the zz axis.

Local does not mean global. F=(excos⁡y,exsin⁡y)F = (e^x\cos y, e^x\sin y) has det⁡J=e2x>0\det J = e^{2x} > 0 everywhere, but F(x,y)=F(x,y+2π)F(x,y) = F(x,y+2\pi): it is not injective. The theorem gives an inverse only in a neighbourhood of each point.

Typical mistakes.

  • Reversing the order of the product: it is Jf(g(x))⋅Jg(x)J_f(g(x))\cdot J_g(x), not the opposite.
  • Wrong dimensions: if f:Rn→Rmf:\mathbb{R}^n\to\mathbb{R}^m, the matrix is m×nm\times n.
  • Deducing global injectivity from det⁡J≠0\det J \neq 0.

Teoria collegata