Firstly, we have to substitute g(x) into the function f(x)So, fg(x) = (g(x))^2 +2
Next we must rewrite the equation on the RHS in terms of x only
So, fg(x) = (x-5)^2 +2
Next we must simplify the RHS by expanding the brackets
So, fg(x) = (x-5)(x-5) +2 = (x^2-10x +25) +2 = x^2 -10x + 27