Representation of $n$-th derivative. The derivative of a function $y = f(x)$ with respect to $x$ is represented as $\frac{dy}{dx}$
The second derivative is represented as  $\frac{d^2y}{dx^2}$ and so on.
Why is it used like this?
 A: The second derivative is the derivative of the derivative, so strictly speaking it is actually
$$
\frac{d\frac{dy}{dx}}{dx}
$$
Standard fraction simplification rules applied to this expression (even though it's not really a fraction) yields
$$
\frac{d^2y}{(dx)^2}
$$
If we, for simplicity, interpret $dx$ as a single symbol rather than a $d$ and an $x$ separate, the parenthesis in the denominator may be elided, and we're left with
$$
\frac{d^2y}{dx^2}
$$

Alternatively, the symbol $\frac{d}{dx}$ denotes the operation "take the derivative with respect to $x$". The second derivative is to apply this operation twice, which is to say
$$
\left(\frac d{dx}\right)^2
$$
Again, similar simplifications as above lead us ultimately to the operation "take the second derivative" to be represented by the symbol
$$
\frac{d^2}{dx^2}
$$
and applying it to the function $y$ we write as
$$
\frac{d^2y}{dx^2}
$$
A: Symbols like $f(x)$ are used to denote the 'output' of a function $f$.  The '$f$' is a rule that assigns a number $f(x)$ to an 'input' $x$.  The rule is arbitrary, but generally given for a specific problem.
Symbols like $\frac{d}{dx}[f(x)]$ are used to denote the 'output' of a derivative operation $\frac{d}{dx}$.  The '$\frac{d}{dx}$' is a rule that assigns a function $f'(x)=\frac{d}{dx}[f(x)]$ to an input $f(x)$.  The rule is arbitrary, but generally given for a specific function.
So when you iterate a function, (compose the function with itself), it's notation is $f^2(x)=(f\circ f)(x)$.  Taking a second derivative yields the same notation
$$\left(\frac{d}{dx}\right)^2[f(x)]=\frac{d}{dx}\left[{\frac{d}{dx}}[f(x)]\right]=\frac{d^2}{dx^2}[f(x)]$$
You can extend this for $n$th order derivatives.
