# Heisenberg uncertainty principle
Heisenberg uncertainty principle can be expressed as:
$$\Delta t \Delta f \geq B$$
where $\Delta t$ is the uncertainty in time, $\Delta f$ is the uncertainty in frequency, and $B$ is a constant that depends on the properties of the signal.
To derive the constant $B$, we can start by considering the time-frequency representation of a signal, which is given by the short-time Fourier transform (STFT) of the signal:
$$X(t,f) = \int_{-\infty}^{\infty} x(u) g(u-t) e^{-i 2 \pi f u} du$$
where $x(t)$ is the signal, $g(t)$ is the window function, and $f$ is the frequency. The STFT allows us to represent a signal in the time-frequency domain by decomposing it into a series of frequency-limited signals, each localized in time.
The uncertainty in time, $\Delta t$, is then given by the standard deviation of the time coordinate of the STFT:
$$\Delta t = \sqrt{\left\langle t^2 \right\rangle - \left\langle t \right\rangle^2}$$
where the brackets $\left\langle \cdot \right\rangle$ denote the expectation value of the enclosed quantity.
Similarly, the uncertainty in frequency, $\Delta f$, is given by the standard deviation of the frequency coordinate of the STFT:
$$\Delta f = \sqrt{\left\langle f^2 \right\rangle - \left\langle f \right\rangle^2}$$
Using these expressions, we can derive a lower bound on the product $\Delta t \Delta f$:
$$\Delta t \Delta f \geq \frac{\left| \left\langle [t,f] \right\rangle \right|}{2}$$
where $[t,f]$ is the commutator of $t$ and $f$.
To compute the commutator $[t,f]$, we can use the fact that the STFT is a unitary transform, which means that it preserves the inner product of the signal. This leads to the following relationship:
$$\left\langle x(t), x(t') \right\rangle = \left\langle X(t,f), X(t',f') \right\rangle$$
Expanding both sides of this equation and using the definition of the STFT, we get:
$$\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} x(t) x^(t') g(t-t_0) g^(t'-t_0) e^{-i 2 \pi f t} e^{i 2 \pi f' t'} dt' dt = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} X(t,f) X^*(t',f') e^{i 2 \pi f t} e^{-i 2 \pi f' t'} df' dt'$$
Next, we can take the derivative of both sides of this equation with respect to $t$ and $t'$, respectively, to get:
$$\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} -i 2 \pi f x(t) x^(t') g(t-t_0) g^(t'-t_0) e^{-i 2 \pi f t} e^{i 2 \pi f' t'} dt' dt = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} i 2 \pi f' X(t,f) X^*(t',f') e^{i 2 \pi f t} e^{-i 2 \pi f' t'} df' dt'$$
We can then rearrange this equation to get:
$$\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} (f'-f) x(t) x^(t') g(t-t_0) g^(t'-t_0) e^{-i 2 \pi f t} e^{i 2 \pi f' t'} dt' df' = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} (f'-f) X(t,f) X^*(t',f') e^{i 2 \pi f t} e^{-i 2 \pi f' t'} df' dt'$$
we can use the fact that the left hand side of the equation $\left\langle [t,f] \right\rangle = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} (f'-f) X(t,f) X^*(t',f') e^{i 2 \pi f t} e^{-i 2 \pi f' t'} df' dt'$ is equal to the right hand side to simplify this equation. Specifically, we can rewrite the left hand side as:
$$\left\langle [t,f] \right\rangle = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} (f'-f) x(t) x^(t') g(t-t_0) g^(t'-t_0) e^{-i 2 \pi f t} e^{i 2 \pi f' t'} dt' df'$$
$$= \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} (f'-f) x(t) x^(t') g(t-t_0) g^(t'-t_0) e^{i 2 \pi (f'-f) t} dt' df'$$
$$= \int_{-\infty}^{\infty} x(t) g(t-t_0) \int_{-\infty}^{\infty} (f'-f) x^(t') g^(t'-t_0) e^{i 2 \pi (f'-f) t} df' dt$$
$$= \int_{-\infty}^{\infty} x(t) g(t-t_0) \int_{-\infty}^{\infty} (f'-f) \int_{-\infty}^{\infty} x^(t') g^(t'-t_0) e^{i 2 \pi (f'-f) t} dt' df' dt$$
$$= \int_{-\infty}^{\infty} x(t) g(t-t_0) \int_{-\infty}^{\infty} (f'-f) \int_{-\infty}^{\infty} x^(t') g^(t'-t_0) e^{i 2 \pi (f'-f) t'} dt df' dt$$
$$= \int_{-\infty}^{\infty} x(t) g(t-t_0) \int_{-\infty}^{\infty} (f'-f) \int_{-\infty}^{\infty} x^(t') g^(t'-t_0) e^{i 2 \pi (f'-f) t'} df' dt$$