Foundations to Frontier
Tests
A. Mathematical Foundations › A3 Calculus and Analysis › Real and functional analysis

Fréchet and Gâteaux Derivatives

Derivatives for anything you can add and scale: functions, matrices, curves, whole network weight tensors. The Gâteaux derivative is the rate of change along one direction. The Fréchet derivative is a single linear map that approximates the change in every direction at once, with a remainder smaller than the step. They give matrix-calculus rules (D(X²) = XH + HX), functional gradients, Lie-group Jacobians, and the insight that choosing an inner product chooses the gradient, which is the idea behind natural gradients.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Zoom in until it’s flat

Zoom far enough into any smooth hill and it looks like a flat tilted plane. That plane is the derivative: the best straight-line description of how things change nearby. So far you’ve done this for functions of numbers. But what if the “input” is a whole curve, a matrix, or the millions of weights of a neural network?

The same idea still works. You need a way to say “a small change” and a way to say “approximately linear”. Two versions exist:

  • the Gâteaux derivative measures the slope one direction at a time;
  • the Fréchet derivative demands one flat plane that works in every direction at once.
Is it really the derivative? The remainder test
approach 0 along:
‖h‖ = 1 → 10⁻⁶ (log)log₁₀ remainder / ‖h‖
ratio at ‖h‖ = 1: 4.70e-1 · at ‖h‖ = 10⁻⁶: 6.99e-7 — → 0 along this approach ✅
Along every straight line the ratio → 0 (the Gâteaux derivative 0 exists). Along y = x³ the function sits at ½, so the ratio blows up like 1/‖h‖. Not Fréchet, not even continuous. Fréchet: one linear map D with remainder o(‖h‖) along all approaches at once. Gâteaux: only along each straight line separately.
Why engineers care

A drone’s orientation is a rotation matrix, not a number. Its estimator needs the derivative of “rotate by this matrix” with respect to small rotations. A neural network’s loss depends on weight matrices. Fréchet derivatives are how you differentiate both correctly, and the naïve “it’s like x²” guess is often wrong.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Zooming far into a smooth surface, it looks…
  2. 2. The Gâteaux derivative looks at…
  3. 3. Can we differentiate with respect to a matrix?

Level 1: Beginner

★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.

Two definitions

Let F:X→YF: X\to Y map between normed spaces, such as Rn\mathbb R^n, matrices, or functions.

  • Gâteaux derivative at xx in direction hh: dF(x;h)=lim⁡t→0F(x+th)−F(x)tdF(x;h) = \lim_{t\to0}\frac{F(x + th) - F(x)}t. This is the directional derivative.
  • Fréchet derivative: a bounded linear map DF(x):X→YDF(x): X\to Y with
F(x+h)=F(x)+DF(x)[h]+r(h),∥r(h)∥∥h∥→0 as h→0F(x + h) = F(x) + DF(x)[h] + r(h), \qquad \frac{\|r(h)\|}{\|h\|}\to0 \text{ as } h\to0

If FF is Fréchet differentiable, then dF(x;h)=DF(x)[h]dF(x;h) = DF(x)[h] for every hh. The converse can fail.

Examples:

  • f(x,y)=x2+3yf(x,y) = x^2 + 3y on R2\mathbb R^2: Df[h]=2xh1+3h2=∇f⋅hDf[h] = 2xh_1 + 3h_2 = \nabla f\cdot h.
  • J[f]=∫01f2 dxJ[f] = \int_0^1f^2\,dx on L2L^2: J[f+h]=J[f]+2∫fh+∫h2J[f + h] = J[f] + 2\int fh + \int h^2, so DJ[h]=⟨2f,h⟩DJ[h] = \langle2f, h\rangle. The gradient is 2f2f, a function (the Riesz representation, A3.5-5).
  • F(X)=X2F(X) = X^2 on matrices: (X+H)2=X2+XH+HX+H2(X + H)^2 = X^2 + XH + HX + H^2, so DF(X)[H]=XH+HXDF(X)[H] = XH + HX. That’s not 2XH2XH, because matrices don’t commute.
📝 Quick check (Level 1)
0/3 answered
  1. 1. D(X²)[H] = ?
  2. 2. The L² gradient of J[f] = ∫f² is…
  3. 3. Fréchet's remainder must satisfy…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.

