# Equations defining hyperbolic geodesics in $\mathbb C \setminus\{0,1\}$

Let $$X=\mathbb C\setminus\{0,1\}$$, equipped with the hyperbolic structure it inherits from Klein's modular $$\lambda$$ function $$\lambda:\mathbb H \to X$$. In each (non-peripheral and nontrivial) free-homotopy class of loop $$S^1\to X$$, there is a unique hyperbolic representative. For example, the figure-eight curve $$\alpha$$ with winding number $$+1$$ around $$1$$ and $$-1$$ around $$0$$, pictured below, has a unique hyperbolic geodesic representative. In fact, the curve drawn in the above linked picture is precisely the path traced by the hyperbolic geodesic representative of $$\alpha$$, which is given by the lemniscate with equation $$16(x^2+y^2)((x-1)^2+y^2)=1.$$

Proof sketch: The conformal transformation $$w(z)=(2z-1)^2$$ is an orbifold covering map from $$X$$ to a hyperbolic orbifold $$Y$$, where $$Y$$ is $$\mathbb C \setminus\{1\}$$ with a single orbifold point at $$0$$ with angle $$\pi$$. The geodesic representative of $$\alpha$$ projects to a geodesic $$\eta$$ that begins on the orbifold point, travels once counterclockwise around $$1$$ and hits the orbifold point, then travels once clockwise around $$1$$ before finishing again at the orbifold point. The anticonformal automorphism $$w\mapsto \frac {\bar{w}}{\bar{w}-1}$$ is an orientation-reversing isometry of $$Y$$ that preserves the homotopy class of $$\eta$$, so it's not hard to see that $$\eta$$ must have image given by the fixed-point set of this isometry, namely $$|w-1|^2=1$$. Putting the pieces together, we find that the points in the image of the geodesic representative of $$\alpha$$ satisfy $$|(2z-1)^2-1|^2=1$$, which simplifies to the equation above.

Question: Are all closed hyperbolic geodesics on $$X$$ algebraic curves?

I admit that it is a bit rash to ask the question in this way — one could more modestly ask which hyperbolic geodesics have polynomial defining equations — but I do want to emphasize that I am not aware of any negative results about the defining equations (the other two figure-eight curves are easy to work out as above). Of course, it's possible that the lemniscate equation arises as some low-dimensional accident due to the special symmetry present in the figure-eight curve, but it also seems entirely plausible that all hyperbolic geodesics on $$X$$ are somehow very convenient from the viewpoint of the canonical complex coordinate of $$X$$.

I've tried just looking at other examples using Mathematica to see if I might guess some equation for them (Mathematica's built-in ModularLambda function makes it easy to draw hyperbolic geodesics on $$X$$), but perhaps I am not fluent enough in solution sets of rational equations in the plane to make anything work.

1. I've tagged this question with "modular forms", because one could think of the above polynomial equation as a polynomial identity relating the real and imaginary parts of the modular function $$\lambda$$ along the hyperbolic geodesics in $$\mathbb H$$ that project to closed curves.

2. There is an obvious analogy with this very recent MathOverflow question, which is a knot theory version of the same idea.

• Should your question be: "ARE all CLOSED hyperbolic geodesics algebraic curves?" – Alexandre Eremenko Nov 1 '20 at 14:52
• Yes, that's right. Thanks for the suggestion! I agree that your wording is better (and what I meant), and I hope you don't mind that I've incorporated it into the question. – Jonah Gaster Nov 1 '20 at 16:34

