Find $g(x)$ if $f(g(x))=f(x)g(x)$ and $g(2)$=37, $f(x)$ and $g(x)$ are polynomials Suppose $f(x)$ and $g(x)$ are non-zero polynomials with real coefficients, such that $f(g(x))=f(x)\times g(x)$. If $g(2)=37$, find $g(x)$.  

I tried plugging $f(x)$ and $g(x)$ as $n$ and $m$ degree general polynomials respectively, but it further complicated the question.

 A: We assume that $\mathrm{f}$ and $\mathrm{g}$ are two polynomials. Assume  that $\deg(\mathrm{f})=p$ and $\deg(\mathrm{g})=q$, where $\deg$ is the degree, i.e. the highest power of the variable, e.g. $\deg(1+2x+3x^2)=2$.
Let $\mathrm{f}\circ \mathrm{g}$ be the composite, defined by $(\mathrm{f}\circ \mathrm{g}) = \mathrm{f}(\mathrm{g}(x))$. 
Let $\mathrm{fg}$ be the product, defined by $(\mathrm{fg})(x) = \mathrm{f}(x) \cdot \mathrm{g}(x)$.
There are two key properties of the composite and the product, and they are:
$$\deg(\mathrm{f}\circ\mathrm{g}) = \deg(\mathrm{f}) \cdot \deg(\mathrm{g})$$
$$\deg(\mathrm{fg}) = \deg(\mathrm{f})+\deg(\mathrm{g})$$
You can verify this yourself with a few examples. It all comes from the fact that, since $p$ and $q$ are positive whole numbers, $(x^q)^p=x^{pq}$ and $x^p\cdot x^q = x^{p+q}$.
If $\mathrm{f}\circ \mathrm{g} = \mathrm{fg}$ then $\deg(\mathrm{f}\circ\mathrm{g}) = \deg(\mathrm{fg})$, and hence $pq=p+q$. A clever little trick gives:
\begin{eqnarray*}
pq&=&p+q \\ \\
pq-p-q&=&0 \\ \\
pq-p-q+1&=& 1 \\ \\
(p-1)(q-1) &=& 1
\end{eqnarray*}
Since both $p$ and $q$ are whole numbers, so too are $p-1$ and $q-1$. What are the ways for the product of two whole numbers? Well, $1\times 1 = 1$ and $(-1) \times (-1) = 1$. Hence, either $p-1=q-1=1$ or $p-1=q-1=-1$, i.e. $p=q=2$ or $p=q=0$.
When $p=q=0$, both $\mathrm{f}$ and $\mathrm{g}$ are constant functions, i.e. $\mathrm{f}(x)=a$ and $\mathrm{g}(x)=b$ for all $x$. Consider $\mathrm{f}\circ \mathrm{g}=\mathrm{fg}$. Since $(\mathrm{f}\circ\mathrm{g})(x) = \mathrm{f}(\mathrm{g}(x))=\mathrm{f}(b)=a$ and $(\mathrm{fg})(x)=\mathrm{f}(x)\cdot\mathrm{g}(x)=ab$, we see that $a=ab$, i.e. $a(1-b)=0$, i.e. $a=0$ or $b=1$. If we insist that $\mathrm{g}(2)=37$ then the case $b=1$ is invalid. We conclude that $a=0$ is the only option. Hence $\mathrm{f}(x)=0$ and $\mathrm{g}(x)=37$.
When $p=q=2$, both $\mathrm{f}$ and $\mathrm{g}$ are quadratics, i.e. for $a_2 \neq 0$ and $b_2 \neq 0$
\begin{eqnarray*}
\mathrm{f}(x) &=& a_2x^2 + a_1x+a_0 \\ \\
\mathrm{g}(x) &=& b_2x^2 + b_1x + b_0
\end{eqnarray*}
If we insist that $\mathrm{g}(2)=37$ then $4b_2+2b_1+b_0=37$, i.e. $b_0=37-2b_1-4b_2$. Consider
\begin{eqnarray*}
\mathrm{f}(x) &=& a_2x^2 + a_1x+a_0 \\ \\
\mathrm{g}(x) &=& b_2x^2 + b_1x + 37-2b_1-4b_2
\end{eqnarray*}
This is where is gets messy. It's a case of expanding out. If we calculate the $x^4$-coefficient of $\mathrm{f}\circ\mathrm{g}$ and $\mathrm{fg}$, we get $a_2b_2^2$ and $a_2b_2$ respectively. We need $a_2b_2^2=a_2b_2$, i.e. $a_2b_2(b_2-1)=0$. Since $a_2$ and $b_2$ are non-zero by assumption, we see that $b_2=1$.
Setting $b_2:=1$ and calculating the $x^3$-coefficients of $\mathrm{f}\circ\mathrm{g}$ and $\mathrm{fg}$ gives $2a_2b_1$ and $a_1+a_2b_1$ respectively. We need $2a_2b_1=a_1+a_2b_1$ and hence $a_1=a_2b_1$.
Setting $a_1:=a_2b_1$ and calculating the $x^2$-coefficients of $\mathrm{f}\circ\mathrm{g}$ and $\mathrm{fg}$ gives $-3a_2b_1+66a_2+a_2b_1^2$ and $-2a_2b_1+a_2b_1^2+a_0+33a_2$ respectively. We need these equal, and hence $a_0=33a_2-a_2b_1$.
Setting $a_0:=33a_2-a_2b_1$, we find that the $x$-coefficients of $\mathrm{f}\circ\mathrm{g}$ and $\mathrm{fg}$ are already equal. Finally, we turn our attention to the constant term of $\mathrm{f}\circ\mathrm{g}$ and $\mathrm{fg}$. Their difference is exactly $a_2b_1-33a_2 = a_2(b_1-33)$. Since $a_2 \neq 0$ by assumption, we have $b_1=33$. Hence:
\begin{eqnarray*}
\mathrm{f}(x) &=& a_2(x^2+33x) \\ \\
\mathrm{g}(x) &=& x^2+33x-33
\end{eqnarray*}
You are free to choose any non-zero $a_2$.
