Probs. 12 & 13 , Sec. 2.3, in Herstein's TOPICS IN ALGEBRA, 2nd ed: Existence of only right-sided identity and right-sided inverses suffice I. Let $G$ be a nonempty set closed under an associative product, which in addition satisfies:
(a) There exists an $e\in G$ such that $a\cdot e=a$ for all $a\in G$.
(b) Give $a\in G$, there exists an element $a^{-1}\in G$ such that $a\cdot a^{-1}=e$.
Prove that $G$ must be a group under this product.
II. Prove, by an example, that right indentity element and left inverse does not imply that $G$ is group.
My solution: 

I. Since $G$ is closed  set under an associative product, i.e. if $a,b,c\in G$ then $(a\cdot b)\cdot c=a\cdot (b\cdot c)\in G$. Taking $c=e$ we get $(a\cdot b)\cdot  e=a\cdot (b\cdot e)=a\cdot b \in G$. We have shown that $\cdot$ is binary operation. 
Since $a\in G$ then $a^{-1}\in G$ and we have the following identities $$a^{-1}=a^{-1}\cdot e=a^{-1}\cdot (a\cdot a^{-1})=(a^{-1}\cdot a)\cdot a^{-1} $$
  Then 
  $$
\begin{align}
e &= a^{-1}\cdot (a^{-1})^{-1} \\
&= \left( \left( a^{-1}\cdot a \right) \cdot a^{-1} \right) \cdot \left( a^{-1}\right)^{-1} \\
&= \left( a^{-1}\cdot a \right) \cdot \left( a^{-1}\cdot \left( a^{-1} \right)^{-1} \right) \\
&= \left( a^{-1}\cdot a \right) \cdot e \\
&=a^{-1}\cdot a. 
\end{align}
$$
  Thus we have shown that 
  $$ a\cdot a^{-1}=a^{-1}\cdot a=e. $$
  Then we see that 
  $$ e\cdot a= \left( a\cdot a^{-1} \right) \cdot a = a \cdot \left( a^{-1} \cdot  a \right) = a \cdot e = a. $$ 
We have shown that for this set $G$ and the associative binary operation assumed to be defined on $G$, the properties of the existence of a two-sided identity element in $G$ and the existence  in $G$ of a two-sided inverse for each element of $G$ are satisfied. Therefore $G$ is indeed a group.

II. But II indeed is true. Lets take the set $G=\{a,b,e\}$ and define the product $\cdot$ by the following identities: $e\cdot e=a\cdot e=b\cdot e=e$ and $a^{-1}=b, \ b^{-1}=a$ and consider the following multiplication table for our set $G$
$\begin{array}{c | c c c c c}
\hline\hline
 & e & a & b  \\
\hline
e & e & b & b & \\
a & a & a & e & \\
b & b & e & a & \\
\hline 
\end{array}
$
It's easy to verify that conditions of second problem hold for our $G$, however, $G$ is not group since we can show that $b=a$.
Is my reasoning above correct?
EDIT: Maybe this is a duplicate but I would like to know if my solution is true since I have solved it by myself. Especiaaly I am interested in the solution of the second problem.
 A: You don't need to verify that the operation is defined and associative: that's already given.
What you need to show is that


*

*$e$ is a left identity as well as a right identity (the latter condition is given)

*$a^{-1}a=e$, for every $a\in G$
On the other hand, using $a^{-1}$ may be misleading, but your argument seems good. For the sake of clarity, I'll denote by $b$ and $c$ elements such that $ab=e$ and $bc=e$. Your argument becomes
$$
b=be=b(ab)=(ba)b
$$
then
$$
e=bc=((ba)b)c=(ba)(bc)=(ba)e=ba
$$
Therefore
$$
ea=(ab)a=a(ba)=ae=a
$$
Good work!
The operation you give the Cayley table of does not define a group structure on $\{e,a,b\}$, because $ea=eb$, but $a\ne b$ (this is better than saying that “we can show that $a=b$, which is false at the outset). So long as you verify it is associative, you have your counterexample.
A: I think your proofs of the right identity also being a left identity and the right-inverse of an element also being a left-inverse are OK.
However, talking about closedness (or associativity) is overkill since these conditions are already assumed.
As for a counter-example, how about the following example?

