Farey Sequences
Adapted from "Chapter III: Farey Series and a theorem of Minkowski" in the book "An Introduction to the Theory of Numbers, Sixth Edition" by G.H. Hardy and E.M.Wright.
Note that the book calls it a series but Wikipedia says "A Farey sequence is sometimes called a Farey series, which is not strictly correct, because the terms are not summed." so I will call it a sequence.
What is a Farey Sequence?
A Farey Sequence Fn is the ascending irreducible fractions between 0 and 1 where the denominators are less than or equal to n. For example to construct F4 we can get all the fractions with denominator ≤ 4:
Obviously there's a bunch of duplicates here: all the fractions equal to zero or one are the same as each other, there's also . We also need them to be in ascending order, so therefore the proper Farey Sequence for F4 is the following:
Graphing this, using the y-axis as the denominator and the x-axis as the numerator and then reflecting it across the diagonal you can form little shapes like so:
F4
If a/b and c/d are successive terms of Fn then . The mediant of the fractions is and we know it will always be in between the other two like so: this is because(from the Wikipedia page for mediant) and since b/d > a/c this will always be positive so we know the mediant is greater than a/c and which will also be positive for the same reason so the mediant is less than b/d. It might be more intuitive if we look at an example, using 1/2 and 2/3. which is in between the two numbers. You can kind of think of it as smooshing the 2 numbers together and getting something in between. The significance of this property for us is that the denominator of the mediant is b+d and if it was less than or equal to n then it would be in Fn but since these are successive terms it can't be, so b+d must be greater than n.
If n > 1, then all successive terms of Fn have differing denominators. Obviously for n = 1, we would have 0/1 and 1/1 in sequence, but for any other n we can't have a/b and c/b as successive terms since a+1≤c<b and . So e.g. for 1/3 and 2/3 for F4 they can't be successive since 1/2 comes in between.
If a/b and c/d are successive terms of Fn then we have
e.g. for F4 we have 1/2 followed by 2/3 so we get
Additionally, if a/b, c/d and e/f are three successive terms of Fn then we have
e.g. for F4 we have 1/2, 2/3 and 3/4 successively so
To prove these last two we first show that the two statements are equivalent to each other. If we assume then for three successive equations we can form as well. Now we want to get equations for c and d without each other so we do the following:To prove they're equivalent we need to prove it goes the other way as well. i.e. a implies b and b implies a. Thus if we assume is true then we can show this means the other equation must be true by induction. To prove something by induction means to prove something is true for a specific case then prove that if it's true for a certain case it will be true for the next case. This is useful for us because if then we can do the following:
The base case is evident since the first two elements for any Fn will be 0/1 and 1/n and Thus we have shown that the two equations are equivalent to each other but we have still yet to prove they're true.
To do this, we will also use induction; this time using Fn-1 to Fn as the inductive case. It's obviously true for n = 1 as the base case. Suppose that a/b and e/f are consecutive for Fn-1 but for Fn they're separated by c/d. If we set and then we can do the following, remembering that from Fn-1
We can do a similar thing for d to get so that we can form . What values of r and s can work for this? They have to be greater than zero since otherwise it would just be equal to a/b or e/f and wouldn't be separate for the Farey Sequence. To be a new value in Fn it must be the smallest possible value otherwise and so it must be r=s=1, and thus c/d is the mediant of the other two. Thus, . As an example, for 2/3 and 1/1 in Fn, since this is a new value that was just added to Fn and is in between two values that were in Fn-1, if s or r were greater than 1 then the value for r=s=1 would've already been included in Fn-1 and 2/3 and 1/1 wouldn't be successive in Fn
This is a bit handwavy and I don't formalise it much but there are other proofs given in the book chapter I'm basing this off which I may return to.