Rules you can now use anywhere

  • Chain rule: D(G∘F)(x)=DG(F(x))∘DF(x)D(G\circ F)(x) = DG(F(x))\circ DF(x). That’s composition of linear maps: backprop (A3.3) in infinite dimensions.
  • Product rule: D(FG)[H]=DF[H] G+F DG[H]D(FG)[H] = DF[H]\,G + F\,DG[H], keeping the order.
  • Matrix inverse: differentiate XX−1=IXX^{-1} = I to get HX−1+X D(X−1)[H]=0H X^{-1} + X\,D(X^{-1})[H] = 0, so D(X−1)[H]=−X−1HX−1D(X^{-1})[H] = -X^{-1}HX^{-1}.
  • Determinant (Jacobi): Ddet⁡(X)[H]=det⁡(X)tr⁡(X−1H)D\det(X)[H] = \det(X)\operatorname{tr}(X^{-1}H), and therefore Dlog⁡det⁡(X)[H]=tr⁡(X−1H)D\log\det(X)[H] = \operatorname{tr}(X^{-1}H) (A3.3-3).
  • Matrix exponential: Dexp⁡(X)[H]=∫01esXHe(1−s)X dsD\exp(X)[H] = \int_0^1e^{sX}He^{(1-s)X}\,ds. It reduces to eXHe^XH only when XX and HH commute.

Derivative vs gradient

The Fréchet derivative DF(x)DF(x) is a linear functional, fixed by FF alone. A gradient is the vector gg with DF(x)[h]=⟨g,h⟩DF(x)[h] = \langle g, h\rangle, so it depends on the chosen inner product.

  • With the L2L^2 inner product, J[u]=12∫(u−f)2+λ2∫u′2J[u] = \tfrac12\int(u - f)^2 + \tfrac\lambda2\int u'^2 has gradient u−f−λu′′u - f - \lambda u''. That’s the Euler–Lagrange expression (A3.5-9).
  • With the Sobolev H1H^1 inner product, the gradient becomes (I−α∂2)−1(I - \alpha\partial^2)^{-1} applied to it. That’s a smoother, far better-conditioned descent direction (Exercise 2).
🐍 Exercise 1: derivatives of functionals and matrix maps
Compute Gâteaux derivatives of J[f] = ∫(f² + sin f) by finite differences and match them with ⟨2f + cos f, v⟩. Then verify the Fréchet derivatives of X ↦ X² and X ↦ X⁻¹ by checking that the remainder is o(‖H‖).
📝 Quick check (Level 2)
0/3 answered
  1. 1. D(X⁻¹)[H] = ?
  2. 2. D log det(X)[H] = ?
  3. 3. The gradient depends on…

Level 3: Advanced

★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.

Fréchet ⇒ Gâteaux, but not conversely

Fréchet ⇒ Gâteaux. Put h→thh\to th in the definition: F(x+th)−F(x)t=DF(x)[h]+r(th)t\frac{F(x + th) - F(x)}t = DF(x)[h] + \frac{r(th)}t. The last term has norm ∥h∥⋅∥r(th)∥∥th∥→0\|h\|\cdot\frac{\|r(th)\|}{\|th\|}\to0. ∎

A counterexample to the converse. Let f(x,y)=x3yx6+y2f(x,y) = \frac{x^3y}{x^6 + y^2} with f(0,0)=0f(0,0) = 0. Along any line, f(ta,tb)/t=ta3bt4a6+b2→0f(ta,tb)/t = \frac{ta^3b}{t^4a^6 + b^2}\to0, so every directional derivative is 0 and the Gâteaux derivative is the zero linear map. But along y=x3y = x^3, f=12f = \tfrac12. So ff is not even continuous at 0, and can’t be Fréchet differentiable (Practice Code 4, and the demo). The lesson: checking directions one at a time can miss curved approaches.

A sufficient condition. If all partial (or Gâteaux) derivatives exist near xx and depend continuously on the point, then FF is Fréchet differentiable there.

Deriving D(X⁻¹)

(X+H)−1=(X(I+X−1H))−1=(I+X−1H)−1X−1(X + H)^{-1} = (X(I + X^{-1}H))^{-1} = (I + X^{-1}H)^{-1}X^{-1}. The Neumann series (A3.5-6) gives (I+X−1H)−1=I−X−1H+O(∥H∥2)(I + X^{-1}H)^{-1} = I - X^{-1}H + O(\|H\|^2). So (X+H)−1=X−1−X−1HX−1+O(∥H∥2)(X + H)^{-1} = X^{-1} - X^{-1}HX^{-1} + O(\|H\|^2). ∎

The chain rule, proved

Write F(x+h)=F(x)+Ah+r1(h)F(x + h) = F(x) + Ah + r_1(h) and G(y+k)=G(y)+Bk+r2(k)G(y + k) = G(y) + Bk + r_2(k). Then G(F(x+h))=G(F(x))+B(Ah+r1)+r2(Ah+r1)G(F(x + h)) = G(F(x)) + B(Ah + r_1) + r_2(Ah + r_1). Both Br1(h)Br_1(h) and r2(Ah+r1(h))r_2(Ah + r_1(h)) are o(∥h∥)o(\|h\|), since ∥Ah+r1∥≤C∥h∥\|Ah + r_1\|\le C\|h\|. So D(G∘F)=BAD(G\circ F) = BA. ∎

