# Let $(f \circ g)(x) = x^2 +2x -1$. Find $f(x)$ if $g(x) = x+2$

Problem : Let $(f \circ g)(x) = x^2 +2x -1$. Find $f(x)$ if $g(x) = x+2$

My Attempted Solution

$$f(g(x)) = x^2 +2x-1$$ $$f(x+2) = x^2 +2x -1$$

But that is as far as I got. The problem I'm having is that I can't seem to find a way to algebraically relate $g(x)$ to $f(g(x))$ and solve for the unknown $f(x)$.

As a generalized extension to the above problem, furthermore if I have a composition of two aribtrary functions $f,g : \mathbb{R} \to \mathbb{R}$ with $g$, known and $f$ being an unknown function, what is the general algebraic method to solve for $f(x)$ if $f(g(x))$ is given. i.e.

$$\text{If}\ \ f(g(x)) = \alpha \ \ \text{and} \ \ g(x) = \zeta \ \$$ $$\text{How do you algebraically solve for } f(x)$$

• Hint: $x= (x+2)-2$ – John Joy Jun 4 '16 at 2:15

Hint: $x^2 + 2x - 1 = (x+2)^2 - 2(x+2) - 1$
• is there a more general way to solve this sort of problem? You've manipulated $x^2 + 2x-1$ into a form that is meaningful to $f(x+2)$, but it seems like you've done it in a sort of trial-and-error way (a heuristic way). If you hadn't spotted that possible manipulation /transformation (as I didn't), how would you have attempted to solve the problem? (Note: This is aimed at the second part of my question in the OP) – Perturbative Jun 3 '16 at 18:37
• @Perturbative Here the inside function $g$ is just a "shift". You can use a substitution as suggested by the other answerer; this will always work. More generally, if you have $h(x) = f(g(x))$ and you know $g(x)$ and $h(x)$, then, given that $g$ is a "nice" function (a bijection $\mathbb{R} \to \mathbb{R}$ so we have no domain issues), $f(x) = h(g^{-1}(x))$. As a worked example, take $f \circ g \ (x) = \exp(x)$ and $g(x) = x^3$. Then $f(x)= \exp(x^{\frac 13})$ – MathematicsStudent1122 Jun 3 '16 at 18:45
Replace $x \rightarrow x -2$ in $f(x+2) = x^2 +2x -1$
• More fundamentally: If $(f\circ g)(x)=h(x)$, then $f(x)=(f\circ g\circ g^{-1})(x)=(h\circ g^{-1})(x)$. – Semiclassical Jun 3 '16 at 18:44