Prove that the set of all periods of a function is a subgroup 
Let $G$ be a group and $f: G \to G$ a function. A period of $f$ is any element $a \in G$ such that $f(x) = f(ax)$ for every $x \in G$. Prove that the set of all periods of $f$ is a subgroup of $G$.

Let $P = \{a \in G: f(x) = f(ax) \text { for every $x$} \in G.\}$
Let $b, c \in P.$ Then $f(x)g(x) = f(bx)g(cx) = (fg)(bc(x))$. So, $bc \in P.$
$f(x) = f(ex)$, so $e \in P.$
Since $e \in P, \exists h, k \in P (f(hx)f(kx) = f(ex)),$ so $f(kx) = f(h^{-1}x)$. So, the inverse is in $P.$
Please, see what needs fixing here.
 A: You've made some errors in your proof. You didn't correctly prove that $bc\in P$ when $b\in P$ and $c\in P$. You also didn't correctly show that $h^{-1}\in P$ when $h\in P$.
To correct the first issue, use the fact that $f(bx) = f(x)$ for all $x$ and $f(cx) = f(x)$ for all $x$ to write
$$f((bc)x) = f(b(cx)) = f(cx) = f(x)$$
for all $x$. This shows $bc\in P$.
For the second issue, you can say that since $f(hx) = f(x)$ for all $x$, we have, for all $x$,
$$f(h^{-1}x) = f(h(h^{-1}x)) = f((hh^{-1})x) = f(ex) = f(x)$$
Therefore $h^{-1}\in P$. 
A: I don't think you should be using the second function $g: G \to G$. You need to show that $f(bcx) = f(x)$ instead, given that $b, c \in P$. 
I can't quite parse the bit about inverses of periods. It seems that you've started off by assuming that $P$ contains inverses, by saying "$\exists h, k \in P$"
It doesn't seem right. In particular, $f(hx)f(kx) = f(x)f(x)$ seems to be all you can really say. Just keep in mind that this function $f: G \to G$ isn't necessarily a homomorphism or one-to-one, so you can't assume that $f(xy) = f(x)f(y)$ or $f(ax) = f(bx)$ implies that $a = b$. I'm not sure you've assumed either of these, but you seem to be coming close, if you aren't.
