f(x) = 3x + 2
g(x) = x^2 + 1
find gf(x) in the form ax^2 + bx + c

please add an explanation because i’ve seen it being solved i just do not understand some steps

like, where does 12x come from