Exercise 3.1: Compute d/dt det(I + tA) at t = 0

By the chain rule and Jacobi’s formula at X=IX = I: Ddet⁡(I)[A]=tr⁡AD\det(I)[A] = \operatorname{tr}A. For example, a matrix with trace 7 gives 7. This is why volume change under a flow x˙=Ax\dot x = Ax is governed by tr⁡A=∇⋅(Ax)\operatorname{tr}A = \nabla\cdot(Ax) (A3.4-1).

📝 Quick check (Level 3)
0/3 answered
  1. 1. Fréchet differentiable ⇒ Gâteaux differentiable?
  2. 2. f = x³y/(x⁶ + y²) along y = x³ equals…
  3. 3. d/dt det(I + tA) at t = 0 = ?

Level 4: Expert

★★★★★ Expert⏱ 45 minResearchers: original papers and open problems.

Choosing the inner product is choosing the algorithm

Gradient descent u←u−ηgu\leftarrow u - \eta g depends on which gradient you use. For an energy with a ∫u′2\int u'^2 term, the L2L^2 gradient has a stability limit η≲dx2/λ\eta\lesssim dx^2/\lambda that shrinks as the grid refines. The Sobolev gradient solves (I−α∂2)gH1=gL2(I - \alpha\partial^2)g_{H^1} = g_{L^2}. It’s mesh-independent and, here, an exact preconditioner (Neuberger, 1997). That’s the same idea as:

  • natural gradient descent, which uses the Fisher-information inner product so steps are invariant to how a model is parametrized (Amari, 1998; A3.3-4);
  • K-FAC and Shampoo, which approximate it for deep networks;
  • mirror descent, for non-Euclidean geometries.
🐍 Exercise 2 (research): L² vs Sobolev gradients
Denoise a signal by minimizing ½∫(u − f)² + (λ/2)∫u′². Derive the L² gradient (and check it against finite differences), run descent at its largest stable step, then use the H¹ (Sobolev) gradient. Same derivative, different inner product, very different convergence.

Fréchet derivatives in robotics, control and learning

  • Lie groups. Orientation estimation and pose-graph SLAM differentiate maps on SO(3)SO(3) and SE(3)SE(3). Perturbations are applied as Rexp⁡(δ^)R\exp(\hat\delta), and the needed Jacobians come from Dexp⁡D\exp (Practice Code 5). Used in IMU preintegration (Forster et al., 2017) and Lie-group EKFs. See Solà, Deray and Atchuthan (2018) for a practical guide.
  • Shape and topology optimization. “Shape derivatives” of drag or compliance with respect to a boundary deformation are Fréchet derivatives on spaces of shapes. Combined with adjoint solves (A3.4-3), they design wings, brackets and heat sinks.
  • Implicit layers. For an equilibrium z∗=g(z∗,θ)z^* = g(z^*, \theta), the implicit function theorem gives Dz∗(θ)=(I−Dzg)−1DθgDz^*(\theta) = (I - D_zg)^{-1}D_\theta g, a Fréchet-derivative statement in Banach spaces. It underlies deep equilibrium models and differentiable optimization layers (Bai et al., 2019; Amos and Kolter, 2017).
  • Infinite-width theory. NTK analysis linearizes a network around initialization in function space, a first-order Fréchet expansion of the parameter-to-function map (Jacot et al., 2018).

References

  1. D. Luenberger (1969). Optimization by Vector Space Methods. Wiley.
  2. E. Zeidler (1995). Applied Functional Analysis: Main Principles and Their Applications. Springer.
  3. J. W. Neuberger (1997). Sobolev Gradients and Differential Equations. Springer.
  4. S. Amari (1998). “Natural gradient works efficiently in learning.” Neural Computation, 10(2).
  5. N. Higham (2008). Functions of Matrices: Theory and Computation. SIAM. (Fréchet derivative of exp.)
  6. J. Solà, J. Deray, D. Atchuthan (2018). “A micro Lie theory for state estimation in robotics.” arXiv:1812.01537.
  7. C. Forster, L. Carlone, F. Dellaert, D. Scaramuzza (2017). “On-manifold preintegration for real-time visual–inertial odometry.” IEEE Transactions on Robotics, 33(1).
  8. S. Bai, J. Z. Kolter, V. Koltun (2019). “Deep equilibrium models.” NeurIPS.
  9. B. Amos, J. Z. Kolter (2017). “OptNet: differentiable optimization as a layer in neural networks.” ICML.
  10. G. Allaire (2007). Conception optimale de structures. Springer. (Shape derivatives.)