How do I find $f(x)$ when provided $g(x)$ and $(f\circ g)(x)$? Let $g(x) = 2x^2−2x−1$. 
Find a function $f$ such that $(f\circ g)(x) = −8x^6 + 24x^5 −8x^4 − 24x^3 + 6x^2 + 10x + 6.$
$f(x) =$
 A: Let's suppose that $f(x)=Ax^3+Bx^2+Cx+D$.  
Because $2^3=8$, we can see that $A=-1$.  
So let's substract $-(2x^2-2x-1)^3=-8x^6+24x^5-12x^4-16x^3+6x^2+6x+1$ from $−8x^6 + 24x^5 −8x^4 − 24x^3 + 6x^2 + 10x + 6$.  The result is $4x^4-8x^3+4x+5$.  
$2^2=4$, so $B=1$. Now substract $(2x^2-2x-1)^2$ from $4x^4-8x^3+4x+5$. The result is $4$. So $C=0$ and $D=4$.
So the function you are looking for is: $$f(x)=-x^3+x^2+4$$
A: Denote the given polynomial by $h(x)$. Then we want $f\circ g=h$. Proceeding heuristically this amounts to $f=h\circ g^{-1}$. Solving $g(x)=2x^2-2x-1=y$ for $y$ has of course two solutions
$$x={1\pm\sqrt{2y+3}\over2}\quad\bigl(=g^{-1}(y)\ ?\bigr)\ .$$
For the moment we compute
$$h\left({1+u\over2}\right)={77 - 39 u^2 + 11 u^4 - u^6\over8}\ ,$$
which is fortunately an even function of $u$. This suggests that we try
$$f(y):={77 - 39 u^2 + 11 u^4 - u^6\over8}\biggr|_{u:=\sqrt{2y+3}}=4+y^2-y^3\ .$$
So far everything has been heuristic. We now have to test whether indeed $f\bigl(g(x)\bigr)\equiv h(x)$. The test shows that everything is o.k.
