3
$\begingroup$

I have the equation

f[f[x]] == 28 + 9 x

How can I solve this for f[x]? I note that this post relates to the topic, but Wolfram|Alpha doesn't work for my equation. So is there a method that can do it?

$\endgroup$
2
  • 1
    $\begingroup$ Try WolframAlpha["f[f[x]]==28+9*x solve for x"] $\endgroup$
    – user9660
    Commented Jun 20, 2016 at 8:16
  • $\begingroup$ @Louis I want to get f[x] but x. :) $\endgroup$
    – yode
    Commented Jun 20, 2016 at 8:39

4 Answers 4

8
$\begingroup$

As the link you provided in your question shows, there is no unique solution. For example (and illustration), assuming a form (linear function) yields 2 solutions:

lhs = CoefficientRules[Nest[a # + b &, x, 2], x]
rhs = CoefficientRules[28 + 9 x, x]
{f1, f2} = 
 a # + b & /. 
  Solve[{({1} /. lhs) == ({1} /. rhs), ({0} /. lhs) == ({0} /. rhs)}, {a, b}]

yields:

{-3 #1 - 14 &, 3 #1 + 7 &}

Testing:

Simplify[Nest[f1, x, 2]]
Simplify[Nest[f2, x, 2]]

Both yield

28 + 9 x

$\endgroup$
2
  • $\begingroup$ good solution.. $\endgroup$
    – yode
    Commented Jun 20, 2016 at 9:42
  • $\begingroup$ SolveAlways or Solve with ForAll could be used to avoid having to split the equation into one for each coefficient. $\endgroup$
    – obsolesced
    Commented Jul 25, 2016 at 4:49
5
$\begingroup$

It is interesting to see if there are some slightly more general solutions. For example, by assuming that the function has a fixed point for some unknown value c we can do a series expansion to various orders:

f[f[x]] == 28 + 9 x
Series[%, {x, c, 6}]
% //. f[c] -> c
LogicalExpand[%]
Reduce[%]
FullSimplify[%]
Solve[%]

which gives

$\left\{\left\{c\to -\frac{7}{2},f'\left(-\frac{7}{2}\right)\to -3,f''\left(-\frac{7}{2}\right)\to 0,f^{(3)}\left(-\frac{7}{2}\right)\to 0,f^{(4)}\left(-\frac{7}{2}\right)\to 0,f^{(5)}\left(-\frac{7}{2}\right)\to 0,f^{(6)}\left(-\frac{7}{2}\right)\to 0\right\},\left\{c\to -\frac{7}{2},f'\left(-\frac{7}{2}\right)\to 3,f''\left(-\frac{7}{2}\right)\to 0,f^{(3)}\left(-\frac{7}{2}\right)\to 0,f^{(4)}\left(-\frac{7}{2}\right)\to 0,f^{(5)}\left(-\frac{7}{2}\right)\to 0,f^{(6)}\left(-\frac{7}{2}\right)\to 0\right\}\right\}$

This obviously supports the idea that the only analytic functions with a fixed point satisfying the equation are linear.

$\endgroup$
4
  • 1
    $\begingroup$ I think the restriction to functions with fixed points can be relaxed by taking the series of f[f[f[x]]]: 28 + 9f[x] == f[28+9x] about x=-7/2. $\endgroup$
    – obsolesced
    Commented Jul 24, 2016 at 18:01
  • $\begingroup$ That's an interesting point. You show that there aren't any other analytic solutions $\endgroup$
    – mikado
    Commented Jul 24, 2016 at 18:59
  • $\begingroup$ A harder problem is if there are non-analytic solutions, and how to construct one. I believe there are piecewise solutions from the 2 possible analytic functions f1 and f2, but it's not trivial. My idea was to start with the infinite sequence from forward and backward recursion over f1 from some point other than x=-7/2, then repeat from all x from which this sequence can be reached by f2(x) etc. I think the set of points from these sequences is countable, so let f be f1 if x is from this set and f2 otherwise. Is there a simpler answer? I hesitate to post as this is more math than Mathematica. $\endgroup$
    – obsolesced
    Commented Jul 25, 2016 at 4:41
  • $\begingroup$ @obsolesced I'd be interested to see it. If you can give a procedure for generating such a sequence in Mathematica it would be a reasonable post. $\endgroup$
    – mikado
    Commented Jul 25, 2016 at 5:14
3
$\begingroup$

Here's my attempt to construct a non-analytic solution. The idea is to use one of the analytic solutions in the accepted answer when x belongs to a set of points reachable through successive application of either analytic solution or their inverses, and the other solution otherwise. This set must not be equal the set of reals, otherwise the solution just reduces to one of the analytic solutions. I thought of a way to show this set is countable, and therefore can't be equal the real set, but realized it's easier to show by counterexample after finding the set.

I start with a couple of observations to facilitate finding this set. The first is the convenient commutativity of f1 and f2:

Simplify[f1[f2[x]] == f2[f1[x]]]

which means any sequence of f1 and f2 is equivalent to one with the same total number n1 and n2 of f1 and f2 calls respectively, e.g. n1 f1 calls followed by n2 f2 calls. This commutativity also implies the inverses are commutative, and sequences of InverseFunction[f1] and InverseFunction[f2] can be similarly ordered.

The second is the nth application of f1 or f2 is the sum of a constant term, which is a geometric series of length n, and a linear term, which is the nth term in another geometric series. These terms can be computed by hand, but Mathematica gives a convenient way to do so:

s1[x_]=FindSequenceFunction[NestList[f1,x,3]];
s2[x_]=FindSequenceFunction[NestList[f2,x,3]];

It can be shown the nth application of InverseFunction[f1] or InverseFunction[f2] to x is equal s1[x][-n] or s2[x][-n] respectively.

With these results, the set of points that can be reached from x0 satisfies:

criteria = Simplify[Reduce[{s2[s1[x][n1]][n2] == x0}, {n1, n2}], 
                    Assumptions -> {{n1, n2} \[Element] Integers, {x, x0} \[Element] Reals}]

$$ \left(x=-\frac{7}{2}\land \text{x0}=-\frac{7}{2}\right)\lor \left(c_1\in \mathbb{Z}\land 2 x+7\neq 0\land 2 \text{x0}+7\neq 0\land \\ \log (3) (\text{n1}+\text{n2})-2 i \pi c_1=\log \left(-\frac{9 (-1)^{\text{n1}} (2 \text{x0}+7)}{2 x+7}\right)\right) $$

Unless x0 is the fixed point -7/2, we can reach x if there are integers n1 and n2 satisfying this equation.

Here, the only imaginary terms are $2i\pi c_1$ and from the log on the right-hand side. Since x and x0 are real, the imaginary part of the log can only be 0 or $i\pi$. The former requires $c_1=0$, while the latter cannot be satisfied for any $c_1\in \mathbb{Z}$. We can therefore set $c_1=0$.

Moreover, given x and x0, there are only two possibilities for the log, one with n1 even, and one with n1 odd. Regardless of whether n1 is even or odd, n2 is arbitrary, so n1+n2 need only be integral and can be either even or odd:

condition[x_,x0_]=And @@ Reverse @ (Or @@ (n\[Element]Integers/.Simplify[
          Solve[criteria/.n1+n2->n,n][[1]],Assumptions->{x,x0}\[Element]Reals]/.C[1]->0/.#& 
          /@ {n1->1,n1->2}))

$$ x\neq -\frac{7}{2}\land \text{x0}\neq -\frac{7}{2}\land \left(\frac{\log \left(-\frac{9 (2 \text{x0}+7)}{2 x+7}\right)}{\log (3)}\in \mathbb{Z}\lor \frac{\log \left(\frac{9 (2 \text{x0}+7)}{2 x+7}\right)}{\log (3)}\in \mathbb{Z}\right) $$

This condition is sufficient to show the set of points that can be reached is not the real set, e.g. condition[1,0] returns False, showing x=1 cannot be reached from x0=0.

With this condition, we construct a non-analytic solution, as f1[x] for x satisfying the condition, and f2[x] otherwise:

f[x_, x0_] = Piecewise[{{f1[x], condition[x, x0]}}, f2[x]];

Testing:

ff=FullSimplify[f[f[x,x0],x0],Assumptions->{x,x0}\[Element]Reals]

unfortunately gives a long condition for 28+9x I have to simplify by brute force:

(ff[[1,1,2]]/.Log[x_]:>Log[Factor[x]]//PowerExpand//ExpandAll//FullSimplify)/.
(Log[x_]-Log[y_]:>Log[x/y])/.I \[Pi]+Log[x_]->Log[-x]/.
{x_\[Element]Integers->integerQ[x],x_\[NotElement]Integers:>!integerQ[x]}//FullSimplify

True

$\endgroup$
1
  • $\begingroup$ I stuck to reals but on hindsight think it's unnecessary. Allowing complex x might just amount to 2 criteria, 1 for n and another for $c_1$. I have to check with the real assumptions removed though. $\endgroup$
    – obsolesced
    Commented Jul 25, 2016 at 15:55
1
$\begingroup$

Inspired by @obsolesced, it is simple to find solutions based on any set that is mapped to itself by f1 and f2. For example, let

S = {q1 + q2 Sqrt[2]}  for {q1, q2} rational

then

f[x] = f1[x]   x in S
f[x] = f2[x]   x not in S

satisfies the required functional relation. It is continuous nowhere (except x = -7/2) and S is countably infinite and its complement uncountably infinite.

Alternatively, make S the Algebraic numbers, then its complement is the Transcendentals - both uncountably infinite.

It would be interesting to know if there are any solutions to the functional equation with f[x] not in {f1[x],f2[x]}.

$\endgroup$
3
  • $\begingroup$ Nice insight, but S is countably infinite no? So much simpler than the minimal set I thought of. I now realize S could have even more simply been all integers or rationals, or even all reals if x is allowed to be complex etc.. $\endgroup$
    – obsolesced
    Commented Jul 26, 2016 at 1:30
  • $\begingroup$ @obsolesced quite right. I've fixed that and added a better example. $\endgroup$
    – mikado
    Commented Jul 26, 2016 at 20:03
  • $\begingroup$ Unfortunately algebraic numbers are still countable. I'm not sure if it's possible to find S with both S and its complement being uncountable, unless we allow complex x. If it is any consolation, both S and its complement can be dense if S is algebraics or rationals. $\endgroup$
    – obsolesced
    Commented Jul 27, 2016 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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