Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been messing around with formulas for musical notes (trying not to read anything that would help me unless I get stuck) and currently I'm at a point where I'm trying to get a function that describes each note's frequency in terms of it's surrounding notes and specifically to find if their respective frequencies are close to a whole number ratio.

I can use a computer to calculate a table of every whole number ratio that I expect to see but I'm wondering if there is any other approach to this?

share|cite|improve this question
Continued fractions might be a good start? – copper.hat May 22 '12 at 15:57

In general there is no closest whole number ratio. For example, the ratio between C and the next lower F♯ is exactly $\sqrt 2$. (In an equal-tempered 12-tone system.) As was known to the Greeks, there are no integers $a$ and $b$ with $\frac ab = \sqrt 2$. But there are arbitrarily good approximations: $\frac 32$, $\frac75$, $\frac{17}{12}$, … . The sequence continues with each fraction $\frac ab$ followed by $\frac{a+2b}{a+b}$, and each one is closer than the ones before.

The general rule is that every irrational number $\alpha$ has a unique continued fraction representation, and that if one truncates this continued fraction at some point, one obtains a good rational approximation to $\alpha$ with relatively small numerator and denominator. The further along one truncates the continued fraction, the better the approximation, but the larger its numerator and denominator will be. One can show that these so-called "convergents" of the continued fraction are among the very best rational approximations to $\alpha$ that exist, in the sense that any closer rational approximation must have a larger denominator.

share|cite|improve this answer
convergents… are among the very best rational approximations…: to complete this, we have the two facts (which you surely know): (1) if you define the badness of a rational approximation $p/q$ as the value $|q\alpha-p|$, then all the best rational approximations (better than any with a smaller denominator) are precisely the convergents, (2) if you define the badness as $|x-p/q|$, then the best are precisely all convergents plus the semiconvergents $(p_k+np_{k+1})/(q_k+nq_{k+1})$ for $n$ from either $a_{k+2}/2$ or $a_{k+2}/2+1$ to $a_{k+2}$. – ShreevatsaR May 31 '12 at 10:04

A standard way of getting approximations that involve "small" numbers is to use the continued fraction expansion.

Since you expressed a desire to work things out for yourself, I will leave it at that for now. If calculations lead to a particular problem, please ping for elaboration.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.