2

I've just read Gaussian Integer - Wikipedia, and it mentions the possibility of euclidean division in $ℤ[i]$. Is there a computable formula of the form $(x_1 + iy_1) / (x_2 + iy_2) = f(x_1, y_1, x_2, y_2) + ig(x_1, y_1, x_2, y_2)$ where $f$ and $g$ are directly or recursively defined?

Sorry for the imprecise language. I'm trying to code something, and you can't implicitly define things in most programming languages (except Prolog)

  • 5
    In that article, it tells you to just do the usual division in the complex numbers and round the real and imaginary parts to the nearest integer. If you write all the steps out, you could do this with just integer division (though you'd need to take care for overflow) – Brian Moehring Sep 03 '19 at 19:18
  • Do you know how to perform division of complex numbers? I think a problem with your question is that the definition of a Euclidean domain does not specify an explicit norm, but it’s unclear whether you’re asking about that implicitness or something else, because your notation suggests you may also be confused about complex number arithmetic. – Erick Wong Sep 03 '19 at 20:08
  • @ErickWong sorry that was a mistake, I added the $i$s – schuelermine Sep 04 '19 at 05:09

2 Answers2

1

Sure there is. $\mathbb{Z}[i]$ is a Euclidean domain, so the Euclidean algorithm Just Works (TM) when you use the norm $N(a+bi) = a^2+b^2$.

There are answers at Prove that the Gaussian Integer's ring is a Euclidean domain which go into more detail.

1

Assuming that $f, g, x_i, y_i$ are required to be real, this uniquely determines $f$ and $g$, so I wonder if you’re just asking how to divide complex numbers:

$$\frac{x_1 + iy_1}{x_2+iy_2} = \frac{x_1 + iy_1}{x_2+iy_2} \frac{x_2- iy_2}{x_2-iy_2} = \frac{x_1 x_2 + y_1 y_2}{x_2^2 + y_2^2} + i \frac{x_2 y_1 - x_1 y_2}{x_2^2 + y_2^2}.$$

It is certainly possible, though unnecessary, to derive this by solving a small system of linear equations: is that what you meant by implicit?

Edit: I see from your question on Code Review that you are interested in integer division. In that case as Brian Moehring comments above, you just round nearest on the fractional values of $f$ and $g$ (note that the remainder is not guaranteed to have positive components like in the integer case). I suspect you are using / to mean division with rounding which is a confusing way to phrase a math question :). I would use something that doesn’t look like exact division, such as DIV.

Erick Wong
  • 25,198
  • 3
  • 37
  • 91