How to determine the gcd of a set I'm stuck at a question. 
The question states that $K$ is a field like $\mathbb Q, \mathbb R, \mathbb C$ or $\mathbb Z/p\mathbb Z$ with $p$ a prime. $R$ is used to give the ring $K[X]$. A subset $I$ of R is called an ideal if:
• $0 \in I$; 
• $a,b \in I \to a−b \in I$; 
• $a \in I$ $r \in R \to ra \in I$. 
Suppose $a_1,...,a_n \in R$. The ideal $<a_1,...,a_n>$ generated by $a_1,...,a_n$ is deﬁned as the intersection of all ideals which contain $a_1,...,a_n$. Prove that $⟨a_1,...,a_n⟩ = {r_1a_1 +···+ r_na_n | r_1,...,r_n \in R}$. 
 I proved this, but I got stuck on the one below:    

Prove that $⟨a_1,...,a_n⟩ = ⟨\gcd(a_1,...,a_n)⟩$
Because I know how to calculate the gcd, but how do I use it in this context? Because it now has more than two elements, so I don't know how to work with this

The proof is essentially the same as in $\Bbb Z$ via Euclidean descent, i.e. by division with remainder.
It suffices to show $I = (a_1,\ldots,a_n) = (d)$ is principal, since then $\,a_i \in (d)$ implies $\,d\,$ is a common divisor of the $a_i,\,$ necessarily greatest since $\,d\in I\,\Rightarrow\, d = r_1 a_1 +\cdots + r_n a_n$ hence $c\mid a_i\,\Rightarrow\,c\mid d\,\Rightarrow\, \deg c\le \deg d$
Principality follows by Euclidean descent: $ $ if $d$ is a least degree element of $I$ then $d$ divides every $\,a\in I,\,$ else $\, 0\neq r = a\bmod d = a-qd\in I$ has $\,\deg r < \deg d,\,$ contra minimality of $d$. Therefore $\,(d)\supseteq (a_1,\ldots,a_n)\supseteq (d)$
Remark $ $ The same proof works for any domain enjoying division  with ("smaller") remainder. Such domains care called Euclidean, and the above proof shows they are PIDs - principal idea domains, with ideals generated by any element of least Euclidean value, and this generator is a gcd of all elements in the ideal. 
