Solution (source code)

= Solution

A <Möbius transformation> maps generalized <circles> to generalized <circles> on the <Riemann sphere>. A <generalized circle> is an ordinary <circle> or a <straight line> together with the point at infinity. Its <image> is a <straight line> precisely when it contains infinity, equivalently when the <preimage> of infinity lies on the extended real axis.

If $c=0$, the pole is infinity itself and the transformation is the <affine map> $(a/d)z+b/d$, taking the extended real axis to a line. If $c\neq0$, the pole is $-d/c$, which is real exactly when $d/c$ is real. Thus the full condition is
$$
\boxed{c=0\quad\text{or}\quad c\neq0\text{ and }d/c\in\mathbb R.}
$$
Equivalently, it is $\operatorname{Im}(d\bar c)=0$, a condition also valid when $c=0$. If it fails, the <image> misses infinity and is therefore \b[an ordinary <circle>]. The nonzero <determinant> ensures that none of these generalized <circles> collapses to a point.