How this calculation works
A Gaussian integer has integer real and imaginary coordinates. Euclidean division rounds the exact complex quotient to a nearby Gaussian lattice point, leaving a remainder with smaller norm than the divisor. Repeating that operation reaches a zero remainder and a GCD. The final nonzero remainder is multiplied by a unit so that its real part is positive and its imaginary part is nonnegative. Exact integer divisibility of both original inputs is checked before that representative is returned.
a=q*b+r with q∈Z[i] chosen nearest to a/b and N(r)<N(b); N(x+iy)=x²+y².A worked example
For 5+i and 2+i, the first exact complex quotient is (11−3i)/5. Rounding its coordinates gives 2−i, and the remainder is (5+i)−(2−i)(2+i)=i. Its norm is one, smaller than five, the norm of 2+i. The next division has zero remainder, so the inputs are coprime in Z[i]. Multiplying the last nonzero remainder by −i normalizes the displayed GCD to one.
Good to know
Each input component is an integer within ±10¹². Products, norms, coordinate rounding and remainder checks use integer arithmetic. A deterministic half-integer tie rule rounds away from zero, so another valid Euclidean chain may differ. GCDs are defined up to multiplication by ±1 or ±i; the page chooses one quadrant representative. Both zero inputs use the explicit convention gcd(0,0)=0. Fractional complex coordinates and approximate floating input are unsupported.
The rounded quotient belongs to a two-dimensional integer lattice
Ordinary complex division produces rational coordinates and usually does not stay inside Z[i]. The Euclidean quotient must instead be a Gaussian integer. Rounding each coordinate to a nearest integer keeps the squared distance from the exact quotient at most one half, which makes the remainder norm strictly smaller than the divisor norm. The table shows that norm at each stage so the descent can be checked independently of the final GCD label.
A half-integer coordinate can have two equally near choices. The convention here rounds each tied coordinate away from zero. For 1 divided by 1+i, the exact quotient is 1/2−i/2, so the chosen lattice quotient is 1−i and the remainder is −1. Other nearest choices can also satisfy the Euclidean bound and lead to different intermediate rows. Such a difference is not an error if the identities, norm descent and final associate class agree.
The Polynomial extended Euclidean algorithm calculator also tracks Euclidean remainders, but works in Q[x] instead of the Gaussian integer lattice.
A Gaussian GCD has four associates, not one preferred sign
The units are 1,−1,i,−i, all with norm one. Multiplying a common divisor by any unit preserves divisibility, so a GCD is unique only up to those four rotations. Requiring positive real part and nonnegative imaginary part selects one point in a half-open quadrant. For a divisor on an axis, this convention chooses the positive real associate rather than listing the same divisor four times under different orientations.
A norm is a nonnegative integer, but taking the ordinary integer GCD of the two input norms does not in general recover the Gaussian GCD. Norms forget which Gaussian prime factors occur and how conjugate factors are distributed. The actual Euclidean calculation therefore keeps both coordinates throughout. A single zero input returns a normalized associate of the other input, while the all-zero pair is marked as a separate convention rather than justified by a nonzero last remainder.
A few questions, answered
Does a GCD of one mean the norms are coprime?
Not necessarily. Gaussian coprimality concerns common divisors in Z[i]. Integer norm information alone can lose the distinction between conjugate Gaussian factors.
Can I enter 1/2+i as a Gaussian integer?
No. Gaussian integers require integer coordinates. A rational complex number belongs to a larger field, where every nonzero element is a unit and this Euclidean integer-GCD problem changes.