its easy to plug a function into a function, we did that in algebra.

f(x)=x^2 g(x) = (x+2) fog(x)= x^2+4x+4

but how about going the other way

if fog(x)= 3x^2+2x+8 and g(x) = (x^2+4x), what is f(x)?

I never learned this in precalc or algebra, which branch or course deals with this topic? What is the process for solving these kind of problems?