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
.
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
Simplify[(3x^3+6x+9)/(x^3+2x+3)]
(assuming you mean $x^3$ instead of $x^2$ for $f$) $\endgroup$polys = {f == x^3 + 2 x + 3, g == 3 x^3 + 6 x + 9}; Eliminate[polys, x]
$\endgroup$Clear
any previous definitions, i.e.,Clear[f, g, x]
$\endgroup$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
. $\endgroup$