

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer

I am ashamed to say that I cannot figure this one out: I am given two ratios $\dfrac{p_i}{q_i}$ where $i=1$, $2$. (We just know the ratios and not the numbers $p_i, q_i$. What I mean by this is simply that in the expression $\psi$ I cannot separate the $p_i$ and $q_i$)

I want an elementary expression $\psi:\mathbb R \to \mathbb R$ such that

$$\dfrac{p_1+p_2}{q_1+q_2}=\psi \left(\dfrac{p_1}{q_1},\dfrac{p_1}{q_2}\right)$$


  • $p_i, q_i \in \mathbb Z$
  • $q_2 \nmid q_1$, since otherwise we cannot find such a function.
  • $p_2 \nmid p_1$ since this would make things trivial.
  • Let us assume $(p_i,q_i)=1$.
share|cite|improve this question
Do you really mean to assume $q_1=1$? – Chris Eagle Mar 7 '13 at 12:29
Are you saying $q_1 = 1?$ Also have these been reduced to their lowest terms? – muzzlator Mar 7 '13 at 12:29
@Martin, I don't think clarification is needed, I think you've simply demonstrated that what OP wants is impossible. Never mind, OP has edited to rule out your example. – Gerry Myerson Mar 7 '13 at 12:34
BTW this is called mediant. – Martin Sleziak Mar 7 '13 at 12:39
If you do know the ratios, don't you know the numbers? – hjpotter92 Mar 7 '13 at 12:42
up vote 5 down vote accepted

As Martin Sleziak said in his comment, the function you defined is called the mediant.

As others have suggested, there is no reason to expect there to be a simpler formula than the definition you give. There is however a natural and obvious way to represent $(p_1 + p_2)/(q_1 +q _2)$ as a weighted average of $p_1/q_1$ and $p_2/q_2$, where the weights depend on $q_1,q_2$:

$$\frac{p_1+p_2}{q_1+q_2} = \frac{q_1}{q_1+q_2}\frac{p_1}{q_1} + \frac{q_2}{q_1+q_2}\frac{p_2}{q_2}.$$

This shows, for instance, that $(p_1+p_2)/(q_1+q_2)$ always lies between $p_1/q_1$ and $p_2/q_2$.

In fact a simple argument shows that the function $\psi:\mathbb{Q}^2\to\mathbb{Q}$ so defined is discontinuous (with respect to the usual order topology) everywhere except the diagonal. Indeed, consider replacing $p_2/q_2$ with a nearby rational but with much larger denominator. The value of $(p_1+p_2)/(q_1+q_2)$ is then changed to pretty much $p_2/q_2$. This puts a lower bound on the simplicity of a formula for $\psi$.

share|cite|improve this answer
It's unlcear what your question is referencing, @Puzzled. $\mathbb Q$ has the usual order topology, and $\mathbb Q^2$ has the product topology. The point is, most "nice" formulas on $\mathbb R^2$ are continuous at most points under these topologies, but this function is at minimum discontinuous in a dense subset of $\mathbb R^2$. So that rules out "nice functions" on $\mathbb R^2$. – Thomas Andrews Mar 7 '13 at 13:14
@ThomasAndrews: Thanks for clearing that up. – Puzzled Mar 7 '13 at 13:17

Your Answer


