# Calculus and Category theory

Quick question:

Is it possible to differentiate a function with respect to another function, or is it limited to a particular variable?

I tried thinking around how to make this question make sense, but I can't figure it out!

I mean, $\frac{\mathrm{d}}{\mathrm{d}x}$ is a function which accepts a function, and returns a function (the derivative of the original function). However, $\frac{\mathrm{d}}{\mathrm{d}x}$ is not equal to $\frac{\mathrm{d}}{\mathrm{d}y}$, and not equal to $\frac{\mathrm{d}}{\mathrm{d}z}$, so it appears that the function for differentiation would be:

derivative :: (real -> real) -> variable with respect to which you are differentiating -> (real -> real)

so, why can't I do: \begin{align} \text{let }f(x) &= \sin(x)\\ \text{let }g(x) &= \cos(x)\\ \frac{\mathrm{d}}{\mathrm{d}g} f(x) &=\ ??? \end{align} and if I can, what is this called and where can I read more about this?

Sorry for badly formulating the question, but I am really curious on how to understand this idea, as I feel like I huge gap in understanding...

I would formulate this better, but the books on Calculus are so focused on applications and proofs, rather than explaining what it is, and when they try to explain what it is, they still do not explain it in terms that are useful to me. I am trying to understand how Calculus can be visualized under Category Theory, so that I can model it better in Haskell other programming languages.

Thanks! ~Dmitry

• Of course you can do this! You can just define it in terms of the chain rule: $df/dg = (df/dx)/(dg/dx)$. When the functions are differentiable, I'd argue this is the only way it should be defined -- in particular, when you have a number of physical quantities that depend on each other simultaneously, this is the correct notion. Commented Mar 22, 2013 at 5:57
• Are you asking about operators whose domain are functions, or some implicit function related thing? Commented Mar 22, 2013 at 6:03
• I am just really curious how differentiation of say, sine with respect to cosine works, rather than simply differentiation of cosine with respect to x... Also I am curious how differentiation can be expressed in terms of category theory, however I doubt people understand what I mean by that, so I'll stick the first part for now, and research for how to phrase the remainder later... Commented Mar 22, 2013 at 6:07
• Your question about category theory, though, is interesting! I've been looking around for things about categorical ways to talk about calculus, and none of them really seem convincing. The only thing I can think of is this categorical description of the unit interval. Commented Mar 22, 2013 at 6:48
• en.wikipedia.org/wiki/Calculus_of_functors Commented Mar 22, 2013 at 12:21

To answer the part of your question about a categorical point of view of calculus, Bill Lawvere developed an axiomatization of differential geometry in a smooth topos, which unifies many operations in both differential geometry (hence classical calculus) and algebraic geometry. This beautiful theory is called synthetic differential geometry, and is in many ways much simpler than the usual approach to calculus via limits.

In synthetic differential geometry the total derivative is the internal hom functor $(-)^D$, where $D := \{ d \in R : d^2 = 0\}$ is the "walking tangent vector". Here, $R$ is the line object in the smooth topos, which is like the classical real line but augmented with nilpotent elements.

To be more precise the above definition is an axiomatization of the tangent functor from classical differential geometry, so unlike the single-variable classical calculus derivative (which is a special case of the exterior derivative or Darboux derivative) it keeps track of the base points in the space. The classical derivative of a map between vector spaces can be obtained from the tangent map by projecting to the typical fibre of the tangent bundle, which is trivial in this case.

I apologize if this is a bit over your head, but check out John Bell's A Primer of Infinitesimal Analysis for an undergrad-level introduction, or Anders Kock's freely available text for a slightly more advanced but more comprehensive introduction.

• I like math and want to grasp as much of it as I can and currently trying to get familiar with category theory (mostly for programming as a reason). My quick question is: does Lawvere's synthetic differential geometry theory means that CT gives the whole calculus course for free? ^^ Commented Sep 26, 2019 at 16:30

Your question for the derivative of a function $f$ with respect to a function $g$ is answered in the comments: $\frac{df}{dg}=f'(g(x))\cdot g'(x)$.

As for the categorical approach, I'll try to indicate some inherent problems with categorifying the notions of limits and derivatives from analysis.

When you define something in a category, you are defining a concept that is sensitive to all of the morphisms in the category. The more category theoretic way of phrasing this is of course the notion of universality, which is everywhere in category theory.

However, a limit of a function at a point, or the derivative of a function at a point is a notion that is very local. You can change the function's values everywhere out of a tiny little neighborhood of the point, and the local behaviour of the function at that point does not change.

Thus, there is some tension here between the categorical philosophy where everything is global and highly sensitive to the other morphisms in the category, and the analytical notions of locality.

Having said that, there are some things that can (sort of) be categorified. There is Lawvere's work on generalized metric spaces which shows that quite a lot of metric space theory can be seen as enriched category theory. In particular, the notion of weighted (co)limits does related to an analytical notion of limit but not quite the ordinary one. Completion of metric spaces has been categorified, but here too the categorified notion is not quite the same as the analytic metric one.

A couple of days ago I came across a paper that marginally relates to the topic in this question, so I thought it would be useful to cite it here. Yes, I realize this paper has little to do with the specific question asked above, but I think it is likely that someone looking in math StackExchange for what this paper covers would be led to this question.

Giampaolo Cicogna, A method from categories for introducing a general notion of convergence and limit, Journal of Mathematical Analysis and Applications 76 #1 (July 1980), 476-482. MR 81k:18002 Zbl 441.18006

The Introduction to the paper follows.

This paper does not contain, properly, any "new theorem." Rather, it wants to propose an abstract construction, essentially of algebraic nature, which provides a sort of "axiomatization" of some classical topics of Mathematical Analysis, as well as possibly a convenient frame for understanding and generalizing some "global" properties of them.

This general construction is obtained by using a typical technique taken from Category theory: it is mainly given by (repeated) Kan extensions [6, 8] of suitable patterns of functors, as we shall describe in the next section. In the last section, we will test this scheme, by reexaminating [= reexamining] some key concepts of analysis, such as the notion of limit, of semicontinuous envelope, the various notions of convergence, including some more recent and refined ideas.

• Indeed, your prediction was correct. This is exactly what I was trying to find. Thanks a lot for posting it (years ago though it may be)! Commented Apr 22, 2020 at 4:21

I don't know if this answers your question , but you might get some inspiration from the following article from The Harvard College Mathematical Review: http://www.thehcmr.org/issue1_1/thanos.pdf

He basically talks about the derivative as a functor. A problem (as I see it) with trying to categorifying some parts of analysis is that category theory seems to be very good where we have lots of structure and global properties, but analysis doesn't always concern itself about these situations. A lot of analysis is more about local properties and randomness. Terence Tao has written about something on the dichotomy between structure and randomness which might be of value : http://www.math.ucla.edu/~tao/preprints/Slides/icmslides2.pdf

• Not that I disagree in general with your post, but specifically with regards to local properties, this is exactly what sheaves were invented for. There's an entire school of algebraic analysis that deals which uses heavy duty sheaf theory and homological algebra.
– ಠ_ಠ
Commented Apr 15, 2017 at 2:44
• The first link is now math.harvard.edu/hcmr/issues/1.pdf, p. 77. Commented May 11, 2018 at 13:54
• The first link is now abel.math.harvard.edu/hcmr/issues/1.pdf, p. 77. Commented Jan 19, 2021 at 21:14

For other ways of involving two functions in a derivative I'd take a look at Stieltjes derivatives. For instance;

Daniell, P. J.: Differentiation with respect to a function of limited variation. Trans. Amer. Math. Soc. 19 (1918), no. 4, 353–362.