Let us choose $G$ to be the set of all non-zero real numbers, and for any elements $a, b \in G$, let us define $a*b$ as follows:
  $$ a*b \colon= a \, \lvert b \rvert. $$
Then we note that, for any element $a \in G$, we have
  $$ a * 1 = a = a * (-1). $$
  Thus both $1$ and $-1$ act as our right identity elements.
And, for each element $a \in G$, we note that the element $\frac{1}{\lvert a \rvert } \in G$ and we obtain
  $$ \frac{1}{ \lvert a \rvert } * a = \frac{1}{ \lvert a \rvert }\, \lvert a \rvert = 1, $$
  one of the two identity elements. 
Also for each $a \in G$, the element $-\frac{1}{\lvert a \rvert } \in G$ satisfies
  $$ -\frac{1}{\lvert a \rvert} * a = -1, $$
  the other one of the two right identity elements.
As for associativity, for any elements $a, b, c \in G$, we note that
  $$ a*(b*c) = a * \big(b \, \lvert c \rvert \big) = a \, \big\lvert b \, \lvert c \rvert \big\rvert 
= a \, \lvert bc \rvert = a \, \lvert b \rvert \, \lvert c \rvert = \big( a \, \lvert b \rvert \big) \, \lvert c \rvert = (a*b) \, \lvert c \rvert = (a*b)*c. $$
However, this set $G$ with this binary operation $*$ is not a group. Because for any $a \in G$, we note that
  $$ 1 * a = 1 \, \lvert a \rvert  = \lvert a \rvert \neq a $$
  when $a < 0$, and 
  $$ (-1) * a = (-1) \, \lvert a \rvert  = - \lvert a \rvert \neq a $$
  when $a > 0$. Morever, if there were an element $e \in G$ such that 
  $$ e*a = a, $$
  then that element $e$ would satisfy
  $$ e \, \lvert a \rvert = a, $$
  and hence
  $$ e = \frac{a}{\lvert a \rvert } = \pm 1. $$
  This shows that $G$ has no left identity element. Therefore $G$ cannot be a group.

Hope this helps.
A: I am reading "Topics in Algebra 2nd Edition" by I. N. Herstein.
This problem is Problem 13 on p.36.
I solved this problem as follows:

We define $G$ and a product on $G$ as follows:
$G:=\{e,a\}$.
$e\cdot e=e$.
$e\cdot a=e$.
$a\cdot e=a$.
$a\cdot a=a$.


This product is associative:

*

*$(e\cdot e)\cdot e=e\cdot e=e$.
$e\cdot(e\cdot e)=e\cdot e=e$.

*$(e\cdot e)\cdot a=e\cdot a=e$.
$e\cdot(e\cdot a)=e\cdot e=e$.

*$(e\cdot a)\cdot e=e\cdot e=e$.
$e\cdot(a\cdot e)=e\cdot a=e$.

*$(e\cdot a)\cdot a=e\cdot a=e$.
$e\cdot(a\cdot a)=e\cdot a=e$.

*$(a\cdot e)\cdot e=a\cdot e=a$.
$a\cdot(e\cdot e)=a\cdot e=a$.

*$(a\cdot e)\cdot a=a\cdot a=a$.
$a\cdot(e\cdot a)=a\cdot e=a$.

*$(a\cdot a)\cdot e=a\cdot e=a$.
$a\cdot(a\cdot e)=a\cdot a=a$.

*$(a\cdot a)\cdot a=a\cdot a=a$.
$a\cdot(a\cdot a)=a\cdot a=a$.



(a')
$e\cdot e=e$.
$a\cdot e=a$.


(b')
$e\cdot e=e$.
So, $y(e)=e$.
$e\cdot a=e$.
So, $y(a)=e$.


Since $e\cdot a=e$, $e$ is not an identity element.
Since $a\cdot e=a$, $a$ is not an identity element.
So, $G$ has no identity element.
So, $G$ is not a group under this product.

