Tweaking the sum of two real numbers so that each term has a common divisor

56 Views Asked by At

Let's say we have the fallowing sum of real numbers:

x + y = z

I'd like to find three other real numbers α, β and γ such that:

αx + βy = γz

αx / βy ∈ ℚ

βy / γz ∈ ℚ

So basically, how can I "scale" the terms of a sum so that each term has a common real number r that divides them "exactly" meaning that their division by r is an integer?

1

There are 1 best solutions below

1
On BEST ANSWER

Your question is similar to the apportionment problem, e.g., how the US House of Representatives can assign seats in direct relation to states' populations when those populations don't have a convenient common divisor.

For the sake of having a concrete example, suppose that the two Koreas are planning to reunite, and have a 100-seat parliament apportioned to North and South by population. Let

Then $z = x + y = 77~716~785$.

If fractional seats were possible, then North Korea would get 33.418661 seats in the new all-Korean parliament, and South Korea would get 66.581339. But for practical reasons, these must be rounded to integers. Now, there are different algorithms you could use for this.

  • Taking the arithmetic mean between two consecutive integers $m(n, n+1) = n + \frac{1}{2}$ gives a rounding cutoff of 33.5 for the North (so 33.418661 gets rounded down to 33) and 66.5 for the South (so 66.581339 rounds up to 67).
  • Taking the geometric mean $m(n, n + 1) = \sqrt{n(n+1)}$ gives a rounding cutoff of 33.496268 for the North and 66.49812. The seat counts still round to 33 and 67. (This is the method used to apportion the US House of Representatives.)
  • Taking the harmonic mean $m(n, n + 1) = \frac{2n(n+1)}{2n + 1}$ gives a rounding cutoff of 33.492537 for the North and 66.496241 for the South. The seat counts still round to 33 and 67.

In this particular case, the choice of rounding method doesn't matter, since they all give the same result: 33 seats for the North, and 67 for the South.

With 100 total seats, the average number of constituents per representative is $\frac{77~716~785}{100} = 777~167.85$. Rounding to a whole number of seats means that the North gets representation as if it had a population of $33 \times 777~167.85 = 25~646~539.05$, and the South gets representation as if it had a population of $67 \times 777~167.85 = 52~070~245.95$. So you can get your scaling factors by comparing the “represented” population to the actual population.

$$\alpha = \frac{25~646~539.05}{25~971~909} \approx 0.987472$$ $$\beta = \frac{52~070~245.95}{51~744~876} \approx 1.006288$$ $$\gamma = \frac{77~716~785}{77~716~785} = 1$$

Multiplying the scaling factors by the variables gives the “approximated” populations.

$$\alpha x = 25~646~539.05$$ $$\beta y = 52~070~245.95$$ $$\gamma z = 77~716~785$$

Which satisfy your ratio requirements with relatively “nice” fractions.

$$\frac{\alpha x}{\beta y} = \frac{25~646~539.05}{52~070~245.95} = \frac{33}{67}$$ $$\frac{\beta y}{\gamma z} = \frac{52~070~245.95}{77~716~785} = \frac{67}{100}$$

The pseudo-common divisor $r$ is the average population per representative, $\frac{z}{n}$, where $n$ is the number of seats.

One thing I've glossed over is how to pick $n$. I chose $n = 100$ because it's a convenient “round” number, but this is completely arbitrary. You can make a different choice. Like a highly-composite number, to make convenient fractions. Or choose an $n$ that makes the scaling factors $\alpha$ and $\beta$ as close to 1 as possible. Or if you're actually apportioning a legislature, you might want to have $n$ be an odd number, so as to avoid tie votes.


To summarize:

Suppose that you have a list of $x_i$ values, and $z = \sum x_i$. You want to find scaling factors $\alpha_i$ such that $\sum \alpha_i x_i = z$ and each $\alpha_i x_i$ is an integer multiple of $r \in \mathbb{R}$. Then:

  1. Arbitrarily choose $n \in \mathbb{N}$.
  2. Let $r = \frac{z}{n}$.
  3. Let $c_i = m(\lfloor \frac{x_i}{r} \rfloor)$ where $m(n \in \mathbb{Z})$ is a function that specifies the rounding cutoff between $n$ and $n + 1$.
  4. Let $s_i = \lfloor \frac{x_i}{r} \rfloor$ if $x_i < c_i$, or $\lfloor \frac{x_i}{r} \rfloor + 1$ if $x_i \ge c_i$.
  5. If $\sum s_i \ne n$, then let $r'$ be an “adjusted” value of $r$, and do steps 3 and 4 again using $r'$ instead of $r$.
  6. Let $\alpha_i = \frac{rs_i}{x_i}$. (That's the original $r$, not $r'$.)