Hello,

In fact, you're asked to find the inverse of numbers modulo m.

Let's do it for these two, I guess they'll give you quite the general idea. The key is to use the extended Euclidean algorithm (you can look for it in google)

Find z in

You know that since 3 and 10 are coprime, you'll have a remainder 1 while continuing doing the algorithm. And this is why it is useful.

Do the algorithm with 10 and 3 as starting points :

Hence

You can note that because

So we have

In general, we want z to be the least positive integer satisfying the condition.

So you can add 10 :

For the second one, you're looking for z in

Algorithm for 5 and 18 :

My method is to write successively the remainders.

Now, do the division for 5 and the new remainder, 3.

Division for 3 and the new remainder, 2.

But we saw that :

So we have