How do I solve for negative modular arithmetic?

Here is an example: -45 mod 13 = 7, but how?

-52 mod 13 = 0

-45-(-52)=7

You can add multiples of 13 until you get a positive number, example:

-45+4(13)=-45+52=7
or even
-45+10(13)=-45+130=85≡7 mod 13

Thanks for your help!

Also, I am kind of confused about finding the value of x.

Example: 9x ≡ 1 mod 10

How do I solve this?

how long will it take for a 10,000 investment to grow to 15,000if it is compounded continuously at 5 %

To solve for negative modular arithmetic, you need to consider two main principles: the definition of modular arithmetic and the properties of negative numbers in modular arithmetic.

1. Definition of Modular Arithmetic:
In modulo arithmetic, we calculate the remainder when dividing a number (the dividend) by another number (the divisor). This remainder is called the modulo. For positive numbers, the modulo is always a non-negative number.

2. Properties of Negative Numbers in Modular Arithmetic:
When dealing with negative numbers in modular arithmetic, you can use the following property: adding or subtracting a multiple of the modulo does not change the remainder. In other words, you can shift the number by multiples of the modulo and still get the same result.

Now, let's apply these principles to solve the example you provided: -45 mod 13.

Step 1: Calculate the modulo for the positive equivalent.
In this case, the positive equivalent of -45 is 45. To calculate the modulo, divide 45 by 13:
45 ÷ 13 = 3 remainder 6.
So, the positive modulo is 6.

Step 2: Apply the property of negative numbers in modular arithmetic.
Since the negative modulo should also be 6 (as adding multiples of 13 to -45 produces the same remainder), you need to find a negative number that satisfies this condition.

Subtract the modulo found in step 1 (6) from the divisor (13):
13 - 6 = 7.
Therefore, -45 mod 13 is equivalent to 7 in the context of negative modular arithmetic.

To verify this result, you can add multiples of 13 to -45 and observe that the remainder is always 7:
-45 + 13 = -32 (remainder is 7)
-45 + 26 = -19 (remainder is 7)
-45 + 39 = -6 (remainder is 7)
And so on...

Remember, the key is to work with the positive equivalent, calculate the modulo, and then apply the property of negative numbers in modular arithmetic to find the negative modulo.