Let $y = f(x)$.
$$f'' = \frac{d^2y}{dx^2}$$
The explanation for this being that
$$ \Bigl(\dfrac{d}{dx}\Bigr)^2 y = \dfrac{d^2}{dx^2}\,y = \dfrac{d^2 y}{dx^2};$$
Since there are two $d$'s in the bottom of the fraction, why is it not written
$$\frac{d^2y}{d^2x^2}$$
Maybe it's because $dx$ needs to be thought of as a single thing. But notice that $d$ is used by itself and squared in the numerator..
Does my point here make sense, is it just a convenience to avoid the extra exponent, or is there a logical reason it's written in the form it is?