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

Let $n=mq+r$ with $0\leq r<m $ then
$$x^n-1= (x^m)^q x^r-1=\left((x^m)^q-1\right)x^r+(x^r-1)=(x^m-1)\left(\sum_{k=0}^{q-1}x^{mk}\right)x^r+(x^r-1)$$
and 
$$\deg(x^r-1)<\deg(x^m-1)$$
hence by doing the Euclidean algorithm in parallel for the integers and the polynomials, we find
$$(x^n-1)\wedge(x^m-1)=x^{n\wedge m}-1$$
