# Find relations between polynomials

I have a question regarding the relationship between two polynomials. (I'm still a beginner and don't know so many commands.) Is there any option to show me the relation between two polynomials? As an example, if

$$f=x^2+2x+3$$,

$$g=3x^3+6x+9$$

then to have an output like $$3f=g$$.

• You can divide them with Simplify[(3x^3+6x+9)/(x^3+2x+3)] (assuming you mean $x^3$ instead of $x^2$ for $f$)
Aug 28, 2022 at 16:43
• polys = {f == x^3 + 2 x + 3, g == 3 x^3 + 6 x + 9}; Eliminate[polys, x] Aug 28, 2022 at 17:07
• @BobHanlon This just give me the Output: False Aug 28, 2022 at 17:09
• Clear any previous definitions, i.e., Clear[f, g, x] Aug 28, 2022 at 17:13
• f == x^3 + 2 x + 3; g == 3 x^3 + 6 x + 9; and {q, r} = PolynomialQuotientRemainder[g, f, x]. Also explore, PolynomialReduce, GroebnerBasis, PolynomialGCD.
– Syed
Aug 28, 2022 at 17:49

• When f=x^3 + 2 x + 3

GroebnerBasis work for another complex cases.

Clear[f, g, basis];
{f, g} = {x^3 + 2 x + 3, 3 x^3 + 6 x + 9};
basis = GroebnerBasis[{f, g}, x]


{3 + 2 x + x^3}

It means that f and g have comment divisor.

PolynomialReduce[f, basis, {x}][[1]]
PolynomialReduce[g, basis, {x}][[1]]


{1} {3}

That is g=3f.

• When f=x^2 + 2 x + 3
Clear[f, g, basis];
{f, g} = {x^2 + 2 x + 3, 3 x^3 + 6 x + 9};
basis = GroebnerBasis[{f, g}, x]


{1}

It measns that f and g are coprime

{d, {a, b}} = PolynomialExtendedGCD[f, g, x]
{f, g} . {a, b} == d
% // Simplify


True.

f*1/54 (15 - 9 x + 3 x^2) + g*1/162 (3 - 3 x) == 1