Find the greatest common divisor of the polynomials: a) $X^m-1$ and $X^n-1$ $\in$ $Q[X]$
b) $X^m+a^m$ and $X^n+a^n$ $\in$ $Q[X]$
where $a$ $\in$ $Q$, $m,n$ $\in$ $N^*$
I will appreciate any explanations! THanks

Hint: $\rm\ f\mid x^n\!-\!1,x^m\!-\!1 \!\iff\!\ mod\ f\!:\  ord\, x\mid n,m \!\iff\! ord\,  x\mid gcd(n,m) \!\iff\! f\mid x^{\gcd(n,m)}\!-\!1 $
