Positive or negative remainder

In summary: So in mathematics, the result of -23/5 would normally be -5 with a remainder of 2.In summary, the statement "Is -23 = 5(-4)-3 gives a remainder -3 when divided by 5?" can be considered true, as all integers can be remainders in the same equivalence class. However, the exact remainder may vary depending on the convention used for integer division. In mathematics, the remainder would be 2, while in some programming languages it may be -3.
  • #1
Ling Min Hao
22
0
Is 23 = 5(-4)-3 gives a remainder -3 when divided by 5 ? is this statement true ? some of my colleagues said that remainder cannot be negative numbers as definition but I am doubt that can -3 be a remainder too?
 
Mathematics news on Phys.org
  • #2
Ling Min Hao said:
Is 23 = 5(-4)-3 gives a remainder -3 when divided by 5 ? is this statement true ? some of my colleagues said that remainder cannot be negative numbers as definition but I am doubt that can -3 be a remainder too?
Usually we consider entire equivalence classes in such cases: Every single element of ##\{\ldots -13, -8, -3, 2, 7 , 12, \ldots\}## belongs to the same remainder of a division by ##5##. We then define all five possible classes
##\{\ldots -15, -10, -5, 0, 5, 10, \ldots\}##
##\{\ldots -14, -9, -4, 1, 6, 11, \ldots\}##
##\{\ldots -13, -8, -3, 2, 7, 12, \ldots\}##
##\{\ldots -12, -7, -2, 3, 8, 13, \ldots\}##
##\{\ldots -11, -6, -1, 4, 9, 14, \ldots\}##
as elements of a new set with five elements ##\{ \; \{\ldots -15, -10, -5, 0, 5, 10, \ldots\}\, , \, \{\ldots -14, -9, -4, 1, 6, 11, \ldots\}\, , \, \ldots \}##.

This notation is a bit nasty to handle, so we choose one representative out of every set. E.g. ##\{[-15],[-9],[12],[3],[-1]\}## could be chosen, but this is still a bit messy to do calculations with. So the most convenient representation is ##\{[0],[1],[2],[3],[4]\}## with the non-negative remainders smaller than ##5##. However, this is only a convention. ##-3## is a remainder, too, belonging to the class ##[2]##. So the answer to your questions is: The statement is true, as all integers are remainders.
 
  • #3
The remainder is usually required to be between 0 and N-1 inclusive. 23 and -2 (not -3) are in the same equivalence class. This can also be written as 23 = -2 mod 5.
 
  • #4
mfb said:
The remainder is usually required to be between 0 and N-1 inclusive. 23 and -2 (not -3) are in the same equivalence class. This can also be written as 23 = -2 mod 5.

Sorry it should be -23 = 5(-4) - 3 , so in conclusion is, this statement true ?
 
  • #5
Ling Min Hao said:
Sorry it should be -23 = 5(-4) - 3 , so in conclusion is, this statement true ?
"-23 divided by 5 is -4 with a remainder of -3". I would consider that statement true.
"-23 divided by 5 is -5 with a remainder of 2". I would also consider that statement to be true.

The convention you use for integer division will determine which of those statements is conventional and which is unconventional.

In many programming languages, integer division follows a "truncate toward zero" convention. For instance, in Ada, -23/5 = -4. The "rem" operator then gives the remainder. So -23 rem 5 = -3.

If one adopts a convention that integer division (by a positive number) truncates toward negative infinity then one would get a different conventional remainder. -23/5 would be -5 and -23 mod 5 would be +2. The Ada "mod" operator uses this convention.

In mathematics, one typically adopts the line of reasoning given by @fresh_42 in post#2 above. The canonical exemplar in the equivalence class of possible remainders is normally the one in the range from 0 to divisor - 1.
 

FAQ: Positive or negative remainder

What is "positive or negative remainder"?

"Positive or negative remainder" refers to the result of a division operation where the remainder can be either positive or negative. The remainder is the amount left over after evenly dividing the dividend by the divisor.

How is "positive or negative remainder" calculated?

The calculation of "positive or negative remainder" is based on the modulus operator (%). This operator returns the remainder of a division operation, taking into account the signs of the dividend and divisor. If the remainder is positive, it means that the dividend was larger than the divisor and there is still a portion left to be divided. If the remainder is negative, it means that the dividend was smaller than the divisor and there is no remainder left.

Can the remainder be zero in "positive or negative remainder"?

Yes, the remainder can be zero in "positive or negative remainder" if the dividend is evenly divisible by the divisor. In this case, the remainder is neither positive nor negative.

How is "positive or negative remainder" used in real life?

"Positive or negative remainder" can be used in various real-life scenarios, such as calculating change in a transaction, determining the number of items left over after dividing them into equal groups, or finding the number of days remaining in a month or year.

What is the difference between "positive or negative remainder" and "absolute remainder"?

The difference between "positive or negative remainder" and "absolute remainder" lies in their interpretation of the remainder. In "positive or negative remainder", the remainder can be either positive or negative, depending on the signs of the dividend and divisor. In "absolute remainder", the remainder is always positive, as it represents the absolute value of the leftover portion after division.

Back
Top