Let $f :\mathbb{R}→ \mathbb{R}$ be a function such that $f^2$ and $f^3$ are differentiable. Is $f$ differentiable? 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?
 A: 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.
A: In short: not necessarily in the real case, but yes in the complex case.
In the real case like in the complex one, $f$ is differentiable whenever it does not vanish and
$$
f'=\left(\frac{f^3}{f^2}\right)'=\frac{(f^3)'f^2-f^3(f^2)'}{f^4}.
$$
Real case: if $f$ vanishes, it no longer needs to be differentiable. For an alternative example to $f(x)=|x|$, observe that
$$
f(x)=x\sin\left(\frac{1}{x}\right)\quad \forall x\neq 0\qquad f(0)=0
$$
is not differentiable at $0$, while $f^2$ and $f^3$ are differentiable everywhere. 
Complex case: the zeros of $f^2$ and those of $f$ coincide. If $f$ is constant equal to $0$, the result is clear. Otherwise, its zeros are isolated since $f^2$ is holomorphic non constant equal to $0$. On the open set which is the complement of these zeros, the argument above shows that $f$ is holomorphic. And $f^2$, whence $f$, is bounded near each zero. So these are removable singularities. Hence $f$ is holomorphic on its domain.
Edit: for a different argument, see this thread.
Note: if you replace the assumptions by $f^2$ (or $f^n$, $n\geq 2$, more generally) differentiable and $f$ continuous, you get the same conclusions in both cases. Indeed, where $f(x_0)\neq 0$, we have
$$
\frac{f(x)-f(x_0)}{x-x_0}=\frac{f^2(x)-f^2(x_0)}{x-x_0}\cdot\frac{1}{f(x)+f(x_0)}\longrightarrow \frac{(f^2)'(x_0)}{2f(x_0)}.
$$
But if you remove the continuity assumption on $f$, the complex case can fail as well. Just pick a random square root of $z$.
