# Graphing Continued Fractions of Quadratic Irrationals

Graphing Continued Fractions of Quadratic Irrationals

Let , . The continued fraction of is either finite (when is a perfect square so that is rational) or eventually periodic (when is not a perfect square so that is irrational).

x=+

a

b

c

d

S

a,b,c,d,S∈

x

S

x

S

x

If is rational, the elements of its continued fraction are plotted.

x

If is irrational, let its continued faction be , where the repeating part under the bar starts as soon as possible. In that case, the plot is of the repeating part , with the initial elements ignored.

x

x=[;,,…,,,,…,]

x

0

x

1

x

2

x

m

x

m+1

x

m+2

x

m+n

w={,,…,}={,,…,}

x

m+1

x

m+2

x

m+n

w

1

w

2

w

n

{;,,…,}

x

0

x

1

x

2

x

m

Sometimes is a palindrome; that is, is the same read from right to left as from left to right, , and its graph is symmetric. Often is the concatenation of two palindromes, like +=[1;]. If is rational and not a perfect square, then ;,,…,,,2; that is, is a palindrome concatenated with twice the integer part of , which is a trivial palindrome. Finally, there are cases where is not a palindrome. Colors distinguish the various cases.

w

w

{,…,,}={,,…,}

w

n

w

2

w

1

w

1

w

2

w

n

w

1

3

5

3

1,4,1,2,6,2

r>1

r

=x

0

x

1

x

2

x

2

x

1

x

0

w

r

w

The continued fraction is shown under the plot in the Mathematica notation .

{,,…,,{,,…,}}

x

0

x

1

x

m

x

m+1

x

m+2

x

m+n