Find all entire functions such that $\forall z\in \mathbb{C}$ : $f(f(z))=f(z)$
I am given the following answer but I do not fully understand it, it goes:
Let $I$ be the image of $f$
$\forall a\in I \exists z_{a}\in \mathbb{C}: f(z_{a})=a$
$f(a)=f\bigl(f(z_{a})\bigr)=f(z_{a})=a$ therefore $ \forall a\in I f(a)=a$
If $f$ is constant so we are done, let assume it is not.
The image of a non constant entire function is dense in $\mathbb{C}$ so $I$ is dense in $\mathbb{C}$, so every point in $\mathbb{C}$ is an accumulation point so $I$ is a set with accumulation points and therefore $\forall z\in \mathbb{C} ; f(z)=z$
Why can we conclude that $f(z)=z$
You proved that the equality $f(a)=a$ is true for each $a\in I$ and that $I$ is dense. So, if $z\in\mathbb C$, you take a sequence $(z_n)_{n\in\mathbb N}$ such that $(\forall n\in\mathbb{N}):z_n\in I$ and that $\lim_{n\in\mathbb N}z_n=z$, and then\begin{align*}f(z)&=f\left(\lim_{n\in\mathbb N}z_n\right)\\&=\lim_{n\in\mathbb N}f(z_n)\\&=\lim_{n\in\mathbb N}z_n\\&=z.\end{align*}