Suppose I have a simple polynomial in $\{a,b\}$, defined as $a^k-b^k \ \forall \ k\in \mathbb{Z}^{\geq0}$. If I know one of the factor is $(a-b)$, is there a way to get a representation of its remaining factors in Wolfram Language?

I know one of its representation is $\sum_{j=0}^{k-1}{(a^{(k-1)-j}\ b^j)}$ and Mathematica recognizes that

Sum[a^((k-1)-j) b^j,{j,0,k-1}]


(a^k - b^k)/(a - b)

But if I ask


It is unable to do anything.

Also what is the proper way to give assumptions?

Is the above expression intepreted differently if I give as


Also tried factoring directly without giving a single factor to no success,


1 Answer 1


It is well known that $x^k - 1$ factors into the cyclotomic polynomials of the divisors of $k$. To factor $a^k - b^k$ instead, we take the cyclotomic polynomials in $a/b$ and remove the denominator.

For Mathematica to give you a general expression in k, it would have to generate an infinite product of (...)^Boole[Divides[k, d]] terms, or quantify over the Divisors, which seems beyond what Factor is capable of (all the documentation examples result in polynomial expressions).

factorDiffOfPows[k_Integer] :=  (Expand[Numerator@Together@Cyclotomic[#, a/b]])& /@ Divisors@k

Print[AllTrue[Range@105, Expand[Times @@ factorDiffOfPows@#] == a^# - b^#&]]
{a - b, a + b, a^4 + a^3*b + a^2*b^2 + a*b^3 + b^4, a^4 - a^3*b + a^2*b^2 - a*b^3 + b^4}

Try it online!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.