0
$\begingroup$

Say I have a random function $f: \mathbb{Z}_N \rightarrow \mathbb{Z}_N$. (by random I mean for each possible input we choose an output in an uniform distribution from $\mathbb{Z}_N$)
So I know that for all $x,y \in \mathbb{Z}_N$ I have $Pr[f(x)=y]={1 \over |\mathbb{Z}_N|}$.
Now I look at $f'(x):=f(f(x))$. Is $f'$ a random function like $f$?

  • 0
    Here you define *random* as a property of a distribution on the space of functions $\Bbb Z_N \to \Bbb Z_N$, but then ask whether a particular function has this property. Do you mean to ask something like: "Consider the uniform distribution on the set $\mathcal F$ of functions $\Bbb Z_n \to \Bbb Z_n$. This determines another distribution on $\mathcal F$, where $g \in \mathcal F$ is weighted according to the number of $f \in \mathcal F$ for which $g = f \circ f$. Does this latter distribution on $\mathcal F$ coincide with the uniform distribution?"2017-02-20
  • 0
    If that interpretation is correct, then the answer is no. For example, if $g = f \circ f$ is a permutation (equivalently, if it is onto) then so is $f$. But for any permutation $f$, $f \circ f$ is even. Thus, the probability of an odd permutation $g$ is zero in the induced distribution, and hence that distribution cannot be uniform for any $N > 1$.2017-02-20
  • 0
    Also, working this out by hand for the special case $N = 2$ is short and may be instructive.2017-02-20

2 Answers 2

1

Here is one difference: $f(x)$ probably has around $N(1-1/e)$ different values. The chance a value never appears is $(1-1/N)^N\approx 1/e$

$f(f(x))$ probably has around $N(1-1/e)^2$ different values.

EDIT: Let $M=N/e$ be the number of 'orphans' that are not a value of $f(x)$.
Let $P=N-M$ be the number with parents.

The chance that a number has a parent but not a grandparent is the chance that at least one orphan, but none with parents, chose it, which would be

$$(1-1/N)^P(1-(1-1/N)^M)\approx e^{1/e-1}(1-e^{-1/e})$$

So I think $f(f(x))$ has about $N(1-e^{1/e}/e) \approx 0.4685 N$ different values.

0

Yes, because the value of $f(x)$ is irrelevant for the determination of $f(f(x))$