x2 + y2 = z2.
The solutions in integers are known as Pythagorean triples.
If we use the complex number i,
i2=-1, then we can decompose the left hand side of the equation as follows:
(x + iy)(x-iy) = z2.
This leads us to the ring of Gaissian integers
R={x + iy; x, y are integers }.
The ring R has similar properties like Z,
the ring of usual integers.
We can prove that any number in R is uniquely
expressed as a product of 'prime numbers' in R.
If A, B, C in Z, A and B
have no common divisor greater than 1, and
AB = C2,
then we see that A and B are both square numbers
by unique factorization property.
Similarly, if (x, y, z) is a Pythagorean triple and
x and y have no common divisor greater than 1,
then we see that x + iy and x - iy are both square numbers in R.
We also see that one of x and y
is odd and the other is even. So we may assume
x is odd and y is even.
Then we have
x + iy = (a + bi)2 = a2 - b2 + 2abi ,
hence
x = a2 - b2, y = 2ab, z = a2 + b2 .
As we saw in the argumnet above, it is very useful to consider certain rings
like the ring of Gaissian integers for many problems on usual integers.
Such a ring is called the ring of algebraic integers in an algebraic number field.
An algebraic number is a complex number which is a root of an algebraic equation
Xn + a1Xn-1 + ... + an-1X + an = 0,
where ai's are rational numbers.
An algebraic integer is a complex number which is a root of an algebraic equation
Xn + a1Xn-1 + ... + an-1X + an = 0,
where ai's are usal integers.
An algebraic number field K is a subfield of the field of complex numbers which is a finite dimensional vector space over the field of rational numbers. K is of the form
K={c0 + c1t + ... + cn-1tn-1; ci's are rational numbers} ,
where t is an algebraic number.
The ring of integers in K is the set of all algebraic integers in
K. We denote it by OK.
The unique factorization property does not hold in the ring OK in general. However, there is an invariant to measure how far it is
from the unique factorization property. It is called the class number of K.
If you want to know more on algebraic number fields, I recommend you to read
K. Ireland & M. Rosen, A Classical Introduction to Modern Number Theory, Springer 1990.