Step 1: f commutes with cos. Composing f∘f=cos on the left and on the right by f:
f∘cos=f∘(f∘f)=(f∘f)∘f=cos∘f.
So f(cosx)=cos(f(x)) for every x∈R.
Step 2: f sends [−1,1] into [−1,1]. Since cos(R)=[−1,1], for y∈[−1,1] we have y=cosx for some x, hence y=f(f(x))∈f(R). Thus
f([−1,1])=f(cosR)=cos(f(R))⊆[−1,1].
Step 3: consider J=[cos1,1]. Since 0<cos1<1, the map cos is strictly decreasing on [0,1], hence on J⊆[0,1]. Moreover cos(J)⊆J: for x∈J, x≤1 gives cosx≥cos1, and x≥cos1≥0 gives cosx≤1. So cos maps J into J, strictly decreasing.
Step 4: f is injective on J. If x,y∈J and f(x)=f(y), then cosx=f(f(x))=f(f(y))=cosy. Since cos is injective on J, x=y. Hence f∣J is injective.
Step 5: contradiction if f is continuous. Suppose f continuous. Then f∣J is continuous and injective on the interval J, hence strictly monotonic on J.
- If f∣J is increasing, then for x<y in J: f(x)<f(y), so f(f(x))<f(f(y)), i.e. cosx<cosy. But cos is decreasing on J, so x<y⇒cosx>cosy — contradiction.
- If f∣J is decreasing, then for x<y: f(x)>f(y), so f(f(x))<f(f(y)), i.e. cosx<cosy. Again, cos decreasing on J gives cosx>cosy — contradiction.
So f cannot be continuous on J, hence f is not continuous on R.