TITLE: Equations defining hyperbolic geodesics in $\mathbb C \setminus\{0,1\}$
QUESTION [26 upvotes]: 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.
Two other comments:

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.

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

REPLY [12 votes]: $\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)$.