Let $p>3$ be a prime number. Prove that for every $a$, $1$ $\lt$ $a$ $\lt$ $p-1$ Let $p>3$ be a prime number. Prove that for every $a$, $1$ $\lt$ $a$ $\lt$ $p-1$, there is a unique b $\neq$ a , $1$ $\lt$ b $\lt$ $p-1$ such that $ab$ $\equiv$ (1 mod p)
I started off with a proof of contradiction where suppose b is not unique and b can equal a. Then by substitution we have $a*a$ $\equiv$ $1 (mod$ $p)$.  Not sure how to proceed further. Just to clarify, isn't $1 (mod$ $p)$ always 1? So $a*b$ has to be $pk+1$, k=1,2,3,...? 
 A: Using Bézout's Lemma, there exist integers $x,y$ such that $$ax-py=1$$ as $p\nmid a,(a,p)=1$
$\implies ax\equiv1\pmod p$
If $x>p$ or $x<0,$ we can always find $x'$ such that $1<x'<p-1$ and $x\equiv x_1\pmod p$
Proof of uniqueness: 
Let $b_1-b_2,1<b_1<b_2<p-1$ are inverses of $a\pmod p$
$\implies ab_1\equiv1\equiv ab_2\pmod p\implies p\mid a(b_1-b_2)$
But as $p\nmid a,p$ must divide $b_1-b_2$ which is impossible as $1<b_1<b_2<p-1$
A: Let $P= \{0, 1, \dots, p-1\}$ and consider $\mu: P \to P$ given by $x \mapsto ax \bmod p$. Then, $\mu$ is injective (*) and so is surjective, because $P$ is finite. Therefore, $\mu$ is bijection and there is a unique $b \in P$ such that $1=\mu(b)=ab \bmod p$.
This defines a map $\iota: P \to P$ given by $a \mapsto b$ such that $ab \equiv 1 \bmod p$. This map $\iota$  is its own inverse and so is a bijection. Since $\iota(1)=1$ and $\iota(p-1)=p-1$, we get $1 < a < p-1 \implies 1 < b=\iota(a) < p-1$. Finally, $\iota(a)=a$ iff $a^2\equiv 1 \bmod p$, that is, $p$ divides $a^2-1=(a-1)(a+1)$ and so $a\equiv \pm 1 \bmod p$, that is $a=1$ or $a=p-1$.
(*) If $ax \bmod p = ay \bmod p$, then $p$ divides $a(x-y)$. Since $p$ does not divide $a$, it must divide $x-y$. Since $|x-y|<p$, we must have $x-y=0$ and so $x=y$.
