Let $f(x)=x^3+x^2+x+1$ and $g(x)=x^3+1$. Then in $\mathbb{Q}[x]$
$\gcd (f(x),g(x))=x+1$
$ \gcd(f(x),g(x))=x^3-1$
$\operatorname{lcm}(f(x),g(x))=x^5+x^3+x^2+1$
$\operatorname{lcm}(f(x),g(x))=x^5+x^4+x^3+x^2+1$
I know how to find the greatest common divisor(gcd) and the least common multiple(lcm) of numbers. But how can I find the gcd and lcm of polynomials?