I wondered this myself, I made some similar pictures to approximate the stable lamination of a pseudo-Anosov map (the blue curve is a geodesic, the other colors horocycles). Every geodesic on the modular orbifold (or $$\mathbb{H}^2/\Gamma(2)$$ that you're considering) is fixed by a hyperbolic element $$A\in \Gamma(2) < PSL_2(\mathbb{Z}), |tr(A) |> 2$$ (note: I’m writing matrix representatives in $$GL$$ of representatives in $$PGL$$).

Then the matrix $$A'=2A-tr(A)I \in PGL_2(\mathbb{Q})$$ is a matrix in the commensurator fixing the geodesic fixed by $$A$$ ($$tr(A')=0, det(A')<0$$).

One interesting analogy to make is that if $$B\in PGL_2(\mathbb{Q})$$ is an elliptic involution, so $$tr(B)=0, det(B)>0$$, then the fixed points $$b,\overline{b} \in \mathbb{C}-\mathbb{R}$$ of $$B$$ in the upper and lower half hyperbolic planes are quadratic imaginary points. Hence $$\lambda(b)$$ is an algebraic number by the Kronecker Jungendtraum, lying in an abelian extension of the quadratic imaginary number field generated by that point (this can be seen by the relation between $$\lambda$$ and $$j$$).

I think this extends to your case. Consider $$\Gamma(2)\cap A'\Gamma(2)(A')^{-1}$$, then this is a finite-index subgroup of $$\Gamma(2)$$. In turn this gives a finite étale congruence cover which is an algebraic curve $$C$$ (see the Belyi Theorem). Then $$A'$$ lifts to an anti-holomorphic involution of $$C$$, and hence the fixed set should be a real-algebraic subset of this curve with a component projecting to the geodesic fixed by $$A$$. Projecting down to $$\mathbb{H}^2/\Gamma(2) = \mathbb{C}-\{0,1\}$$, I think the image downstairs should also be a component of a real algebraic curve containing the desired geodesic. However, it seems to me that a priori there could be other components (as immersed curves).

