How to find $f(x)$ and $g(x)$ when only given $f(g(x))$ I've learned how to find $f(g(x))$ when given the two $f(x)$ and $g(x)$ functions fairly easily, but I haven't found anywhere online showing how to do the opposite. For this question I'm working on I'm asked to find $f(x)$ and $g(x)$ if $\cos^2(x) = f(g(x))$. 
Can anyone please help me figure out how to solve this? Also if someone could provide a website that helps explain this that would be greatly appreciated.
 A: This isn't possible to do uniquely, since for example
$$
f\left(x\right)=x
$$
and
$$
g\left(x\right)=\cos^{2}x
$$
gives you the desired result. However, I think the answer they are looking for is
$$
f\left(x\right)=x^{2}
$$
and
$$
g\left(x\right)=\cos x
$$
so that
$$
f\left(g\left(x\right)\right)=\left(\cos x\right)^{2}\equiv\cos^{2}x.
$$
Sounds like you have yourself a bad teacher/textbook.
A: In general, you'd never be able to tell. However, there are 'more correct' answers than others. For example, you have the example 
$$
f(g(x))=\cos^2(x)
$$
Notice that this is the same as
$$
f(g(x))=\left(\cos x\right)^2
$$
So it would 'make sense' to choose $g(x)=\cos x$ and choose $f(x)=x^2$. However, There are more possible choices. For instance, choosing $g(x)=\sqrt{\cos x}$ and $f(x)=x^4$ would have also worked. 
Furthermore, take the example of 
$$
f(g(x))=x
$$
was $g(x)=2x$ and $f(x)=\frac{1}{2}x$? Or perhaps, $g(x)=\sqrt{x}$ and $f(x)=x^2$. Notice that one can uniquely determine the functions but there are smart and easy choices. It's just about choosing them 'wisely'. 
