09.12.2012 Views

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Fdrey ‘nough.<br />

4.5 RELATIVE PRIMALITY 119<br />

pruning off unwanted branches.) It follows that m’n - mn’ = 1 whenever<br />

m/n and m//n’ are consecutive elements of a Farey series.<br />

This method of construction reveals that 3~ can be obtained in a simple<br />

way from 3~~1: We simply insert the fraction (m + m’)/N between consecutive<br />

fractions m/n, m//n’ of 3~~1 whose denominators sum to N. For<br />

example, it’s easy to obtain 37 from the elements of 36, by inserting f , 5,<br />

. . . , f according to the stated rule:<br />

3, = 0 111 I 112 I 14 3 1s 3 4 5 6 1<br />

1'7'6'5'4'7'3'5'7'2'7'5'3'7'4'5'6'7'1'<br />

When N is prime, N - 1 new fractions will appear; but otherwise we’ll have<br />

fewer than N - 1, because this process generates only numerators that are<br />

relatively prime to N.<br />

Long ago in (4.5) we proved-in different words-that whenever m I n<br />

and 0 < m 6 n we can find integers a and b such that<br />

ma-nb = 1. (4.32)<br />

(Actually we said m’m + n’n = gcd( m, n), but we can write 1 <strong>for</strong> gcd( m, n),<br />

a <strong>for</strong> m’, and b <strong>for</strong> -n’.) The Farey series gives us another proof of (4.32),<br />

because we can let b/a be the fraction that precedes m/n in 3,,. Thus (4.5)<br />

is just (4.31) again. For example, one solution to 3a - 7b = 1 is a = 5, b = 2,<br />

since i precedes 3 in 37. This construction implies that we can always find a<br />

solution to (4.32) with 0 6 b < a < n, if 0 < m < n. Similarly, if 0 6 n < m<br />

and m I n, we can solve (4.32) with 0 < a 6 b 6 m by letting a/b be the<br />

fraction that follows n/m in 3m.<br />

Sequences of three consecutive terms in a Farey series have an amazing<br />

property that is proved in exercise 61. But we had better not discuss the<br />

Farey series any further, because the entire Stern-Brocot tree turns out to be<br />

even more interesting.<br />

We can, in fact, regard the Stern-Brocot tree as a number system <strong>for</strong><br />

representing rational numbers, because each positive, reduced fraction occurs<br />

exactly once. Let’s use the letters L and R to stand <strong>for</strong> going down to the<br />

left or right branch as we proceed from the root of the tree to a particular<br />

fraction; then a string of L’s and R’s uniquely identifies a place in the tree.<br />

For example, LRRL means that we go left from f down to i, then right to 5,<br />

then right to i, then left to $. We can consider LRRL to be a representation<br />

of $. Every positive fraction gets represented in this way as a unique string<br />

of L’s and R’s.<br />

Well, actually there’s a slight problem: The fraction f corresponds to<br />

the empty string, and we need a notation <strong>for</strong> that. Let’s agree to call it I,<br />

because that looks something like 1 and it stands <strong>for</strong> “identity!’

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!