Skip to main content

Romance, Continued Fractions, and You

This article was published in Scientific American’s former blog network and reflects the views of the author, not necessarily those of Scientific American


A continued fraction....of love.

About a month ago, I awoke from a dream totally psyched about the brilliant blog post I would write for Valentine's Day. In my dream, I had seen the mathematical concept of continued fractions as a metaphor for romance, and I was shocked that no one else had ever written about the beautiful, natural correspondence between the two subjects. As my brain entered the real world more fully, I realized that the correspondence isn't all that natural and might not even be beautiful. But I won't let that stop me! This Valentine's Day, I'm not going to try to woo you with cardiods and heart-y Sierpinski triangles. Instead, prepare to be amazed by continued fractions, the dreamiest new way to celebrate a mathematical Valentine's Day!

First of all, a continued fraction looks just like a fraction, but more so.


On supporting science journalism

If you're enjoying this article, consider supporting our award-winning journalism by subscribing. By purchasing a subscription you are helping to ensure the future of impactful stories about the discoveries and ideas shaping our world today.


A continued fraction...of numbers.

Instead of stopping at one numerator and one denominator, like the number 1/2, the denominator contains a fraction as well. And the denominator of that fraction contains a fraction, and so on. We can have either a finite or an infinite number of entries in an expression like this. If it's finite, it's not too hard to see that the continued fraction represents a rational number.

A continued fraction representing the number 1 7/10.

On the other hand, if a continued fraction has an infinite number of entries, then it represents an irrational number. This is actually a big advantage for continued fractions as opposed to decimal representations of numbers. Some rational numbers, such as 1/3=.333333… and 1/7=.142857... have nonterminating (but repeating) decimal representations. Whether the decimal representation of a number terminates or not depends not only on whether the number is rational but also on how a rational number's denominator is related to the number 10, the base of the decimal system. This is kind of arbitrary: why should the representation terminate or not based on properties of the number 10? One advantage of continued fractions is that it doesn't have this asymmetry built in.

For the purposes of this post, we're going to require that continued fractions only have 1's in the numerators and positive integers in the denominators, although we'll allow an arbitrary positive or negative integer to be added to the front. So we're talking about expressions that look like this.

A law-abiding continued fraction.

We could write continued fractions without following those rules, but the rules make it possible for us to prove more meaningful theorems. (And isn't that what we all want in life?)

When we follow these rules, the continued fraction representation of each number is almost unique. Each rational number actually has two continued fraction representations, but it's for a silly reason.

Two ways of representing 1 7/10 as a continued fraction. The expression on the right is just like the expression on the left, except I replaced the number 3 with 2+1/1. We can remove this non-uniqueness by requiring that finite continued fractions don't end in a 1/1.

Each irrational number, on the other hand, has a completely unique continued fraction representation.

Continued fractions are cool because in a quantifiable way, they are the best approximations of numbers. Using decimals, we can always approximate any rational or irrational number to any degree of precision we want, so it sounds a little weird to talk about a "best" approximation of a number. But what "best" means in this context is the best approximation with a denominator that is less than or equal to a given number. If you truncate the continued fraction expansion of a number q, the rational number that you get is the closest you can get to q without having to resort to a larger denominator. For a concrete example, think about the number 0.76. It can be approximated to the nearest fourth by 3/4=0.75 or to the nearest fifth by 4/5=0.8. The error is smaller when approximating to the nearest fourth so 4/5 is not a best approximation.

Within this framework of best approximations, there are better and worse best approximations. This is getting pretty meta, but the general idea is that for some numbers, the error at each successive level of the continued fraction is worse than for other numbers. The worst number, in this sense, is the golden ratio, also known as φ or (1+√5)⁄2.

φ isn't bad. It's just approximated that way.

To put this another way, the very best possible approximations of φ are as bad as best approximations can possibly be.

Some people use the term "badly approximable" to describe numbers like φ. Fewer people use the term "well approximable" to describe the other continued fractions, but I like it. We shouldn't label some numbers "bad" without showing them how to be "good." How else will they learn?

It's no coincidence that the continued fraction for φ, the worst approximable number, is just a bunch of ones. It turns out that you can just look at the denominators in a continued fraction to figure out whether numbers are badly approximable or not. In general, large denominators mean better approximations than small denominators. If the denominators of the continued fraction representation of a number q are all bounded by some number, then q is badly appoximable. But if the denominators get arbitrarily large, the number is well approximable. For example, the number e, which shows up when we calculate how much interest we'll earn on an investment, is well approximable.

The continued fraction expansion of e. Mathematicians who don't like fun (or wasting space unnecessarily) would abbreviate this by just writing out the sequence of denominators, so they would represent e as (2;1,2,1,1,4,1,1,6,1,1,8,1,1,10…). This is a little more boring but much more space-efficient than the way I wrote it.

Note that the denominators don't have to grow at each step, but there does need to be some subset of the denominators that grows boundlessly. In the case of e, there is a subsequence that goes 2, 4, 6, 8, and so on.

Continued fractions have some other cool properties, but they're still mysterious in some ways. The continued fraction expansion of the square root of an integer (that isn't a perfect square) always repeats. Note that this means that square roots are all badly approximable: if they repeat, their terms can't get bigger and bigger.

The continued fraction expansion of √3.

But not much is known about the continued fraction representations of some other pretty easy to describe numbers such as the cube root of 2 and π. Are they badly or well approximable? Besides square roots, what other classes of numbers are badly approximable? These questions are easy to ask but actually pretty challenging to answer. The reference I used for this post, the 1964 edition of an excellent book by Aleksandr Khinchin, mentioned many of these open questions, and 50 years later, most of them are still unanswered.

So what does this all have to do with romance? Well, as was obvious to my subconscious, it's completely natural to imagine that each day your love for your partner (or your infatuation with your secret crush) is a denominator in a continued fraction representing your relationship. A summer fling might be a rational number with a relatively small denominator, and an on-again, off-again romance might be a square root. If yours is the golden ratio, it might be time to end things already. But if everything is going right, then maybe you're one of the lucky ones with a well approximable irrational number.

Confidential to my husband: my love for you is like the denominators of the continued fraction representation of a very well approximable irrational number: growing without bound, no subsequences required.