Jensen's Formula and the number of zeros. I am doing a question that requires me to find the number of zeros in a disk when $f$ is non-constant, bounded and analytic on $D$. I saw that the Wikipedia page of Jensen's formula has the following information:
Jensen's formula can be used to estimate the number of zeros of analytic function in a circle. Namely, if f is a function analytic in a disk of radius R centered at $z_0$ and if |f| is bounded by M on the boundary of that disk, then the number of zeros of f in a circle of radius r < R centered at the same point $z_0$ does not exceed

Does anyone know how this formula is derived?

Lemma:
For an analytic $f$ with no zeros on $|z|=r$ and whose zeros inside $|z|=r$ are located at $\left\{\alpha_k\right\}_{k=1}^n$ with multiplicities, define
$$
g(z)=f(z)\prod_{k=1}^n\frac{r^2-\bar\alpha_kz}{r(z-\alpha_k)}\tag1
$$
Then $|g(z)|=|f(z)|$ when $|z|=r$ and $g$ has no zeros in $|z|\le r$.
Proof:
The factors of $z-\alpha_k$ remove the zeros inside $|z|=r$, so $g$ has no zeros for $|z|\le r$.
If $|z|=r$, then
$$
\begin{align}
\left|\frac{r^2-\bar\alpha z}{r(z-\alpha)}\right|
&=\left|\frac{\bar z}r\frac{r^2-\bar\alpha z}{r(z-\alpha)}\right|\tag{2a}\\
&=\left|\frac{\bar zr^2-\bar\alpha|z|^2}{r^2(z-\alpha)}\right|\tag{2b}\\
&=\left|\frac{r^2(\bar z-\bar\alpha)}{r^2(z-\alpha)}\right|\tag{2c}\\[6pt]
&=1\tag{2d}
\end{align}
$$
Explanation:
$\text{(2a)}$: $|\bar z|=|z|=r$
$\text{(2b)}$: distribute $\bar z$ over the denominator
$\text{(2c)}$: collect the factors of $|z|^2=r^2$
$\text{(2d)}$: $|\bar z-\bar\alpha|=|z-\alpha|$
Thus, $\prod\limits_{k=1}^n\frac{r^2-\bar\alpha_kz}{r(z-\alpha_k)}$ has absolute value $1$ when $|z|=r$; and therefore, $|g(z)|=|f(z)|$ when $|z|=r$.
$\large\square$

Jensen's Formula
Taking the average over $|z|=r$ gives
$$
\begin{align}
\frac1{2\pi}\int_0^{2\pi}\log\left|f\!\left(re^{i\theta}\right)\right|\,\mathrm{d}\theta
&=\frac1{2\pi}\int_0^{2\pi}\log\left|g\!\left(re^{i\theta}\right)\right|\,\mathrm{d}\theta\tag{3a}\\
&=\log|g(0)|\tag{3b}\\
&=\log|f(0)|+\sum_{k=1}^n\left(\log(r)-\log|\alpha_k|\right)\tag{3c}
\end{align}
$$
Explanation:
$\text{(3a)}$: the Lemma says $|g(z)|=|f(z)|$ when $|z|=r$
$\text{(3b)}$: the Lemma implies that $\log|g(z)|$ is harmonic for $|z|\le r$
$\text{(3c)}$: take the log of the absolute value of $(1)$ at $z=0$
$(3)$ is Jensen's Formula

Counting Zeros
If we know that all the zeros are inside $|z|=r$ and we know the average of $\log|f|$ on $|z|=R$,
$$
\begin{align}
\frac1{2\pi}\int_0^{2\pi}\log\left|f\!\left(Re^{i\theta}\right)\right|\,\mathrm{d}\theta-\log|f(0)|
&=\sum_{k=1}^n\left(\log(R)-\log|\alpha_k|\right)\tag{4a}\\
&\ge n(\log(R)-\log(r))\tag{4b}
\end{align}
$$
So we have that
$$
n\le\frac1{\log(R)-\log(r)}\left(\frac1{2\pi}\int_0^{2\pi}\log\left|f\!\left(Re^{i\theta}\right)\right|\,\mathrm{d}\theta-\log|f(0)|\right)\tag5
$$
