In mathematics, more specifically in abstract algebra and ring theory, a Euclidean domain is a ring that can be endowed with a certain structure namely a Euclidean function, to be described in detail below which allows a suitable generalization of the Euclidean algorithm. This generalized Euclidean algorithm can be put to many of the same uses as Euclid's original algorithm in the ring of integers: in any Euclidean domain, one can apply the Euclidean algorithm to compute the greatest common divisor of any two elements. In particular, the greatest common divisor of any two elements exists and can be written as a linear combination of them (Bézout identity). Also every ideal in a Euclidean domain is principal, which implies a suitable generalization of the Fundamental Theorem of Arithmetic: every Euclidean domain is a unique factorization domain. It is important to compare the class of Euclidean domains with the larger class of principal ideal domains (PIDs).