Given a function such as $$\tan x$$, could you write $$\frac{d}{dx} \arctan x$$ and $$\int \arctan x \; dx$$, just from $$\tan x$$, $$\frac{d}{dx} \tan x$$ and $$\int \tan x \; dx$$? With some caveats, the inverse function theorem answers the former while the Legendre transformation answers the later.

I’ve writtten an updated / clearer version of this article in pdf. However, the web page is slightly more technical in presentation.

## Derivatives of inverse functions and the inverse function theorem

Given a continuously differentiable function $$f: \mathbb{R} \to \mathbb{R}$$ with $$f'(a) \neq 0$$ at some point, the inverse function theorem states that there is some interval $$I$$ with $$a \in I$$ such that there exists a continuously differentiable inverse $$f^{-1}$$ defined on $$f(I)$$ such that

$\frac{d}{dx}f^{-1}(x) = \frac{1}{f'(f^{-1}(x))} \; \forall x \in I$

The standard way to deduce the above formula would be to differentiate both sides of $$f^{-1}(f(x)) = x$$. A simple example of this would be that the derivative of $$\ln x$$ is $$1/e^{\ln x} = 1/x$$.

Geometrically, given some function $$f(x) = y$$ the inverse is just taking the plot of the function and reflecting it about the diagonal line $$y=x$$. As such all tangent lines are also reflected along the diagonal line and hence the slope is inversed. Below we have the graph of $$e^x$$ (the blue line) and the graph of $$\ln x$$ (the red line). And you can see how the tangent line of $$e^x$$ at $$(2,e^2)$$ is reflected along $$y=x$$ to give the tangent line of $$\ln x$$ at $$(e^2, 2)$$.

Another way of looking at it would be to subjugate $$S=\{(x, f(x)) \, \vert \, x \in I\}$$, the plot of $$f(x)$$, with a graph transformation $$\phi:(x,y) \to (\hat{x}, \hat{y}) = (y,x)$$ and express $$\phi(S)$$ as a plot $$(\hat{x}, \hat{y}(\hat{x}))$$. This way $$\hat{y}$$ would be in effect the inverse of $$y$$. We then wish to understand how $$\phi$$ acts on $$\frac{dy}{dx}$$ to give $$\frac{d\hat{y}}{d\hat{x}}$$.

We could then directly calculate

\begin{align*} \frac{d\hat{y}}{d\hat{x}}\vert_{\hat{x} = y(x)} &= \frac{d\hat{y}}{dx} / \frac{d\hat{x}}{dx} & \text{(Chain rule)} \\ &= 1 / \frac{dy}{dx} \end{align*}

The above is equivalent to taking the derivative of both sides of $$f^{-1}(f(x))= x$$. However, this method is not only less ad hoc, but also generalises to other maps $$\phi: \mathbb{R}^2 \to \mathbb{R}^2$$ (e.g. $$\phi:(r, \theta) \to (r \cos \theta, r \sin \theta)$$) . These ideas are explored much more deeply in Hydon’s book on Symmetry Methods for Differential Equations.

By calculating $$\frac{d}{dx} \tan x = \sec^2 x$$, we now know that $$\frac{d}{dx} \arctan x = \frac{1}{\text{sec}^2(\arctan x)} = \frac{1}{1+x^2}$$. So what about $$\int \arctan x \, dx$$? We shall do so without much rigour.

## Integrals of inverse functions and the Legendre transformation

Geometrically, we could show that with $$f$$ strictly monotone, we have

$\int_{c}^d f^{-1}(y) \, dy + \int^{b}_a f(x) \, dx = bd-ac$

This is a result by Laisant in 1905. Here’s a proof-without-words.

By Jonathan Steinbuch - Own work, CC BY-SA 3.0, Link

To find an explicit formula for $$\int f^{-1}(y)$$, we could do the following. Suppose we’re interested in finding $$\int \arctan x \, dx$$. Notationally, it is the easiest to let $$y = \int \tan x \, dx$$ up to some constant such that $$\frac{dy}{dx} = \tan x$$ is the function we want to invert. Let $$S$$ be the plot of $$\frac{dy}{dx}$$, i.e. $$\{(x, \frac{dy}{dx}) \vert \, x \in I\}$$ for some appropiate interval $$I$$. Applying the map $$\phi: (x,y) \to (\hat{x}, \hat{y}) = (y,x)$$, we assume the existence of some $$\hat{y}$$ such that its derivative is the plot of $$\phi(S)$$. Now $$\hat{y} = \int \arctan \hat{x} \, d\hat{x}$$ which is what we seek.

For the sake of clarity we write $$\frac{dy}{dx}\vert_{\hat{x} = u}$$ as $$y'(u)$$ and $$\frac{d\hat{y}}{d\hat{x}}\vert_{\hat{x} = u}$$ as $$\hat{y}'(u)$$. So

\begin{align*} \hat{y} &= \int \hat{y}'(\hat{x}) d\hat{x} \\ &= \hat{x} \times \hat{y}' - \int \hat{x} \times \hat{y}'(\hat{x}) d\hat{x} & (\text{by parts}) \\ &= \hat{x} \times \hat{y}' - \int \hat{x}(x) \times \hat{y}'(\hat{x}(x)) \times \hat{x}'(x) dx & (\text{sub }\hat{x} = y'(x))\\ &= \hat{x} \times \hat{y}' - \int \hat{x}(x) \times \big[\frac{d}{dx}\hat{y}'\big] dx \\ &= \hat{x} \times \hat{y}' - \int \hat{x}(x) dx & (\hat{y}'(\hat{x}(x)) = x) \\ &= \hat{x} \times \hat{y}' - \int y'(x) dx & (\text{by def of } \hat{x})\\ &= \hat{x} \times \hat{y}'(\hat{x}) - y(x) + C \\ &= \hat{x} \times \hat{y}'(\hat{x}) - y(\hat{y}'(\hat{x})) + C & (\text{by def of } \hat{x}) \end{align*}

As an example, if we let $$y(x) = e^x$$ then $$y'(x) = e^x$$, $$\hat{y}'(\hat{x}) = \ln (\hat{x})$$ and so repeating what we’ve done above,

We have

\begin{align*} \hat{y} &= \int \ln \hat{x} \, d\hat{x} \\ &= \hat{x} \times \ln(\hat{x}) - \int \hat{x} \times (\ln \hat{x}) d\hat{x}\\ &= \hat{x} \times \ln(\hat{x}) - \int e^x \times \ln(e^x) \times e^x dx \\ &= \hat{x} \times \ln(\hat{x}) - \int e^x \times \frac{d}{dx} (\ln(e^x)) dx \\ &= \hat{x} \times \ln(\hat{x}) - \int e^x dx \\ &= \hat{x} \times \ln(\hat{x}) - e^x + C \\ &= \hat{x} \times \ln(\hat{x}) - e^{\ln (\hat{x})} + C \\ &= \hat{x} \times \ln(\hat{x}) - \hat{x} + C \\ \end{align*}

Finally, just by using the formula $$\hat{y} = \hat{x} \times \hat{y}'(\hat{x}) - y(\hat{y}'(\hat{x})) + C$$, if we let $$y = - \ln \vert \cos(x) \vert$$, then we have $$y' = \tan(x)$$ and $$\hat{y}' = \arctan(x)$$ so

\begin{align*} \int \arctan \hat{x} &= \hat{x} \arctan \hat{x} - \ln \vert \cos(\arctan(\hat{x}))\vert + C\\ &= \hat{x} \arctan \hat{x} - \frac{1}{2} \ln \big( \frac{1}{1+\hat{x}^2}\big) + C \end{align*}

as expected.

The map $$y(x) \to \hat{y}(\hat{x}) := \hat{x} \hat{y}'(\hat{x}) - y(\hat{y}'(\hat{x}))$$ is called the Legendre transformation, which has wide applications in areas of physics. But mathematically, one could think of it as an analogue to the inverse function theorem: It tells you how the inverse map acts on integrals. Much of this section is inspired from a wikipedia article on integrals of inverse functions.

## Summary

with the following relations

\begin{align*} \text{IFT:} \quad & g'(y) = \frac{1}{f'(g(y))} \\ \text{Legendre:} \quad & G(y) = y\times g(y) - F(g(y)) + C \end{align*}