how can I solve the following tasks?
a) Find all primitive elements of $\mathbb{Z}_{37}$.
I guess the only possibility here is to try if the remainder off all elements from 1 to 36 to the power of 1 to 36 is unique? Or is there an algorithm to do this? I found out that 2, 5, 13, 15, 17, 18, 19, 20, 22, 24, 32, 35 are the primitive elements by trying.
b) If $p \in \mathbb{P}$ and $g \in \mathbb{G}$ are the public parameters of the Diffie-Hellman key exchange and $m = g ^a$ and $n = g^a$ the public parameters which were calculated. Show that the resulting secret key is an element of $<m> \cap <n>$ and of $G = (\mathbb{Z}_p \backslash {0}, \cdot)$.
NOTE: $<g> = {g^n: n \in \mathbb{Z}}$.
Here I have no idea what to do. I guess it has something to do with the primitive elements, but I don't know how to prove that mathematically correct.
c) Do an example: $p = 37, g = 2, a = 6, b = 32$. How can the range of the keys be limited without guessing $a$ and $b$?
I also guess it has something to do with the primitive elements...but not a really idea.
Can you give me some tips (NOT the solution, I want to do it on my own). Thank you so much.
To find all the primitive elements you really need to find just one. Indeed, let $g$ be any primitive element modulo $p$. Then all other primitive elements have form $g^a$ where $a$ is coprime with $\phi(p-1)$.
The key in DF key exchange schema is $k=g^{ab}$, so $k = m^b = n^a$ hence it is in $\langle m \rangle$ (because it is $k=m^b$) and similarly it is in $\langle n \rangle$.