Solution (source code)

= Solution

Treat a straight line together with infinity as a <generalized circle> on the <Riemann sphere>. Its finite points have a real equation
$$
A|z|^2+Bz+\overline B\,\overline z+C=0,\qquad A,C\in\mathbb R.
$$
Translations and nonzero complex scalings preserve circles and lines. Under $z=1/w$, multiplying the equation by $|w|^2$ gives
$$
C|w|^2+\overline B w+B\overline w+A=0,
$$
again the equation of a circle or line. Nondegeneracy is preserved because the reciprocal map is a bijection of the sphere. The zero and infinite points are interpreted there, rather than discarded when multiplying denominators.

Every Möbius map with $c\ne0$ factors as
$$
\frac{az+b}{cz+d}=\frac ac+\frac{bc-ad}{c^2}\frac1{z+d/c};
$$
if $c=0$ it is already affine. Thus <Möbius translation-scaling-inversion factorization> and the <reciprocal transformation of a generalized circle> prove \b[every generalized circle maps to another generalized circle]. A circle becomes a line exactly when its image contains infinity, that is, when the original circle contains the map's pole.