Some time ago, I solved (just for fun) $f'(x)=\cos(f(x))$ and asked myself what the solution to the title equation $f'(x)=f(\cos(x))$ is. I see that $f$ is periodic and odd, but not how to go on after that.

(Related question: Is there a general solution for $f'(x)=f(g(x))$ with given $g$?)

  • $\begingroup$ Somehow for $x\in(0,\pi)$ I am getting the solution $f=\exp x$ which doesn't make sense. But I can't find an error... $\endgroup$
    – mobiuseng
    Jan 28, 2018 at 21:11
  • $\begingroup$ $f(x) = 0$ is a solution. $\endgroup$ Jan 28, 2018 at 22:27
  • 2
    $\begingroup$ @mobiuseng You get $f = \exp x$ if you confuse $\frac{df(x)}{d\cos(x)}$ with $\frac{df(\cos(x))}{d\cos(x)}$, i.e. if you do the derivation by keeping the arguments of $f$ "hidden". $\endgroup$
    – Winther
    Jan 28, 2018 at 23:19
  • 1
    $\begingroup$ Also, $f$ does not need to be odd. Its derivative needs to be even. That means it could be an odd function plus a constant. $\endgroup$ Jan 29, 2018 at 1:08

3 Answers 3


Let $x_0\in(0,\pi)$ be the solution to $x_0 = \cos(x_0)\approx 0.739$. If we let $$ f(x) = \sum_{n=0}^\infty a_n(x-x_0)^n $$ and expand the differential equation in power series, we get $$ \sum_{n=0}^\infty (n+1)a_{n+1}(x-x_0)^n = \sum_{n=0}^\infty a_n(\cos(x)-x_0)^n = \sum_{n=0}^\infty a_n(x-x_0)^n\left[\frac{\cos(x)-\cos(x_0)}{x-x_0}\right]^n. $$ Now $([\cos(x)-\cos(x_0)]/[x-x_0])^n$ can itself be written as some power series $\sum_{m=0}^\infty b_{mn}(x-x_0)^m$. So we have $$ \sum_{n=0}^\infty (n+1)a_{n+1}(x-x_0)^n =\sum_{n=0}^\infty a_n(x-x_0)^n\left[\frac{\cos(x)-\cos(x_0)}{x-x_0}\right]^n \\= \sum_{n=0}^{\infty}\sum_{m=0}^\infty a_nb_{mn}(x-x_0)^{n+m}= \sum_{k=0}^\infty \left[\sum_{n=0}^ka_nb_{(k-n)n}\right](x-x_0)^k. $$ Swapping the dummy indices $k$ and $n$ then gives a recursion relation for the coefficients: $$ a_{n+1} = \frac{1}{n+1}\sum_{k=0}^n a_kb_{(n-k)k}. $$ Unfortunately I'm not aware of a nice expression for the $b_{mn}$. Calculating the first 30 terms numerically and taking advantage of symmetry gives me this for $f(x)$


and a comparison of $f'(x)$ (blue) with $f(\cos(x))$ (yellow)

f'(x) vs f(cos(x))

The series matches up well out until about $x_0 + 1.4$, and applying the root test to the coefficients suggests it has a finite radius of convergence of about $1.8$, so I think this is getting the right solution. This is consistent with a function that has a singularity at $i\pi/2$, so it's possible there's a global solution on $\mathbb R$ that this method can't quite catch. All other solutions are constant multiples of this one (which is $f(x_0) = 1$).

EDIT: Actually, since this method does give $f(x)$ for $x\in [-1,1]$, we have $f(\cos(x))$ for all $x\in \mathbb R$. We should be able to get the function on the rest of $\mathbb R$ by just integrating $f(\cos(x))$. This gives a function of the form $f(x) = f(0) + f(0)x + g(x)$, where $g(x)$ is some oscillatory function with period $2\pi$ and average value $0$ that looks sort of like $\sin(x)$. Not sure how much better we can do analytically.

  • $\begingroup$ @YuriyS By the initial conditions, presumably. This is a differential equation, after all. $\endgroup$ Jan 29, 2018 at 8:19
  • $\begingroup$ @YuriyS I chose $f(x_0) = 1$, as mentioned under the plots. $\endgroup$ Jan 29, 2018 at 10:13
  • $\begingroup$ I apologise, I missed this $\endgroup$
    – Yuriy S
    Jan 29, 2018 at 10:15

I am getting an absurd answer, obviously doing something wrong, but can't see where. So, here is my (wrong) solution for the record and to find the error.

Let $x\in(0,\pi)$ and $z = \cos x$, $dz/dx = -\sin x$ and $x = \arccos z$.

$$ \frac{df}{dx} = \frac{df}{dz}\frac{dz}{dx} = -\sin x\frac{df}{dz} $$


$$ -\sin x \frac{df}{dz} = -\sin(\arccos z)\frac{df}{dz}=-\sqrt{1-z^2}\frac{df}{dz} $$

From here:

$$ \frac{df}{dz} = -\frac{1}{\sqrt{1-z^2}}f(z) $$

$$ \frac{df}{f} = -\frac{dz}{\sqrt{1-z^2}}\quad\Rightarrow\quad \ln f=\arccos z $$

$$ f = \exp\left(\arccos z\right)=\exp x $$

So, $z$ and $x$ have one-to-one correspondence for $x\in(0,\pi)$. $z^2<1$, so I've not divided by zero. $f$ can be zero --- by dividing by it I probably lost some solution, but it shouldn't have led to such absurdity...

  • 3
    $\begingroup$ The problem is that your $df/dz$ is evaluated at $\cos^{-1}(z)$, not $z$. $\endgroup$ Jan 28, 2018 at 22:00
  • $\begingroup$ @eyeballfrog Ah, now I see it! Then, of course I was getting $df/dx|_{\cos x} = f(\cos x)$ and $f(x) = \exp x$ would be the right answer for this problem. Thanks! $\endgroup$
    – mobiuseng
    Jan 29, 2018 at 6:45

Too long for a comment.

Observe that $f'(x+2\pi n)=f'(x)$ for all $n\in\mathbb Z$, so $f(x+2\pi n)=f(x)+n\varepsilon$ for some constant $\varepsilon$ (which we assume nonzero). If you let $f(x)=(\varepsilon/2\pi)(1+x+g(x))$, then this implies $g(x+2\pi n)=g(x)$, i.e. $2\pi$ periodicity. If we assume that $g$ is bounded, then we obtain the result $$ f(x)\sim \varepsilon x/2\pi,\qquad |x|\to\infty, $$ provided $\varepsilon\neq 0$. Here, the lower order term $g$ solves the equation $$ g'(x)=\cos(x)+g(\cos(x)). $$ The other case $\varepsilon=0$ is the $2\pi$-periodicity of $f(x)$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .