# Can every function be written as a total derivative?

This is motivated by a question in the Physics SE, but it's a math question not a physical one. For every function $G(x, t)$, can the function be written as a total derivative (wrt $t$) of some other function $F(x, t)$?

A simple counterexample would be fine; hopefully that would be simpler for a poor physicist to understand! A general proof/disproof would be great too.

If it would be easier to take a concrete example, if $G(x, t)$ is $x^2$ can this be written as a total derivative wrt $t$ of some function $F(x, t)$?

-
This is another ambiguous "any". The sentence in the subject line could reasonably be construed as "Is there any function that can be written as a total derivative?". But further context suggests it means "Is it the case that any function, no matter which one, can be written as a total derivative?". Merely changing "any" to "every" would disambiguate it. – Michael Hardy Mar 12 '12 at 19:13
Many thanks to everyone who answered. I think I have not stated the question precisely enough. I need to take your answers and go away and work out exactly what it it that I'm asking (typical physicist I suppose :-). Thanks again for the help. – John Rennie Mar 13 '12 at 6:49

No, not every function is the derivative of another function. Differentiability places a lot of constraints on functions. The one that jumps to mind is that all differentiable functions are the pointwise limits of continuous functions, which implies (by the Baire category theorem) that they must be continuous except on a meager set. For our purposes let's just say that meager means what it intuitively means. To construct a counterexample from this take whatever your favorite highly discontinuous function is and use that (mine is the indicator function of the rationals, which is nowhere continuous). I'll think about whether I can come up with a characterization for "nice" initial conditions.

-
Ah, having said it wasn't a physics question I suppose I have to admit that it is really, and restrict the question to the sort of functions you find in physics. So I guess they'd be smooth and continuous everywhere. – John Rennie Mar 12 '12 at 17:14
@John Rennie Ah alright, well I'll try to think of a reasonable interpretation to characterize. One thing though, I think you need to specify the dependence of $x$ on $t$ to be something nonconstant. Otherwise I think this question has a silly answer:$\frac{\partial F}{\partial t} = G(x,t)$ which is easy to solve by integrating for smooth $G$. I'm pretty bad at physics by the way, so bear with me if I come up with silly things :) – Chris Janjigian Mar 12 '12 at 17:21
Total derivative not partial derivative i.e. I need $\frac {\partial F}{\partial t} + \frac {\partial F}{\partial x} \frac{dx}{dt}$ to be equal to my $G(x, t)$ – John Rennie Mar 12 '12 at 17:25
@John Rennie Right, what I'm saying is if $\frac{dx}{dt} = 0$ then you get the silly answer, so there is a need to specify something about the dependence of $x$ on $t$. Maybe I misunderstood your question. Do you mean for any arbitrary smooth function $x$ of $t$ does the above hold? – Chris Janjigian Mar 12 '12 at 17:26
If that is the case and you are willing to make everything analytic (including the dependence of $x$ on $t$), then what you have written is a linear PDE with analytic coefficients and you can appeal to this theorem for existence of a locally analytic solution $F$: en.wikipedia.org/wiki/Cauchy%E2%80%93Kowalevski_theorem Conversely, if you are not willing to do so I think that you can rephrase this as a counterexample to your question: en.wikipedia.org/wiki/Lewy%27s_example I have to teach soon so I'll double check when I get back. – Chris Janjigian Mar 12 '12 at 17:34

Perhaps you can do the following thing: Based on your question and comments to Chris' answer it seems like you want to assume that $x = x(t)$ is a differentiable function of $t$. Then write $g(t) = G(x(t), t)$, a differentiable function of $t$. Define $$F(x,t) = \int_0^t g(s) ds$$ and then from the fundamental theorem of calculus and the fact that $F(x,t)$ does not depend on $x$ you get $$\frac{dF}{dt} = g(t) = G(x(t),t) = G(x,t)$$

-

This question needs interpretation: For functions $F,G$ of two variables and a function $x$ of one variable (this already has various interpretations that do not matter too much for this question; we just assume them to be smooth and the domains of definition to be $\mathbb{R}^2$ and $\mathbb{R}$ respectively) you would like to have $$\frac{\partial F}{\partial x}(x(t),t) x'(t) + \frac{\partial F}{\partial t}(x(t),t) = G(x(t),t)$$ for all $t$. $G$ is given and $F$ is to be found, but the big question is: is $x$ given or should the same $F$ work for all $x$?

In the first case it is easy to find an $F$; just let $F$ only depend on $t$ and integrate $G(x(t),t)$ (see treble's answer). The second case is more complicated, but it turns out such an $F$ only exists in the trivial case $\partial G/\partial x=0$, that is, $G$ does not depend on $x$.

-

Any reasonable function $G:\ (x,t)\mapsto G(x,t)$ is the derivative with respect to $t$ of another function $F:\ (x,t)\mapsto F(x,t)$. If $(x_0,t_0)$ is a point in the domain of $G$ there is a neighborhood $U$ of this point such that $$F(x,t):=\int_{t_0}^t G(x,t')\ dt'\qquad\bigl((x,t)\in U\bigr)$$ is such a function.

It is another matter if you are given, explicitly or via some extra condition like a differential equation $\dot x=H(x,t)$, a function $t\mapsto x(t)$, and you are really interested in the function $\phi(t):=G\bigl(x(t),t\bigr)$. This function $t\mapsto\phi(t)$ will then be the derivative of some function $t\mapsto\Phi(t)$ which will of course depend on this extra condition. But there is no such thing as a "total derivative" of a "naked" function $(x,t)\mapsto F(x,t)$ with respect to $t$.

-