How is the symbol error rate for M-QAM, 4QAM,16QAM and 32QAM derived?
In $2^{2n}$-QAM with a square constellation, there are $4$ "corner" points and
$4(2^n-2)$ "edge" points, and $(2^n-2)^2$ "interior" points.  The conditional
symbol error probabilities given that each type of point is transmitted,
are
$$\begin{align}
P_e(\text{corner}) &amp;= 2Q(x) - Q^2(x)\\
P_e(\text{edge}) &amp;= 3Q(x) - 2Q^2(x)\\
P_e(\text{interior}) &amp;= 4Q(x) - 4Q^2(x)\\
\end{align}$$
where $Q(x)$ is the complementary cumulative probability distribution function
of the standard Gaussian random variable. Combining these using the law of
total probability (with the assumption that all $2^{2n}$ signals are equally 
likely) gives
$$P_e\left(2^{2n}\text{-QAM}\right) = 4 \left[1 - 2^{-n}\right]Q(x) 
- 4\left[1 - 2^{-n}\right]^2Q^2(x)$$
For $4$-QAM, where $n = 1$, this reduces to
$P_e(4\text{-QAM}) = 2Q(x) - Q^2(x)$. For more details, see, for
example, pp. 147-153 of this ancient lecture note  that I once wrote.