How this calculation works
Functional decomposition seeks an unknown inner polynomial and outer polynomial whose composition is the input. It is different from writing the input as a product. Over rational coefficients in characteristic zero, a normalized inner polynomial of a proposed degree is determined by the high-degree coefficients of the input. This calculator tests every nontrivial divisor degree, recovers that candidate, and checks whether the input is exactly a polynomial in it. A successful row includes both components and their degrees; no approximate coefficient fitting is used.
p(x)=g(h(x)), deg(g)>1, deg(h)>1; normalize h to be monic with h(0)=0.A worked example
The coefficient list (1,0,2,0,1) means x⁴+2x²+1. A normalized decomposition is h(x)=x² and g(x)=x²+2x+1, so g(h(x))=x⁴+2x²+1. The alternative presentation h(x)=x²+1, g(x)=x² describes the same intermediate variable up to an affine shift and is consolidated by requiring h(0)=0. Multiplicative factorization as (x²+1)² is related in this example but is a different operation and does not replace the functional component search.
Good to know
Univariate rational polynomial of degree two through twelve, entered as descending coefficients. Both component degrees must exceed one. The page tests all normalized two-level decompositions at the supported proper divisor degrees; affine changes of the intermediate variable are not separate rows. It does not claim transcendental components, multivariate decomposition, noisy fitting or a complete enumeration of every recursively equivalent multi-level chain. Rational fraction-growth bounds apply.
Reference: SymPy — polynomial functional decomposition (opens in a new tab) ↗
Degree multiplication gives a finite list of possible inner degrees
For nonconstant polynomials, degree(g∘h)=degree(g)degree(h). A nontrivial inner degree must therefore be a proper divisor of the input degree. Prime-degree inputs have no such divisor and are immediately indecomposable into two polynomial components of degree greater than one. Composite degree only makes decomposition possible; it does not prove that the required coefficients exist. The output lists the degrees actually tested.
After normalizing the inner leading coefficient to one and its constant to zero, its remaining high coefficients are recovered successively. At each step the new coefficient enters the leading outer power with a known nonzero multiplier, so characteristic zero permits a unique rational solution. Subtracting powers of the recovered inner polynomial then either produces an exact outer polynomial or leaves a remainder incompatible with that degree. Every successful pair is composed back to the original coefficient list.
Affine equivalence prevents endless alternate presentations
If p=g∘h and L is an invertible affine polynomial, then p=(g∘L inverse)∘(L∘h). Scaling and shifting the intermediate value therefore create infinitely many descriptions of the same structure. The monic zero-constant normalization chooses one representative for each supported inner degree. A user should compare the composed result and normalization rather than count shifted presentations as additional mathematical operations.
A polynomial can be multiplicatively irreducible and still have useful functional structure, or factor as a product without admitting nontrivial composition. The Function composition calculator evaluates components supplied by the user; here the components are inferred. The Multivariate polynomial factorization calculator over rationals instead returns product factors in x and y. Keeping these tasks distinct prevents a familiar-looking squared expression from being treated as a general solution to functional decomposition.
A few questions, answered
Why do you not return h=x²+1 for the worked example?
Its constant is shifted into the outer polynomial. The normalized h=x² represents the same affine-equivalent intermediate variable without duplicate presentations.
Does an empty result mean no factorization exists?
It means no nontrivial rational polynomial composition exists within the declared exact degree scope. It says nothing about multiplicative factors or transcendental representations.