If $R$ is a ring with identity and $a$ is a unit, prove that the equation $ax=b$ has a unique solution in $R$. So, this was my initial proof:

Assume $R$ is a ring, and $a,b\in R$
Let $x_1$ and $x_2$ be solutions of $ax=b$
Hence, $ax_1=b=ax_2 \Rightarrow ax_1-ax_2=0_R \Rightarrow a(x_1-x_2)=0_R$
Thus, we have $x_1-x_2=0_R \Rightarrow x_1=x_2$, and only one solution exists.

Only now did I realize that I can only assume $x_1-x_2=0_R$ from $a(x_1-x_2)=0_R$ if $R$ was an integral domain. I didn't know why they provided that $R$ had an identity or why $a$ is a unit.
 A: Your solution is close to being great. First off, they told you that $R$ is ring with unity because only those can have units. Second, your proof doesn't require knowledge that it is an integral domain. Towards the end, you have
$$a(x_1-x_2)=0$$
Then, because $a$ is a unit, $a^{-1}$ exists, and
$$a^{-1}a(x_1-x_2)=a^{-1}0=0$$
$$x_1-x_2=0\implies x_1=x_2$$
so the solution is unique, as you stated.
A: Other answers have been given, but I'll throw my 2 cents anyway.
For proving uniqueness you just need that $a$ is left invertible, that is, there exists $c\in R$ such that $ca=1$.
Indeed, if $ax_1=b=ax_2$, you get $a(x_1-x_2)=0$. Thus $ca(x_1-x_2)=c0=0$ and therefore $x_1-x_2=0$, because $ca=1$.
Right invertibility of $a$ provides existence: if $ad=1$, for some $d\in R$, then $a(db)=(ad)b=1b=b$, so $db$ is a solution to $ax=b$.
Note that if $a$ is both left and right invertible, then, with the same notation as before, we have $c=d$: indeed
$$
c=c1=c(ad)=(ca)d=1d=d
$$
so left and right inverses are the same and, in particular, unique (because any right inverse must be the same with one left inverse and similarly for the other side). In this case $a$ is called a unit and the unique left and right inverse is denoted by $a^{-1}$.
A: Let $R$ be a unitial ring with $a,b\in R$ where $a$ is a unit. Then $ax=b$ if and only if $x=a^{-1}b$. Indeed, if $ax=b$, then $$x=1_Rx=a^{-1}ax=a^{-1}b$$
Conversely 
$$
a(a^{-1}b)=(aa^{-1})b=1_Rb=b
$$
A: If
$ax_1 = ax_2 = b, \tag{1}$
with $a \in R$ a unit, then since we have $c \in R$ with $ac = ca = 1_R$, 
$x_1 = 1_R x_1 = (ca)x_1 = c(ax_1)$
$= c(ax_2) = (ca)x_2 = 1_R x_2 = x_2, \tag{2}$
so the solution is unique.  We further note that
$ax = b \tag{3}$
yields
$x = 1_R x = (ca)x = c(ax) = cb; \tag{4}$
the unique solution to (3) is thus $cb$.
