why is the second derivative written as $\frac {d^2 f}{dx^2}$ rather than $\frac {d^2f}{d^2x}$? Is there a good reason for this, or is it just a historical accident?
 A: With the current convention for writing derivatives, the differential operator (the symbol that says "differentiate whatever comes after me") is written as $\frac{d}{dx}$. When we take the second derivative we apply that a second time: $\frac{d}{dx}\frac{d}{dx}$. On the top, we have two $d$'s, while on the bottom we have two $dx$'s.
We often like to pretend that the $d$, the $dx$ and the fraction line are separate symbols that may be manipulated the way symbols commonly are in algebra. So using the "regular rules" for manipulating fractions, the second derivative operator becomes $\frac{d^2}{dx^2}$.
If you don't like operators, then the second derivative of $f$ is given by
$$
\frac{d\frac{df}{dx}}{dx}
$$
i.e. the derivative of the derivative. And, again by applying regular algebraic manipulation rules to this as though they were really fractions, we get $\frac{d^2f}{dx^2}$.
A: Notational convention. We write $\frac{d}{dx}\frac{d}{dx}= \frac{d^2}{dx^2}$ so the differential operator agrees with the intuition from basic algebra about powers and repeated symbols. If we wrote $\frac{d}{dx}\frac{d}{dx}= \frac{d^2}{d^2x}$ it wouldn't agree as well.
A: The first derivative is denoted by $$\frac {d}{dx}f$$
The derivative of the above is $$\frac {d}{dx}(\frac {d}{dx}f)$$ which is simplified to $$\frac {d^2f}{dx ^2}$$
Note that $(dx)(dx)=(dx)^2 $ is written as $dx^2$  which may seems confusing to some students.
