2

I'm not sure how to do this but I gave it a try:

I know that $7$ must have an inverse because $\text{ gcd }(12,7)=1$

Now, on this, use euclidean algorithm. We have $$7x \equiv 1 \text{ mod } 12$$

$$x \equiv 7^{-1}(\text{ mod } 12)$$

So

$$12 = 7 \cdot 1+5$$

$$7=5 \cdot 1+2$$

$$5=2\cdot 2+1$$

Now we can stop this here and write:

$$1=5-4$$

And now I cannot replace $4$ because there isn't any $4$ in the equations above : /

What to do? There is another, easier way?

Ethan Bolker
  • 95,224
  • 7
  • 108
  • 199
berndgr
  • 375

2 Answers2

2

You have \begin{align} \color{red}{12}&=\color{red}{7}\cdot1+\color{red}{5}\\ \color{red}{7} &=\color{red}{5}\cdot1+\color{red}{2}\\ \color{red}{5} &=\color{red}{2}\cdot2+\color{green}{1} \end{align} Then $$ 1=\color{red}{5}-\color{red}{2}\cdot2= \color{red}{5}-2(\color{red}{7}-\color{red}{5})= -2\cdot\color{red}{7}+3\cdot\color{red}{5}= -2\cdot\color{red}{7}+3(\color{red}{12}-\color{red}{7})= -5\cdot\color{red}{7}+3\cdot\color{red}{12} $$

egreg
  • 238,574
1

At the end you write $$ 1 = 5 - 2 \cdot 2 $$ and replace a $2$ with $7 - 5 \cdot 1$ using the previous equation. Don't multiply to get the $4$.

Of course in this small example you could look for a multiple of $7$ near a multiple of $12$. Since $5 \cdot 7 = 36 -1$ the inverse of $7$ will be $-5$, which is $7$. So $7$ is its own inverse. I should have seen that right away since $7^2 = 48+1$.

Ethan Bolker
  • 95,224
  • 7
  • 108
  • 199