# Maple: how to solving composite function

Here is just an simple example that I want to use Maple to solve: $$h(x)=f(g(x))$$ $$g(x)=2x+1$$ $$h(x)=4x^2+4x+7$$

Find polynomial of $f(x)$

Thanks :)

-

The desire function is the last output as you see. Thanks.

-
Can you explain a bit at line 3 and 4,please. I know how they work, but I really don't understand why it works right. I'm thinking about your nice solution so much. Thanks :) – hqt May 28 '12 at 7:48
@Ilya: Thanks for your consideration, but I think we want the function $f(x)$ in that the composition of $f$ and $g$ becomes $h$. – Babak S. May 28 '12 at 7:49
@hqt: In this problem we should to go the inverse path you walked before for getting $h(x)$. So in line 3, I wanted to get $x$ from $g$ and that is why I named it with $t$ and solve it. In line 4 the reverse path I noted above was completed by using subs(...) command. – Babak S. May 28 '12 at 8:04
Perhaps it might be helpful to explain the commands a bit, like does "solve (g(x)=t,x)" always calculate the inverse of the fuction or what does "subs" do. – Gigili May 28 '12 at 8:31
+1 $\quad \ddot\smile\quad$ – amWhy Mar 5 '13 at 0:20

For fun,

> h:=x->4*x^2+4*x+7:
> g:=x->2*x+1:

> rsolve( f(g(x)) = h(x), f(x) );

2
x  + 6

-
No. I don't think it's just for fun. it's nice. but I don't know your solution compare to first one (above post) will be same performance or not :) – hqt May 28 '12 at 17:27