# Factoring "positive-semidefinite" polynomials

I'm not a mathematician, but my research recently led to a mathematical question that seems so clean I feel it must've been studied before. I haven't been able to solve it or find relevant existing work, though, so I thought I'd ask it here.

The question's about functions that are power series with all nonnegative coefficients. To be explicit, I mean functions of the form

$$f(x) = \sum_{n=0}^\infty a_n x^n$$, where $$a_n \ge 0$$.

The set of functions of this form is closed under composition - if $$f$$ and $$g$$ are of this form, then so is $$f \circ g$$. My question's about the ways one such function can be factored into two: given an $$f$$ of this form, what $$g$$, $$h$$ also of this form can we find such that $$g \circ h = f$$?

It's easy to see there's always a trivial solution where either $$f$$ or $$g$$ has only a linear term; we can always take $$g(x) = a_1 x$$ and $$h(x) = f(x)/a_1$$, for example. Sometimes, though, there's no nontrivial solution! For example, there's no way to nontrivially factor $$f(x) = x + x^2$$ into two other "positive-semidefinite" polynomials.

Is there a simple way to characterize the set of ways to factor a given "positive-semidefinite" polynomial, or even just a simple way to determine if a given PSD polynomial can be split nontrivially? A bonus question I'm also curious about is whether there's an easy way to find the "square-root" of a given PSD polynomial (i.e. given $$f$$, find a $$g$$ where $$g \circ g = f$$).

Thanks!