# How can I get the center and radius of this circle?

I am able to make Mathematica plot the solution to a complex inequality as the interior or exterior of a circle :

Let $$a$$ be a positive real constant, and $$f(z) = \frac{z+1}{z-1}$$. I want to get the equation of the image of the disc $$D(a) = \{ z \in \mathbb X:\, \lvert z \rvert \le a\}$$ by $$f$$.

If $$a<1$$, its also a disc, located in the left half plane :

ComplexRegionPlot[Abs[(z + 1)/(z - 1)] <= 0.9, {z, 20}]


If $$a > 1$$, it's the complementary of a disc, located in the right half plane:

ComplexRegionPlot[Abs[(z + 1)/(z - 1)] <= 1.1, {z, 30}]


And if $$a=1$$, it's the full left half plane, which in a certain sense is also a disc.

How can I get the center and radius of this disc depending on the value of $$a$$ ?

Here's a one-liner for obtaining an implicit Cartesian equation:

circ = First[GroebnerBasis[ComplexExpand[Abs[(x + I y + 1)/(x + I y - 1)] == a,
TargetFunctions -> {Re, Im}], {x, y, a}]]
-1 + a^2 - 2 x - 2 a^2 x - x^2 + a^2 x^2 - y^2 + a^2 y^2


From here, we can use the technique from this answer:

vars = {x, y};
{cnst, lin, quad} = MapAt[Diagonal, Normal[CoefficientArrays[circ, vars]], {3}];
-1 + a^2 - (1 + a^2)^2/(-1 + a^2) +
(-1 + a^2) (-((2 + 2 a^2)/(2 (-1 + a^2))) + x)^2 - y^2 + a^2 y^2


Manual massaging of this result leads to the form

(x + (1 + a^2)/(1 - a^2))^2 + y^2 == (4 a^2)/(1 - a^2)^2


which means the result is a circle with center {(a^2 + 1)/(a^2 - 1), 0} and radius Abs[2 a/(1 - a^2)].

• This is very good. While running your second code chunk, I got an error: MapAt: Part {3} of {-1} does not exist. What can I do about it ? – lrnv Feb 18 at 18:36
• I had copied the code wrong; apologies. Please also make sure you copied depress[] from the answer I linked to. – J. M.'s torpor Feb 18 at 18:43

For concrete values of a this can be done as follows.

a=9/10;d = ImplicitRegion[ComplexExpand[Abs[(x + I y + 1)/(x + I y - 1)]] == a, {x, y}];
c = RegionCentroid[d]


{-(181/19), 0}

r=RegionDistance[d, c]


180/19

• The above code also works with decimals, e.g.a=0.009. – user64494 Feb 18 at 19:22
• If $a>1$, the general formula can be derived through Table[d = ImplicitRegion[ ComplexExpand[Abs[(x + I y + 1)/(x + I y - 1)]] == a, {x, y}]; c = RegionCentroid[d]; RegionDistance[d, c], {a, 2, 9}], a] /. a -> a - 1 which produces $\frac{2 a}{(a-1) (a+1)}$. – user64494 Feb 19 at 17:54
• This approach also works for arbitrary Moebius mappings. – user64494 Feb 19 at 17:59
• To prove that any Moebius map translates circles into circles it is enough to consider $\frac 1 z$ only. The general case is reduced to that case by division and changes. The Mathematica code ImplicitRegion[ComplexExpand[Abs[1/(x + I y)]] == a, {x, y}] results in ImplicitRegion[1/Sqrt[x^2 + y^2] == a, {x, y}], confirming the claim. – user64494 Feb 20 at 5:28

Something really cool I learned, but I cannot find the reference. Probably from one of the authors of Indra's Pearls...

There is a one-to-one correspondence between circles and Hermitian matrices of negative determinant. Thus, any circle may be represented by the Hermitian matrix

$$H = \left[ \begin{array}{cc} 1 & -p \\ -p^* & |p|^2-r^2 \end{array} \right]$$

where the complex number $$p$$ is the circle centre, and the real number $$r$$ is the circle radius.

The mapping of an input circle to an output circle is accomplished by $$G=(M^{-1})^{T*} \cdot H \cdot M^{-1}$$, where $$M=\{\{a,b\},\{c,d\}\}$$ in the Mobius transform. In component form,

$$G = \left[ \begin{array}{cc} d^* & -c^* \\ -b^* & a^* \end{array} \right] \cdot \left[ \begin{array}{cc} 1 & -p \\ -p^* & |p|^2-r^2 \end{array} \right] \cdot \left[ \begin{array}{cc} d & -b \\ -c & a \end{array} \right]$$

where the superscript $$*$$ indicates complex conjugation. The result is another Hermitian matrix

$$G = \left[ \begin{array}{cc} A & B \\ B^* & C \end{array} \right] = \left[ \begin{array}{cc} 1 & -q \\ -q^* & |q|^2-s^2 \end{array} \right]$$

corresponding to a new circle with centre $$q$$ and radius $$s$$.

MobiusMap finds the coefficients $$\{A,B,C\}$$ of the Hermitian matrix $$G$$, and forms the output circle from them. It has a special case when $$A=0$$, resulting in a line $$U x+V y+W=0$$. Ratios taken to form the output circle are independent of whether or not the mapping has unit determinant.

MobiusMap[m_?MatrixQ, Circle[{x_, y_}, r_]] :=
Block[{v = -x - I y, w = x^2 + y^2 - r^2, a, b, c},
a = Abs[m[[2, 2]]]^2 + Abs[m[[2, 1]]]^2 w -
2 Re[m[[2, 1]] Conjugate[m[[2, 2]]] v];
b = m[[1, 1]] (Conjugate[m[[2, 2]]] v - Conjugate[m[[2, 1]]] w) +
m[[1, 2]] (Conjugate[v*m[[2, 1]]] - Conjugate[m[[2, 2]]]);
c = Abs[m[[1, 2]]]^2 + Abs[m[[1, 1]]]^2 w -
2 Re[m[[1, 1]] Conjugate[m[[1, 2]]] v];
If[
Chop[N[a]] == 0.,
LineUVW[{Re[b], Im[b]}, c/2],
Circle[-{Re[b], Im[b]}/a, Sqrt[b*Conjugate[b] - a*c]/Abs[a]]]
]


Your mapping is $$M=\{\{1,1\},\{1,-1\}\}$$. The Hermitian matrix corresponding to the mapped circle is $$G=\{\{1 - r^2, 1 + r^2\}, \{1 + r^2, 1 - r^2\}\}$$. Thus, the centre $$q=-\{Re[B],Im[B]\}/A=\frac{r^2+1}{r^2-1}$$, and the radius $$s=\frac{2r}{Abs[1-r^2]}$$.

Manipulate[
Module[{circle, q, s},
circle = MobiusMap[{{1, 1}, {1, -1}}, Circle[{0, 0}, r]];
q = circle[[1]];
s = circle[[2]];
Graphics[{Thick, PointSize[0.015],
Circle[{0, 0}, r], Point[{0, 0}],
Red, circle, Point[q]
}, GridLines -> Automatic, Frame -> True,
PlotLabel -> "Centre q: "<>ToString[q]<>"    Radius s: "<>ToString[s]]],
{{r, 0.9, "Radius r"}, 0., 2., Appearance -> "Labeled"}]


• +1. Nice. How about higher dimensions? – user64494 Feb 20 at 7:03
• @user64494 Sorry, no clue. Do you have a reference about what you envision higher dimensions should produce? – KennyColnago Feb 21 at 22:10
• This is really neat. I wrote something like your MobiusMap[] here. – J. M.'s torpor Feb 25 at 6:41