Is quantum mechanics based on the uncertainty principle? Or opposite? Is the whole quantum mechanics framework based upon the uncertainty principle? Or is the uncertainty principle just a principle that states that there always will be uncertainty BECUASE of the laws of quantum mechanics? For example collapses of superpositions, and a random state will be spawned?
 A: The uncertainty principle is a consequence of non-commuting observables in quantum mechanics. Let's gloss over the general features of QM, and see what this statement means.
The framework of QM involves a Hilbert space, states that live in it, and operators, some of which can be interpreted as measurements whose outcomes we call observations. Let's consider two such hermitian operators, $A$ and $B$. What is the variance in each of these?
$$
\begin{align}
\sigma^2_A &= \langle(A-\langle A\rangle)^2\rangle\\
&=\langle\Psi|(A-\langle A\rangle)^2\Psi\rangle\\
&=\langle(A-\langle A\rangle)\Psi|(A-\langle A\rangle)\Psi\rangle\\
&=\langle f|f\rangle
\end{align}
$$
Similarly we write $\sigma_B^2=\langle g|g\rangle$. Now by the Schwartz inequality we have that
$$
\begin{align}
\sigma_A\sigma_B &= \sqrt{\langle f|f\rangle\langle g|g\rangle}\\
&\ge|\langle f|g\rangle|\\
&\ge\mathcal Im\langle f|g\rangle\\
&=\frac{1}{2i}\left(\langle f|g\rangle-\langle g|f\rangle\right)
\end{align}
$$
Plugging back in our expressions for $f$ and $g$ we arrive at
$$
\sigma_A\sigma_B\ge\frac{1}{2i}\langle[A,B]\rangle
$$
where we have introduced the commutator, $[A,B]=AB-BA$. This is the uncertainty principle in its most general form. We see that it comes down to the observables not commuting with one another. For the case of momentum and position, we have that $[p,x]=i\hbar$, so the uncertainty principle reads
$$
\sigma_p\sigma_x\ge\frac{\hbar}{2}
$$
Hope that helps!