• You seem to be right and I made a mistake. Suppose we have two automorphic (Fuchsian) functions $f$ and $g$ with respect to two different groups. If they are algebraically dependent $F(f,g)=0$ for some polynomial, what is the relation between the groups? I thought they are "commensurable" in my sense, but they are commensurable in your sense. – Alexandre Eremenko Nov 4 '20 at 3:23
• Why is $A'\Gamma(2)A'$ a finite index subgroup of $\Gamma(2)$ ? Should not you write $(A')^{-1}\Gamma(2)A'$? The determinant of your $A'$ is not 1. If you normalize it, it will not be in $SL(2,Q)$. – Alexandre Eremenko Nov 4 '20 at 14:49
• @AlexandreEremenko Sorry, you’re right, I was thinking of this intersection as occurring in $PGL$, but it’s confusing as written. – Ian Agol Nov 4 '20 at 14:52
• I still think it works, but I’ll try to add more details later when I get a chance. – Ian Agol Nov 4 '20 at 15:05
• Of course, now I wonder the obvious next question: how precisely can the equations be determined in terms of the data of the geodesic? How do the equations depend on geometric properties of the curve? Lots to ponder here! For instance, are these quantities determined by the degree of the cover $C\rightarrow X$? – Jonah Gaster Nov 5 '20 at 22:13

$$\def\CC{\mathbb{C}}\def\HH{\mathbb{H}}\def\ZZ{\mathbb{Z}}\def\RR{\mathbb{R}}\def\Id{\mathrm{Id}}$$These geodesics are always algebraic. We can understand their equations using the classical modular curve.

Let $$PGL_2(\RR)$$ act on $$\CC$$ in the usual way by Mobius transformations. Note that matrices of positive determinant take the upper half plane to itself, where as matrices of negative determinant switch the upper and lower half planes. We write $$\HH$$ for the upper half plane. Note also that the action of $$PGL_2(\RR)$$ commutes with complex conjugation.

Let $$A \in GL_2(\RR)$$ be a hyperbolic element, there is a unique geodesic through its fixed points. Let $$R = A - \tfrac{Tr\ A}{2} \Id$$. The geodesic through the fixed points of $$A$$ can be described as $$\{ z : Rz = \bar{z} \}$$. For example, let $$A = \left[ \begin{smallmatrix} 1&2 \\ 0&1 \end{smallmatrix} \right]\left[ \begin{smallmatrix} 1&0 \\ 2&1 \end{smallmatrix} \right] = \left[ \begin{smallmatrix} 5&2 \\ 2&1 \end{smallmatrix} \right]$$, this should give the lemniscate. Then $$R = \left[ \begin{smallmatrix} 2&2 \\ 2&-2 \end{smallmatrix} \right]$$. It is convenient to replace $$R$$ by $$R/2$$, since we are working with $$PGL_2$$ anyway; let $$S = R/2 = \left[ \begin{smallmatrix} 1&1 \\ 1&-1 \end{smallmatrix} \right]$$. The set $$\{ S z = \bar{z} \}$$ can be described explicitly as the circle of radius $$\sqrt{2}$$ around $$1$$.

Let $$\Gamma(2)$$ be the group of integer matrices with determinant $$1$$ which are $$\Id \bmod 2$$, and let $$P\Gamma(2)$$ be the quotient of $$\Gamma(2)$$ by the central subgroup $$\pm \Id$$. We can identify the quotient $$P\Gamma(2) \backslash \HH$$ with $$\CC \setminus \{0, 1 \}$$ by sending $$z \in \HH$$ to $$\lambda(z)$$ in $$\CC \setminus \{0, 1 \}$$, where $$\lambda$$ is the modular lambda function.

Note that, if $$A \in \Gamma(2)$$ then $$Tr\ A \equiv 2 \bmod 4$$, which shows that all the entries in $$A - \tfrac{Tr\ A}{2} \Id$$ are even integers, so we will always be able to factor out a $$2$$ as we did above. More generally, let's write $$A - \tfrac{Tr\ A}{2} \Id = k S$$ where $$k \in \ZZ$$ and $$S$$ is an integer matrix whose entries have no common factor. Note that we will always have $$S^2 = D \Id$$ for some $$D > 0$$, and $$\det S = -D$$. The cokernel of $$S$$ will be a cyclic group of order $$D$$. (Cyclic because we took out common factors of the entries of $$R$$.) So, our general problem is to find an equation for $$\{ \lambda(z) : S z = \bar{z} \}$$.

Now, consider the elliptic curves $$E_1 = \CC/\langle 1, z \rangle$$ and $$E_2 = \CC / \langle 1, Sz \rangle$$. The matrix $$S$$ gives a degree $$D$$ cyclic isogeny from $$E_1$$ to $$E_2$$. This means that the $$j$$-invariants of $$E_1$$ and $$E_2$$ must obey the classical modular equation $$\Phi_D(j_1, j_2)=0$$. But, since $$Sz = \bar{z}$$, we have $$j_2 = \bar{j_1}$$. So $$\Phi_D(j_1, \bar{j_1})=0$$.

Take the equation $$\Phi_D(j, \bar{j})=0$$ and substitute $$j = \tfrac{256 (1-\lambda+\lambda^2)^3}{\lambda^2 (1-\lambda)^2}$$. This gives a polynomial equation $$\Psi_D(\lambda, \bar{\lambda})=0$$. This will probably be reducible, but at least it will contain the geodesic.

I carried this out for the lemniscate. The curve $$\Phi_2(j_1, j_2)$$ is given by the equation: $$-157464000000000 + 8748000000 j_1 - 162000 j_1^2 + j_1^3 + 8748000000 j_2 + 40773375 j_1 j_2 + 1488 j_1^2 j_2 - 162000 j_2^2 + 1488 j_1 j_2^2 - j_1^2 j_2^2 + j_2^3=0$$ I made the substitution $$j_r = \tfrac{256 (1-\lambda_r+\lambda_r^2)^3}{\lambda_r^2 (1-\lambda_r)^2}$$, cleared out denominators, and put $$\lambda_1 = x+iy$$ and $$\lambda_2 = x - i y$$. The resulting polynomial factored in $$\CC[x,y]$$ into $$9$$ irreducible polynomials: $$3$$ defined over $$\RR$$ and $$3$$ complex conjugate pairs. The three real factors were $$-16 + 32 x - 16 x^2 + x^4 - 16 y^2 + 2 x^2 y^2 + y^4=0$$ $$1 - 4 x - 10 x^2 - 4 x^3 + x^4 - 14 y^2 - 4 x y^2 + 2 x^2 y^2 + y^4=0$$ $$-1 + 16 x^2 - 32 x^3 + 16 x^4 + 16 y^2 - 32 x y^2 + 32 x^2 y^2 + 16 y^4=0.$$ Here they are plotted, with black dots at $$0$$ and $$1$$: The third one is the lemniscate. I am guessing the others correspond to $$(A,S) = \left( \left[ \begin{smallmatrix} 3&4 \\ 2&3 \end{smallmatrix} \right],\ \left[ \begin{smallmatrix} 0&2\\1&0\end{smallmatrix} \right] \right)$$ and $$(A,S) = \left( \left[ \begin{smallmatrix} 3&2 \\ 4&3 \end{smallmatrix} \right],\ \left[ \begin{smallmatrix} 0&1\\2&0\end{smallmatrix} \right] \right)$$.

I have some ideas about when two matrices $$S_1$$ and $$S_2$$ would lie on same factor of $$\Psi_D$$, but they aren't finished. However, let me point out an example which I expect to be interesting. Consider $$A_1 = \begin{bmatrix} 11&60\\2&11\\ \end{bmatrix} \qquad A_2 = \begin{bmatrix} 11&-4\\-30&11\\ \end{bmatrix}$$ giving $$S_1 = \begin{bmatrix} 0&30 \\ 1&0 \end{bmatrix} \qquad S_2 =\begin{bmatrix} 0&-2 \\ -15 & 0 \\ \end{bmatrix}.$$ Using the class group of $$\ZZ[\sqrt{30}]$$, I have checked that $$A_1$$ and $$A_2$$ are not conjugate, so these should be distinct geodesics. However, $$S_1$$ and $$S_2$$ are $$2$$-adically very close. I predict that both of these geodesics occur as components of the same irreducible factor of $$\Psi_{30}(x+iy, x-iy)$$.

Another similar choice, with larger trace but smaller $$D$$, would be $$(A_1, S_1) = \left( \left[ \begin{smallmatrix} 19 & 60 \\ 6 & 19 \\ \end{smallmatrix} \right],\ \left[ \begin{smallmatrix} 0 & 10 \\ 1 & 0 \\ \end{smallmatrix} \right] \right)$$ and $$(A_2, S_2) = \left( \left[ \begin{smallmatrix} 19 & 12 \\ 30 & 19 \\ \end{smallmatrix} \right],\ \left[ \begin{smallmatrix} 0 & 2 \\ 5 & 0 \\ \end{smallmatrix} \right] \right)$$.

• @IanAgol The irreducible components are the same before and after substituting $\lambda_1 = x+iy$ and $\lambda_2 = x - i y$. So it's the same as asking for irreducible components of $X(2) \times_{X(1) } X_0(D) \times_{X(1) } X_0(D)$. For $D$ odd there are $6$ components, associated to elements of $GL_3(\mathbb F_2)$, complex conjugation acts by inversion and so leaves $4$ fixed, and these $4$ real components should form two distinct equivalence classes under the symmetries which as far as I can see act by conjugation. – Will Sawin Nov 7 '20 at 2:01
• For $D$ even, there are $9$ components, corresponding to two choices of a one-dimensional subspace of $\mathbb F_2^2$, and complex conjugation fixes three, which should always be related by these symmetries (automorphisms of $\mathbb F_2^2$). – Will Sawin Nov 7 '20 at 2:02
• @მამუკაჯიბლაძე No, and $\lim_{y \to 0^{+}} \lambda(x+iy)$ doesn't even exist for $x$ a quadratic irrational. For example, as we follow the geodesic $1+\sqrt{2} e^{i \theta}$ for $\theta \to 0^+$, the curve $\lambda(1+\sqrt{2} e^{i \theta})$ wraps around the lemniscate infinitely many times. To see that the limit can't exist, tile the plane with fundamental domains for $\Gamma(2)$, and note that any neighborhood of an irrational $x$ contains a complete domain. – David E Speyer Nov 7 '20 at 11:41
• @DavidESpeyer: The map $X_0(10) -> X_0(2)$ is a rational function, which I imagine ought to be computable. The fixed set of the reflection $R$ acting on $X_0(10)$ then will be a circle. So one wants to find the algebraic equation for the image of this circle under this rational map. I realize to compute such things, one uses resultants, and maybe this is where the computational bottleneck is. But there are numerical tools for such computations, such as Verschelde's homotopy continuation method. arxiv.org/abs/1909.04984 – Ian Agol Nov 13 '20 at 19:17
• @IanAgol That might be a good idea. Remember that we will then also have to pull back from $X_0(2)$ to $X(2)$ and factor the result. – David E Speyer Nov 14 '20 at 14:12

Let me rephrase the proof of @Ian Agol as I understand it. Let $$\Gamma(2)$$ be the congruence subgroup of level $$2$$ (it consists of all $$2\times 2$$ integer matrices $$A$$ with $${\mathrm{det}\, }A=1$$ and $$A\equiv I\; (\mathrm{mod}\; 2)$$.

Each $$A=(a_{ij})\in\Gamma(2)$$ with $$|{\mathrm{tr}\, }A|>2$$ defines the geodesic by the rule: let $$\gamma$$ be the circle orthogonal to the real axis, and passing through the fixed points of the linear-fractional transformation $$z\mapsto (a_{11}z+a_{12})(a_{21}z+a_{22})$$. Then $$\lambda(\gamma)$$ is a closed geodesic and they are all obtained in this way. Here $$\lambda:H\to C\backslash\{0,1\}$$ is the universal covering automorphic with respect to $$\Gamma(2)$$. Here $$H$$ is the upper half-plane.

Reflection in $$\gamma$$ is given by the matrix $$B=2A-({\mathrm{tr}\, }A)I$$: $$z\mapsto \sigma(z):= \frac{b_{11}\overline{z}+b_{12}}{b_{21}\overline{z}+b_{22}},\quad B=(b_{ij}).$$ Consider the group $$\Gamma'=B^{-1}\Gamma(2)B=d^{-1}B'\Gamma(2)B,$$ where $$d={\mathrm{det}\, }B$$ and $$B'B=dI$$.

Claim. $$\Gamma_0:=\Gamma'\cap\Gamma(2)$$ is of finite index in both $$\Gamma'$$ and $$\Gamma(2)$$.

Proof. If $$C\in\Gamma(2d)=\{ A\in\Gamma(2):A\equiv I\; (\mathrm{mod}\; 2d)\}$$, then $$E=d^{-1}BCB'$$ is in $$\Gamma(2)$$, so $$C=B^{-1}EB\in\Gamma'$$. So both groups contain $$\Gamma(2d)$$ with finite index.

Now let $$\lambda$$ be the modular function, $$\lambda:H\to C\backslash\{0,1\}$$, is it invariant under $$\Gamma(2)$$, and let $$\mu(z)=\overline{\lambda(\sigma(z))}$$, which is invariant with respect to $$\Gamma'$$. Let $$X:=H/\Gamma_0$$. Then $$X$$ is a Riemann surface of finite type whose only boundary elements are punctures, and both $$\lambda,\mu$$ are meromorphic functions on it. It is easy to see that their singularities at the punctures are at most poles, therefore they are algebraically dependent. So we have a polynomial identity $$F(\lambda,\mu)=0$$ which holds in $$H$$.

Now notice that for $$z\in\gamma$$ we have $$\lambda(z)=\overline{\mu(z)}$$ therefore $$(\lambda+\mu)/2={\mathrm{Re}\, }\lambda(z)$$ and $$(\lambda+\mu)/(2i)={\mathrm{Im}\, }\lambda(z),\; z\in\gamma$$. By the uniqueness theorem this implies that there is a polynomial equation $$G({\mathrm{Re}\, }\lambda,{\mathrm{Im}\, }\lambda)=0$$ which holds for $$z\in\gamma$$.

Remark. Except in the two trivial examples, when $$\Gamma'\cap\Gamma(2)\in SL(2,Z)$$, the degree of this polynomial seems to be very large, so it does not help in plotting the geodesics, while they can be easily plotted directly by using an explicit expression for $$\lambda$$.

• These groups will always be commensurable: the commensurator of $PSL_2(\mathbb{Z})$ is $PGL_2(\mathbb{Q})$. One can check that any hyperbolic element in $PSL_2(\mathbb{Z})$ commutes with a reflection in $PGL_2(\mathbb{Q})$. – Ian Agol Nov 2 '20 at 23:56
• Sure, for a matrix $A \in SL_2$, $tr(A) >2$, the commuting reflection is $2A-tr(A)I$. And you're right, this won't usually lie in $PSL_2(\mathbb{Q})$. – Ian Agol Nov 3 '20 at 6:00
• Oh, I'm sorry, I misunderstood your interpretation of "commensurable". I was assuming the usual interpretation: en.wikipedia.org/wiki/… For non-arithmetic lattices in $PSL_2(\mathbb{R})$, I think your interpretation is equivalent by Margulis' commensurator rigidity theorem (the commensurator of a non-arithmetic lattice is discrete). However, this doesn't work for $PSL_2(\mathbb{Z})$ or other arithmetic groups. – Ian Agol Nov 3 '20 at 6:05
• Alexandre's answer says that $\Gamma$ and $\Gamma'$ are commensurable iff they generate a discrete group, but I don't think that is true. (The usual definition of commensurable is that $\Gamma \cap \Gamma'$ has finite index in each of $\Gamma$ and $\Gamma'$.) For example, let $\Gamma = SL_2(\mathbb{Z})$ and $\Gamma' = \sigma \Gamma \sigma^{-1}$ where $\sigma = \left[ \begin{smallmatrix} -2 & 1 \\ 1 & 2 \end{smallmatrix} \right]$. I get that $\Gamma \cap \Gamma' \supseteq \Gamma(5)$, which is finite index in both. (continued) – David E Speyer Nov 3 '20 at 16:31
• Ah, found it math.stackexchange.com/questions/3388661 – David E Speyer Nov 3 '20 at 16:41

Sorry for a non-answer. Pictures are so beautiful I could not resist and made another illustration. Shown in red is the image under $$\lambda$$ of the geodesic from $$\mathbb H$$ that is the semicircle with endpoints $$22/17$$ and $$23/17$$. Here is (part of) the calculation of the $$\Phi_{10}$$ case from the answer by David E Speyer. As there, the resulting polynomial factors into $$9$$ irreducibles, $$3$$ with real coefficients and $$3$$ complex conjugate pairs. One of the three reals:

\begin{align*} &\scriptscriptstyle{16777216-201326592 x}\\ &\scriptscriptstyle{+100663296 \left(11 x^2+y^2\right)-335544320 x \left(11 x^2+3 y^2\right)}\\ &\scriptscriptstyle{-31457280 \left(2757 x^4+5898 x^2 y^2+3013 y^4\right)}\\ &\scriptscriptstyle{+12582912 x \left(74469 x^4+150090 x^2 y^2+75365 y^4\right)}\\ &\scriptscriptstyle{-2097152 \left(2817703 x^6+5080765 x^4 y^2+1703045 x^2 y^4-559505 y^6\right)}\\ &\scriptscriptstyle{+16777216 x \left(x^2+y^2\right) \left(1563093 x^4+1102060 x^2 y^2-461225 y^4\right)}\\ &\scriptscriptstyle{-327680 \left(x^2+y^2\right)^2 \left(99837117 x^4-381533062 x^2 y^2-159337027 y^4\right)}\\ &\scriptscriptstyle{-2621440 x \left(x^2+y^2\right)^2 \left(80168947 x^4+324318310 x^2 y^2 +159693043 y^4\right)}\\ &\scriptscriptstyle{+262144 \left(x^2+y^2\right)^2 \left(3319391289 x^6+10893265297 x^4 y^2+7934697207 x^2 y^4+1548990879 y^6\right)}\\ &\scriptscriptstyle{-524288 x \left(x^2+y^2\right)^2 \left(1803952329 x^6+9504803807 x^4 y^2+11439158627 x^2 y^4+4277013069 y^6\right)}\\ &\scriptscriptstyle{-16384 \left(x^2+y^2\right)^2 \left(80616153629 x^8-116483137740 x^6 y^2-471724634834 x^4 y^4-332885326540 x^2 y^6-49133177571 y^8\right)}\\ &\scriptscriptstyle{+32768 x \left(x^2+y^2\right)^2 \left(162384970239 x^8+326354545596 x^6 y^2+112042309434 x^4 y^4-118726692036 x^2 y^6-65725684289 y^8\right)}\\ &\scriptscriptstyle{-81920 \left(x^2+y^2\right)^3 \left(92443465791 x^8+214662714384 x^6 y^2+140433238710 x^4 y^4+11787598392 x^2 y^6-5352649901 y^8\right)}\\ &\scriptscriptstyle{+327680 x \left(x^2+y^2\right)^4 \left(18924971821 x^6+46132456837 x^4 y^2+30488552835 x^2 y^4+3000049451 y^6\right)}\\ &\scriptscriptstyle{-1280 \left(x^2+y^2\right)^5 \left(2468136499389 x^6+6067921659703 x^4 y^2+3772079449143 x^2 y^4+131492099517 y^6\right)}\\ &\scriptscriptstyle{+1024 x \left(x^2+y^2\right)^6 \left(964753103313 x^4+2235768664994 x^2 y^2+1287936301521 y^4\right)}\\ &\scriptscriptstyle{-512 \left(x^2+y^2\right)^7 \left(336466085491 x^4+635946737924 x^2 y^2+306085239441 y^4\right)}\\ &\scriptscriptstyle{+5120 x \left(x^2+y^2\right)^8 \left(2374492413 x^2+2302317821 y^2\right)}\\ &\scriptscriptstyle{+160 \left(x^2+y^2\right)^9 \left(1129381041 x^2+1254259889 y^2\right)}\\ &\scriptscriptstyle{+405291200 x \left(x^2+y^2\right)^{10}-1450080 \left(x^2+y^2\right)^{11}+\left(x^2+y^2\right)^{12}} \end{align*}

The curves look like   Consecutively zooming in near zero for the first one:

• More pictures can be seen here: arxiv.org/abs/1111.2296. The answer of Ian Agol says that they are ALL algebraic. – Alexandre Eremenko Nov 6 '20 at 14:09
• And the example of the lemniscate in the original question has endpoints $1 \pm \sqrt{2}$. – David E Speyer Nov 6 '20 at 14:21
• @AlexandreEremenko This then implies that taking geodesics with endpoints, say, $(0,x)$ one gets assignment, to every $x$ on the real line, of a definite natural number (degree of the corresponding algebraic curve), with arbitrarily large numbers present. What could this assignment be??? – მამუკა ჯიბლაძე Nov 6 '20 at 14:59
• @ მამუკა ჯიბლაძე: in other words, not all geodesics in the upper half-plane give you CLOSED geodesics in $C\backslash\{0,1\}$ but only those whose endpoints are fixed by an element of the group$\Gamma(2)$. – Alexandre Eremenko Nov 6 '20 at 23:53
• @მამუკა ჯიბლაძე: I edited my previous (incorrect) answer, replacing it with an explanation of Ian Agol's argument. – Alexandre Eremenko Nov 7 '20 at 13:43