Home▸Articles▸Mathematics

Continued Fractions: Best Rational Approximations (2D)

A powerful method for finding the best rational approximations to real numbers, with applications in mathematics and beyond.

mysimulator teamUpdated June 2026≈ 3 min read▶ Open the simulation

What Are Continued Fractions

A continued fraction is a representation of a real number as the sum of an integer and a series of fractions, each having 1 as its numerator. For example, the golden ratio φ can be expressed as [1; 1, 1, 1, ...], which means 1 + 1/(1 + 1/(1 + 1/...)). This form is particularly useful for finding rational approximations to irrational numbers.

Continued fractions provide a sequence of increasingly accurate rational approximations called convergents. These are the best possible rational approximations given a certain number of terms in the continued fraction.

How Continued Fractions Work

To find the continued fraction representation of a real number, you repeatedly take the integer part and then invert the fractional part. For instance, to represent √2, you start with [1; 2, 2, 2, ...], where each term is derived from the previous step's fractional part.

The Stern-Brocot tree provides a way to generate all possible rational approximations of a real number in a systematic manner. Each node in the tree represents a fraction that can be used as an approximation.

live demo · related simulation● LIVE

Why They Matter

Continued fractions are crucial in various fields, including number theory and cryptography. They help in understanding the structure of real numbers and provide efficient algorithms for computing with them.

In practical applications, continued fractions can be used to approximate irrational constants like π or e with high precision using simple rational numbers.

Real-World Examples

Continued fractions have been used in the design of digital filters and control systems. They also play a role in solving Diophantine equations, which are polynomial equations where only integer solutions are sought.

In cryptography, continued fractions can be used to factor large integers, although modern methods often use more efficient algorithms.

Frequently asked questions

What is the significance of convergents in continued fractions?

Convergents provide increasingly accurate rational approximations. They are the best possible rational numbers that can be used to approximate a given real number with a certain number of terms.

How do continued fractions relate to the Stern-Brocot tree?

The Stern-Brocot tree is a binary tree where each node represents a fraction. It provides a systematic way to generate all possible rational approximations for any real number, which can be used in conjunction with continued fractions.

Can continued fractions be used to approximate any real number?

Yes, every real number has a unique continued fraction representation, and the sequence of convergents will get arbitrarily close to the actual value.

What are some practical applications of continued fractions?

Continued fractions find use in digital signal processing, cryptography, solving Diophantine equations, and various areas of number theory. They offer a way to approximate irrational numbers with rational ones efficiently.

Try it live

Everything above runs in your browser — open Continued Fractions: Best Rational Approximations (2D) and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open Continued Fractions: Best Rational Approximations (2D) simulation

What did you find?

Add reproduction steps (optional)