f(g(x)) is the same as what you wrote
That translates into wherever you see an x in f(x) you put in g(x)
f(x) = x^3 - 4x + 2
f(g(x)) = (x^2 + 2)^3 - 4(x^2 + 2) + 2 Now expand .
f(g(x)) = (x^2)^3 + 3*2*x^4 + 3*4*x^2 + 8 - 4x^2 - 8 + 2
f(g(x)) = x^6 + 6x^4 + 12x^2 + 8 - 4x^2 - 8 + 2
f(g(x)) = x^6 + 6x^4 + 8x^2 + 2