Let $f:F\to F$ be defined by $f(x)=x^3$ where $F=\mathbb{Z}/p\mathbb{Z}$ for some prime $p$. Prove that $f$ is linear if and only if $p=3$.
My attempt:
First suppose $p=3$. Then $$f(x+y)=x^3+3x^2y+3xy^2+y^3=x^3+y^3=f(x)+f(y)$$ and $$f(\lambda x) = \lambda^3 x^3 = \lambda x^3 = \lambda f(x)$$
Therefore $f$ is linear.
Now suppose $p \neq 3$. I'm not sure what to do from here, how do I do this?