# Maths problem: if f(f(x)) = some given g(x), what is f(x) ?

**URL:** <https://boards.straightdope.com/t/maths-problem-if-f-f-x-some-given-g-x-what-is-f-x/278648>\
**Category:** Factual Questions\
**Created:** [December 8, 2004, 12:03am UTC](https://boards.straightdope.com/t/maths-problem-if-f-f-x-some-given-g-x-what-is-f-x/278648 "2004-12-08T00:03:08Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![Splanky](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Splanky](https://boards.straightdope.com/u/Splanky)\
**Post date:** [December 8, 2004, 3:06am UTC](https://boards.straightdope.com/t/maths-problem-if-f-f-x-some-given-g-x-what-is-f-x/278648/21 "2004-12-08T03:06:38Z")

</div>

After some algebra, I worked out that there are 6 possible polynomials for which

f(f(x)) = g(x) is true

f(x) = ±x^2 -2x +c

c can be any 3 of the solutions to to c^3 -8c^2 + c - 2 = 0  
(All three solutions to this polynomial are real)

Then again, that’s only polynomials. Lord knows how to show that there are/aren’t non-polynomial solutions.

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [December 8, 2004, 3:10am UTC](https://boards.straightdope.com/t/maths-problem-if-f-f-x-some-given-g-x-what-is-f-x/278648/22 "2004-12-08T03:10:27Z")

</div>

A little more searching turned up [this page](http://reglos.de/lars/ffx.html), which has a whole lot of references on the topic.

---

<div class="post-metadata">

**Author:** ![Splanky](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Splanky](https://boards.straightdope.com/u/Splanky)\
**Post date:** [December 8, 2004, 3:12am UTC](https://boards.straightdope.com/t/maths-problem-if-f-f-x-some-given-g-x-what-is-f-x/278648/23 "2004-12-08T03:12:39Z")

</div>

Actually, I’m tired, and I’ve lost track of my work. I thought my polynomial had three distinct zeros, but I just checked and the one in my previous post doesn’t (only one real zero). Unless I’m making another mistake there are only 2 polynomials for f(x).

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [December 8, 2004, 3:17am UTC](https://boards.straightdope.com/t/maths-problem-if-f-f-x-some-given-g-x-what-is-f-x/278648/24 "2004-12-08T03:17:34Z")

</div>

Depends. Are we working in **R** [symbol]®[/symbol] **R** or **C** [symbol]®[/symbol] **C**?

---

<div class="post-metadata">

**Author:** ![Splanky](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Splanky](https://boards.straightdope.com/u/Splanky)\
**Post date:** [December 8, 2004, 3:24am UTC](https://boards.straightdope.com/t/maths-problem-if-f-f-x-some-given-g-x-what-is-f-x/278648/25 "2004-12-08T03:24:32Z")

</div>

Well I’m assuming we’re not dealing with complex solutions.

Anyway, I looked over my work and I think I caught my mistake. (Maybe someone could check my work for me).

If you take MikeS’s work and set the coefficients of the two polynomials equal to each other, you get this system:

a^2 = 1  
2\*a^2 \* b = -4  
a(2ac +b^2 +b) = 8  
c(b + ac +1) =2

I get that b = -2 (always)  
a = -1 or 1  
-c^3 +16c^2 - c = 2  
^This is the right polynomial, I think. It DOES have 3 real solutions.

---

<div class="post-metadata">

**Author:** ![nivlac](https://avatars.discourse-cdn.com/v4/letter/n/3bc359/32.png) [@nivlac](https://boards.straightdope.com/u/nivlac)\
**Post date:** [December 8, 2004, 4:28am UTC](https://boards.straightdope.com/t/maths-problem-if-f-f-x-some-given-g-x-what-is-f-x/278648/26 "2004-12-08T04:28:49Z")

</div>

f(x) = x[sup]2[/sup] - 2x -1 works. Just a little intelligent trial and error. Don’t believe there’s a general solution approach.

[Previous page](https://boards.straightdope.com/t/maths-problem-if-f-f-x-some-given-g-x-what-is-f-x/278648.md?page=1)
