Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am looking for differentiable functions $f$ from the unit interval to itself that satisfy the following equation $\forall\:p \in \left( 0,1 \right)$:


Is there a way to use Mathematica to solve such equations?
DSolve is of course unable to handle this -- unless there are tricks I don't know about.

share|improve this question
Can you assume that an inverse exists on that interval? Might be able to use the inverse function theorem, though the changes of variables escaped me. –  jlperla Oct 7 '13 at 21:34
jlperla: I would prefer not to assume an inverse exists, but will be still be glad to find one or more solutions under that, or any other reasonable assumption. –  WillO Oct 7 '13 at 22:44
If you define $g(p) = f\bigl(f(p)\bigr)$, the equation becomes $1 - p - g(p) - f(p)g'(p)/f'(p) = 0$, but I don't know if you can get anywhere from here. –  Rahul Narain Oct 8 '13 at 2:28
@RahulNarain: Yes, I was ahead of you on this --- and if you multiply through by $f'(p)$, you get the derivative of $(fg)$ showing up there --- but I didn't manage to make much use of it. –  WillO Oct 8 '13 at 2:56
@Wizard: I did in fact ask a version of this question on MSE, but this (it seems to me) is a genuinely different question, i.e. "Does Mathematica have any built-in packages that are equipped to solve such equations?". That, I think, is a question about Mathematica and not about mathematics. No? –  WillO Oct 8 '13 at 15:25
show 3 more comments

2 Answers

At least you can eliminate $p$:

continue[{exprs__}, f_] :=
  , Rule | RuleDelayed, # /. f &
  , _, f]@Last@#]& @ {exprs}

toRHS[term_][lhs_ == rhs_] := lhs - term == rhs + term
multiplyBothSidesBy[x_]@e_Equal := # x & /@ e
privateDRule = f_'[x_] :> d[f@x]/d[x];
integrateLocally = u_ d[v_] :> d[u v] - v d[u];
integrateGlobally = u_ d[v_] + v_ d[u_] :> d[u v];
outMinus = d[-x_] :> -d[x];

Check the result:

Column[#, Spacings -> 1]& @
Fold[continue, {1 - p - f[f[p]] - f[p] f'[f[p]] == 0}, {
  f[p] -> u,
  toRHS[1 - p],
  privateDRule, Expand,
  MapAt[# /. integrateLocally &, #, 1] &,
  Composition[Simplify, multiplyBothSidesBy[(d@u)^-1]],
  p -> InverseFunction[f][u]}] // TraditionalForm

$f^{(-1)}(u)=1 + \frac{d(u f(u))}{du}$

I give this “answer” primarily because I rarely see people using Mathematica this way — and your nasty nested (no pun intended) expression allows a clear demonstration of this use of Mma. The language is good for explaining the (possibly incomplete) idea, and for immediate check if the idea works, in the same time.

share|improve this answer
add comment

To answer the question of: does mathematica have facilities for this sort of thing. I think there may be 2 parts: 1) Does mathematica have facilities for general function equations (forgetting even the differential)? I think the answer is no in general. There are certain (recurrence) equations it can solve with RSolve, but the function is mostly intended for difference equations. Regardless, it doesn't seem that RSolve is intended to solve coupled recurrence and differential equations (which I think are called delay-differential equations).

2) If I transform you ODE into something more standard, I think the best you could do is invert pieces of the function and then use the inverse function theorem to transform derviatives between/from the inverse (with a smart set of changes of variables).

But... based on the structure of the problem, my guess is that the best you could possibly transform it into is a delay differential equation as you would end up with an $f^{-1}(p-1)$ after the first inversion. Mathematica has facilities for delay-differential equations, but I think they are only numerical. http://www.wolfram.com/products/mathematica/newin7/content/DelayDifferentialEquations/

share|improve this answer
But, there's a big but...t, Mathematica can solve functional equations :) –  Sektor Oct 8 '13 at 17:11
Great! Can it solve general functional equations or just in certain examples? How would I solve the canonical: $f[x + y] == f[x] f[y]$ (where one solution is $f[x]:= e^{c x}$ of course, for any c) –  jlperla Oct 8 '13 at 17:26
Look up RSolve under Basic Examples –  Sektor Oct 8 '13 at 17:29
I thought RSolve only helped with recurrence equations (and mostly linear ones)? If so, I don't see how it can be used to solve $f(x + y) == f(x) f(y)$? But perhaps there is a way I don't see? Can you show the mathematica code? –  jlperla Oct 8 '13 at 17:33
See my change above to the answer above. Would love to see the solution to the above functional equation (which I don't think is a difference equation, but would really help me out if you could solve it). –  jlperla Oct 8 '13 at 17:41
show 1 more comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.