# Can two functions have identical first and second derivatives, but different higher order derivatives?

Consider two functions $f(x)$ and $g(x)$ defined for all $x\in\mathbb{R}$. Assume that $\forall x\in\mathbb{R}$, $f(x)=g(x)$, $f'(x)=g'(x)$, and $f''(x)=g''(x)$. Is it possible that higher order derivatives of $f(x)$ and $g(x)$ are not equal?

• why did you include the assumption $f(x) = g(x)$? It sounds like you are interested in the case when $f(x) \neq g(x)$... Jul 22, 2011 at 23:27

Since the higher order derivatives are given simply by iteration of the "simple" derivative the answer is no. That is to say, if $f^{(n)}(x) = g^{(n)}(x)$ then $f^{(n+1)}(x) = \left( \, f^{(n)}(x)\right)' = \left(g^{(n)}(x)\right)' = g^{(n+1)}(x)$. Excuse the abuse of notation.

Unless I'm stupid, which I sometimes am :).

This is a little trickier than it seems, and while Tilo Wiklund's answer is actually correct, the reasoning is not quite correct. Here's why:

If we are on a finite interval, the higher order derivatives need not match between the two functions. Example: let f(x) ≡ 0 and let g(x) ≡ 0 for x ≤ 0 and g(x) = x2 for x >0. At x = 0 we have: f(0) = g(0) = 0; f'(0) = g'(0) = 0; and f''(0) = g''(0) = 0. However, things fall apart at f'''. We have f'''(0) = 0 and g'''(0) = 6.

So how does this fit with Wiklund's answer that that the higher order derivatives are computed from the lower order ones? Well, two functions can match on a finite interval, but not be the same for the entire real line.

Looking at the whole x-axis, if f'(x) ≡ g('x) everywhere, those two derivatives are identical and must have the same higher derivatives (if any). But note that the whole thing depends on equivalence on the entire x-axis. On a finite interval such as in the example above it wouldn't have worked. I think Wiklund's answer can be improved by noting specifically that it works only on the entire x-axis.

• If $f=g$ over the whole real line then by definition $f'=g'$ and so on. This is what the OP has written.
– Pedro
Aug 5, 2013 at 4:07
• We were assuming that the f = g was a mistake. If the two functions are identical there is no question. Aug 5, 2013 at 5:48
• There is no question if the derivatives are equal either.
– Pedro
Aug 5, 2013 at 5:49
• "Wiklund's reasoning could have been applied just as well to the interval [a,b] and it would have been wrong." This is not correct. The same reasoning would have yielded that if $f=g$ on $[a,b]$ then $f^{(n)}=g^{(n)}$ on $[a,b]$. There is nothing wrong with that.
– Pedro
Aug 5, 2013 at 5:53
• Again, I assumed the hypothesis f = g is a mistake and he meant only that first two derivatives were equal. If we assume that f = g then there is no problem -- of course all the derivatives are equal. I am pointing out that two functions on a closed interval [a,b] can have n derivatives equal, and still not be equal on the entire x-axis. So Wiklund is correct for the entire real line. But his reasoning is not correct for any closed subinterval. His answer would be better if he explains why it works on the entire real line, even though it doesn't work on closed subintervals. Aug 6, 2013 at 17:56