A cyclic subsemigroup of a semigroup S that is a group I came across this problem while reading some lectures about semigroups here Lecture Notes on Semigroups by Tero Harju. Page $10$. He named it a nontrivial exercise.
Let $r$ be the index and $p$ the period of an element $x\in S,$ a semigroup. Then
$$K_{x}=\{ {x^{r},x^{r+1},...x^{r+p-1} } \}$$
is a subgroup of S, i.e a subsemigroup that is a group. 
I know I have to show that 


*

*$K_{x}$ is closed under the operation in S.

*$K_{x}$ has identity.

*For any element of $K_{x}$ there exist its inverse for which their product is also in $K_{x}$.


Please I need a hint to help me solve the above problem.
 A: Cyclic semigroups are best seen on a graph. I will show you an example but first a bit of an introduction. The name "cyclic" is a bit misleading, which is why some authors (most prominently Howie) call those semigroups "monogenic" instead. The name is misleading because, unlike cyclic groups, cyclic semigroups do not look like circles -- unless they're actually cyclic groups! However, they do have a circle in them, and the circle is exactly the cyclic subgroup you are asking about. 
There exists a cyclic semigroup of every period and index. Indeed, let's take the element 
$a_{m,r}=\begin{pmatrix} 1 & 2 & 3 & ... & m & m+1 & ... & m+r-1 & m+r \\ 2 & 3 & 4 & ... & m+1 & m+2 & ... & m+r & m+1 \end{pmatrix}$
in the semigroup $\mathcal{T}_{m+r}$ of all functions from an $(m+r)-$element set into itself, for some positive integers $m,\,r.$ The second row in this matrix tells us what is ascribed to the element above it. The element $a_{m,r}$ generates the cyclic semigroup of index $m$ and period $r.$
So let's see what it looks like for $m=4$ and $r=8.$ We take
$a=a_{4,8}=\begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\ 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 5  \end{pmatrix}.$
The graph of this semigroup looks like this

The cycle in the graph is the representation of the cyclic subgroup generated by a certain element, one of $a^4, a^5, a^6, a^7, a^8, a^9, a^{10}, a^{11}.$
Why is it a subgroup? Let's find out whether it has an identity element $e$. An identity element must be idempotent, that is $e^2$ must be equal to $e.$ Let's see. We get the equation
$(a^{4+k})^2=a^{4+k}$ for $k\in\{0,1,...,7\}.$
It's not difficult too see from the picture that it's equivalent to 
$2(4+k)\equiv 4+k \mod 8;$
$k\equiv -4 \mod 8.$
So $k=4$ and we get that $a^{4+4}=a^{8}$ is the only idempotent contained in the cycle. It is now a matter of a simple check to see that it is indeed an identity element in $\{a^4,...,a^{11}\}.$
We now need to show that for every $k\in \{0,...,7\}$ there is $l\in\{0,...7\},$ such that 
$a^{4+k}a^{4+l}=a^8.$
Again, this is equivalent to 
$4+k+4+l\equiv 8 \mod 8;$
$l \equiv -k \mod 8.$
Of course there is a solution of this congruence in the set $\{0,...,7\}.$ We have a group, indeed!
Now, why is it cyclic? We need to find a generator. We need a number $g\in\{0,...,7\}$ such that for any $k\in\{0,...,7\}$ there exists $l\in\{0,...,7\},$ such that 
$(a^{4+g})^l=a^{4+k}.$
Notice that the solution of the congruence 
$4+g\equiv 1 \mod 8,$
which obviously exists in the set $\{0,...,7\},$ works.
We are done with the example. Extending this to a general case shouldn't be very difficult.
A: If I understand the question correctly we have:
$$r'=\min \{b; x^a=x^b\text{ for some }b\ne a\}$$
The number $r$ is the unique number $r<r'$ fulfilling $x^r=x^{r'}$. The number $p$ is defined by $p=r'-r$.
Let us first show that for $a,b\ge r$ the following holds
$$x^a=x^b \Leftrightarrow a\equiv b \pmod p$$
Proof. Since $x^{r+p}=x^r$, we have $x^{a+kp}=x^a$ for any $a\ge r$, $k\ge 0$.
To show the reverse implication, it suffices to rewrite $a=r+q_1p+r_1$ and $b=r+q_2p+r_2$ for $0\le r_1,r_2<p$ (by long division). We get $x^{r+r_1}=x^{r+r_2}$ and the definition of $p$, $r'$ and $r$ implies $r_1=r_2$, which means that $a$ and $b$  are congruent.
Showing the closedness of $K_x$ using the above condition should be easy. This also shows that $K_x$ is a cancellative. Every finite cancellative semigroup is a group.

You can find a proof of the fact you were asking about e.g. in the book Commutative semigroup rings By Robert W. Gilmer as Theorem 2.1. I found this book by searching for semigroup element period. (Which I did because the notion of period of an element was new to me.)
