TITLE: Let $f :\mathbb{R}→ \mathbb{R}$ be a function such that $f^2$ and $f^3$ are differentiable. Is $f$ differentiable?
QUESTION [11 upvotes]: Let $f :\mathbb{R}→ \mathbb{R}$ be a function such that $f^2$ and $f^3$ are differentiable. Is $f$ differentiable?
Similarly, let $f :\mathbb{C}→ \mathbb{C}$ be a function such that $f^2$ and $f^3$ are analytic. Is $f$ analytic?

REPLY [4 votes]: If you do want $f^{p}$ to represent the $p^{\text{th}}$ iterate, then you can let $f$ denote the characteristic function of the irrational numbers.  Then $f^2$ and $f^3$ are both identically zero, yet $f$ is nowhere continuous, let alone differentiable.