prove commuting quadratic functions of real numbers are equal

Suppose that $$f(x) = ax^2 +b$$ is a quadratic function, where $$(a, b) \in \mathbb R^2$$ and $$a \neq 0.$$ If $$g(x) = cx^2 +d,$$ where $$(c, d) \in \mathbb R^2$$ and $$c \neq 0,$$ is another quadratic function that commutes with $$f(x)$$

-- i.e., $$(f\circ g)(x) = (g \circ f)(x)$$ for all $$x \in \mathbb R$$) -- then $$f(x) = g(x)$$ for all $$x \in \mathbb R.$$ I'm not sure how to prove this. I don't even know where to start; I am very stuck. If someone could please help, I really need it. I need to prove that $$f(x)=g(x).$$

• Try doing out the composition. Plug the expression for f(x) into the formula for g(x), and see what you get. Then try it the other way – Nathaniel Mayer Feb 17 at 19:20
• So i would get c(ax^2+b)^2 +d? I don't get how that would help @NathanielMayer – Sascha816 Feb 17 at 19:23
• Expand that out, and compare it to what you would get if you did it in the other order. You're trying to show that those two things can only be equal if a=c and b=d – Nathaniel Mayer Feb 17 at 19:24

$$f \circ g = a (g(x))^2 + b = a (cx^2 + d)^2 + b = ac^2x^4 + 2acdx^2 + ad^2 + b$$
$$g \circ f = c (f(x))^2 + d = c (ax^2 + b)^2 + d = ca^2x^4 + 2cabx^2 + cb^2 + d$$
Therefore, by identifying the coefficient, $$ca^2 = ac^2$$ and $$2acd = 2 abc$$ and $$ad^2 + b = cb^2 + d$$.