Quick! Which fraction is bigger, 40/83 or 27/56? It's not always easy to mentally compare two fractions to determine which is larger. For this example, you can easily see that both fractions are a little less than 1/2, but to compare the numbers you need to compare the products 40*56 and 27*83. Wouldn't it be great if there were a simpler way to compare fractions, maybe by using addition rather than multiplication?

It turns out that there is a simple equation that is often (but not always!) correct. I learned about this equation from John D. Cook, who blogged about this trick for comparing fractions by using only addition. According to a mathematical result by K. Odani (1998), the rule is correct more than 91% of the time.

Specifically, let N be a large integer. Randomly choose integers a, b, c, and d between 1 and N. Look at the signs of the following differences:

• X = a*d – b*c
• Y = (a+d) – (b+c)

Because a, b, c, and d are random, the quantities X and Y are random variables. K. Odani (1998) shows that X and Y have the same sign quite often for large N. As N goes to infinity, the probability that X and Y have the same sign is 11/12 ≈ 0.91667. I will refer to this result as Odani's truism.

Odani's truism provides a "rough and ready" rule for comparing two fractions a/b and c/d. If a/b < c/d, then X < 0, and, asymptotically, the expression (a+d) < (b+c) is true 91% of the time. Or, inverting the logic, you can evaluate (a+d) and (b+c) to determine, with high probability, whether the fraction a/b is greater than or less than the fraction c/d.

For example, again consider the fractions 40/83 and 27/56. It is easy to compute the sums 40+56=96 and 27+83=110. The first sum is less than the second, so Odani's truism suggests that 40/83 is less than 27/56, which is, in fact, true!

However, the summation rule does not always hold. For example, the summation rule for the fractions 13/27 and 40/83 gives the sums 96 and 67, but 13/27 is less than 40/83. If you use Odani's truism, you can never be sure that it holds for the two fractions you are trying to compare!

### Simulation of Odani's truism

You can demonstrate Odami's truism by using a simulation. Choose a large number N, and choose integers a, b, c, and d uniformly at random in [1, N]. Then the difference of the products (X = a*d – b*c) and the difference of the sums (Y = (a+d) – (b+c)) should have the same sign about 91% of the time. The following SAS DATA step carries out the simulation for a particular choice of N:

```/* Simulation to demonstrate Odani's truism: To determine if a/b < c/d it is often sufficient to test whether a+d < b+c */ data _null_; retain count 0; call streaminit(54321); N = 1E8; /* upper bound. Integers in [1,N] */ numSamples = 1E6; /* number of random draws */   do i = 1 to numSamples; a = rand('integer', 1, N); b = rand('integer', 1, N); c = rand('integer', 1, N); d = rand('integer', 1, N); x = a*d - b*c; /* correct way to compare a/b and c/d */ y = (a+d) - (b+c); /* Odani's truism is correct 11/12 of time */ count + (sign(x) = sign(y)); /* is truism correct for this 4-tuple (a,b,c,d)? */ end; prob = count / numSamples; /* empirical probability for simulation */ put "Odani's truism holds with probability " prob; run;```
`Odani's truism holds with probability 0.91648`

This simulation randomly generates 1,000,000 integer 4-tuples between 1 and 100 million. For each 4-tuple, the program compares the difference in the product (a*d - b*c) and the difference in the sum ((a+d) - (b+c)). If these quantities have the same signs (positive, negative, or zero), a counter is incremented. The result shows that the quantities have the same sign more than 91% of the time, in accordance with Odani's theorem.

### Interesting math versus practical math

As an applied mathematician, I am always curious whether an interesting mathematical result has a practical application. As John D. Cook points out at the end of his blog post, some fractions are easy to mentally compare whereas others are not. I don't need any trick to know that 6/29 is less than 18/35. It is obvious that the first fraction is less than 1/2 (in fact, it is close to 1/5) whereas the second is greater than 1/2. And I certainly don't need a trick to compare 6/29 and 35/18 because the latter fraction is greater than 1. Furthermore, Odani's result includes unreduced fractions such as 2/4, 3/6, and 50/100.

John D. Cook suggests that "it would be interesting to try to assess how often the rule of thumb presented here is correct in practice. You might try to come up with a model for the kinds of fractions people can’t compare instantly, such as proper fractions that have similar size."

That is a great idea. I don't need to use Odani's truism to compare 6/29 and 18/35, yet (6,29,18,35) is one of the 4-tuples for which Odani's truism is true. Similarly, it is true for (6,29,35,18), (1,6,5,8) and (1,10,9,10) and many other 4-tuples that represent fractions that can be easily compared without doing any explicit calculations. If you omit the "obvious" 4-tuples and unreduced fractions, you will reduce the probability that Odani's truism is true on the 4-tuples that remain. Thus, intuitively, Odani's truism should have a lower probability of being true if you restrict it only to reduced fractions that are close to each other. But how low? Is the rule any better than tossing a coin?

In the next blog post, I propose a way to measure how often Odani's truism is useful in practice. I will estimate the probability that Odani's truism holds for reduced fractions in the interval [0,1] that are close to each other.

### Summary

Odani's truism is an asymptotic result that states that you can compare the fractions a/b and c/d by looking at the sums (a+d) and (b+c). Specifically, the quantities (a*d - b*c) and ((a+d) - (b+c)) have the same sign with a probability that approaches 11/12 when the numerators and denominators are chosen uniformly at random in the interval [1,N] for very large N.

In the next post, I will discuss whether Odani's truism is useful in practice or whether it is merely a mathematical curiosity.

The post Odani's truism: A probabilistic way to compare fractions appeared first on The DO Loop.