# Calculating the reminder when dividing complex numbers

When dividing complex numbers, let us consider $\frac{26+120 i}{37+226 i}$. We multiply the numerator and denominator by $(37-226 i)$ and get the result, but how do I divide it like the normal division of two numbers? E.g. $\frac{23}{17}$, which gives $6$ as reminder and $1$ as quotient.

• It seems to me that you are interested in finding remainders in the ring of Gaussian integers $\Bbb{Z}[i]$. In that case there is always (at least one) smallest remainder w.r.t. the complex absolute value. See this question and its answers for a discussion in finding them. To understand what's going on it helps to draw a picture of the complex plane. Aug 7, 2014 at 8:54

In the case of Gaussian integers, i.e. complex numbers of the form $a+bi$ with $a,b$ integers, the usual approach here is to try and make the remainder have as small an absolute value as possible. Observe that unlike in the case of integer arithmetic in the complex case we don't have a concept of a positive number, so insisting on a positive remainder is A) meaningless, B) dangerous in the sense that it leads to problems with the Euclidean algorithm for computing greatest common divisors and such. See the linked question (and preferrably a book on abstract algebra) for more.

The general idea that we copy from usual integer division is to start by determining the integer part of the quotient. If you calculate the quotient in the (field of) complex numbers you get that $$\frac{26+120i}{37+226i}=\frac{28082}{52445}-\frac{1436}{52445}i.$$ We want to find a Gaussian integer as close to this as possible. We see that the real part of this rounds up to one, and that the imaginary part rounds down to zero. This tells that we can minimize the complex absolute value of the remainder by using $q=1+0i=1$ as the quotient, whence the remainder is $$r=a-qb=(26+120i)-1(37+226i)=-11-106i.$$ In this sense the answer would be: Quotient $q=1$, remainder $r=-11-106i$.

If there is a tie in deciding to round up/down, you can flip a coin. As I said, it is pointless to try and force a positive remainder (I guess you can make a rule to round the real and imaginary parts towards zero, if there is a tie), because there is no good notion of positive.

What you definitely should not do is to categorically round both real and imaginary parts towards zero. If you do that then you occasionally run into the problem of the remainder being larger than the divisor. Consider dividing $3+3i$ by $4$. If you do what I warned against, you would be tempted to declare that the quotient is $0$ and that the remainder is $3+3i$. The problem is that $|3+3i|=3\sqrt2>|4|$, so in this sense the remainder is larger than the divisor. Rounding the real and imaginary parts to the nearest integer protects you against this.

• I feel that this is likely to be a duplicate. Unfortunately my search-fu is weak today. Will delete, if a good candidate is found. Aug 7, 2014 at 9:22

I think you can do that, as you wish, by considering this point that in $(\mathbb {C}^*,\cdot)$ we have:

$$(a+ib)^{-1}=\left(\frac{a}{a^2+b^2}-\frac{b}{a^2+b^2}i\right)$$

• Then you are stepping into $\mathbb Q[i]$. What if you want to stay in $\mathbb Z[i]$? Aug 7, 2014 at 8:20
• @drhab: In that case I think we failed. Aug 7, 2014 at 8:22
• @drhab: Regarding to your good point of view, so the OP should have added some more conditions or information in the question. Aug 7, 2014 at 8:24
• Well @Aria. As you see there is some editing to do for you. Aug 7, 2014 at 8:26
• @Aria: If the any condition violating the answer is added, then sign me to remove the post. Please don't give the post -1 Thanks. Aug 7, 2014 at 8:37