Magnitude of function in $z$ domain
The $z$-transform can be evaluated at any point on the complex plane that is also in the ROC of the $z$-transform. To find the magnitude of $H(z)$, you can find the magnitude of numerator and denumerator separately, and then divide the results.

Let's say $H(z)=\frac{A(z)}{B(z)}$
So

$$|H(z)|=\frac{|A(z)|}{|B(z)|}$$
and let's assume $A(z)=z-a$ and $B(z)=z-b$ .
$$|A(z)|=|z-a|$$
Let $z=re^{j\phi}$. So
$$\begin{align}
|A(z)|&amp;=|re^{j\phi}-a|\\&amp;=|(r\cos(\phi)-a)+j r\sin(\phi)|\\
&amp;=\sqrt{(r\cos(\phi)-a)^2+r^2\sin^2(\phi)}\\
&amp;=\sqrt{r^2(\sin^2(\phi)+\cos^2(\phi))+a^2-2ar\cos(\phi)}\\
&amp;=\sqrt{r^2+a^2-2ar\cos(\phi)}
\end{align}$$
Similarly $$|B(z)|=\sqrt{r^2+b^2-2br\cos(\phi)}$$
and

$$|H(z)|=\frac{\sqrt{r^2+a^2-2ar\cos(\phi)}}{\sqrt{r^2+b^2-2br\cos(\phi)}}$$