← Crypto 货币与协议

A simple explanation of a/(b+c) + b/(c+a) + c/(a+b) = 4

a/(b+c) + b/(c+a) + c/(a+b) = 4 的简单解释
2025-05-11  ·  ---  ·  原文

The puzzle has gained some degree of notoriety on the internet because it looks like it must be either simple, impossible, or a trick question (solve P = NP?

这个谜题在互联网上获得了一定程度的恶名,因为它看起来要么是简单的,要么是不可能的,要么是一个棘手的问题(解决 P = NP?

Hahaha, the answer is N = 1, got you!), but in reality it's none of those three.

哈哈哈,答案是 N = 1,明白了!),但实际上这三个都不是。

The problem is exactly what it seems.

问题正是看起来的那样。

The problem is solvable.

问题是可以解决的。

And yet the smallest solution is:

然而最小的解决方案是:

What the heck is going on??!

到底是怎么回事??

If you search on the internet, you will see long-winded explanations about how the problem is actually connected to elliptic curves , and other fancy buzzwords from algebraic geometry that you've never heard of even if you think you know everything about elliptic curves because you're a cryptographer crypto enthusiast.

如果你在互联网上搜索,你会看到关于问题实际上如何与椭圆曲线联系起来的冗长解释,以及代数几何中其他你从未听说过的花哨的流行语,即使你认为你知道关于椭圆曲线的一切,因为你是密码学家的加密爱好者。

The goal of this post will be to give a maximally elementary explanation of this puzzle that does not rely on any pre-existing knowledge of these concepts.

这篇文章的目标是对这个谜题给出一个最基本的解释,而不依赖于这些概念的任何预先存在的知识。

First, let us start off by looking at a relaxed version of the problem.

首先,让我们首先看一下问题的轻松版本。

Specifically, let's remove the requirement that the three values must be positive.

具体来说,我们删除三个值必须为正的要求。

It turns out that you can just try a whole bunch of possibilities and get two answers by pure human brute force: \((-11, -4, 1)\) and \((11, -5, 9)\) .

事实证明,你可以尝试一大堆可能性,并通过纯粹的人类暴力得到两个答案: \((-11, -4, 1)\) 和 \((11, -5, 9)\) 。

You can get more solutions from either of these two by re-arranging the numbers, flipping signs and multiplying by constant factors (eg.

通过重新排列数字、翻转符号并乘以常数因子(例如,

\((-2, 8, 22)\) is also a valid solution), but we'll treat those as being the same.

\((-2, 8, 22)\) 也是一个有效的解决方案),但我们会将它们视为相同。

Now, we get to the interesting part.

现在,我们进入有趣的部分。

What if we can come up with a way to combine two solutions and get a totally new third solution?

如果我们能想出一种方法来结合两种解决方案并得到全新的第三种解决方案怎么办?

Often, this is possible in mathematics: if you have two multiples of 5, their sum is also a multiple of 5.

通常,这在数学中是可能的:如果有两个 5 的倍数,它们的和也是 5 的倍数。

More nontrivially, if you have two rational points on a circle (ie.

更重要的是,如果圆上有两个有理点(即

\((\frac{p_1}{q_1}, \frac{r_2}{s_2})\) and \((\frac{p_2}{q_2}, \frac{r_2}{s_2})\) satisfying \((\frac{p_i}{q_i})^2 + (\frac{r_i}{s_i})^2 = 1\) ), you can use point addition laws to make a third rational point on the circle: \((\frac{p_1 p_2}{q_1 q_2} - \frac{r_1 r_2}{s_1 s_2}, \frac{p_1 r_2}{q_1 s_2} + \frac{r_1 p_2}{s_1 q_2}\) ).

\((\frac{p_1}{q_1}, \frac{r_2}{s_2})\) 和 \((\frac{p_2}{q_2}, \frac{r_2}{s_2})\) 满足 \((\frac{p_i}{q_i})^2 + (\frac{r_i}{s_i})^2 = 1\) ) ,可以使用点加法在圆上制作第三个有理点: \((\frac{p_1 p_2}{q_1 q_2} - \frac{r_1 r_2}{s_1 s_2}, \frac{p_1 r_2}{q_1 s_2} + \frac{r_1 p_2}{s_1 q_2}\) )。

If we can come up with such an algorithm for our problem, then we could just use it over and over again, until eventually we get a point that happens to be all-positive by pure luck.

如果我们能够为我们的问题提出这样一个算法,那么我们就可以一遍又一遍地使用它,直到最终我们得到一个完全靠运气的点。

This will be our solution path.

这将是我们的解决方案路径。

Let us simplify the problem by making it only have two variables, \(a\) and \(b\) .

让我们简化问题,使其只有两个变量:\(a\) 和\(b\)。

Note that the equation is homogeneous : it has the property that scaling all the inputs by the same number does not change the answer.

请注意,该方程是齐次的:它具有将所有输入缩放相同数字不会改变答案的属性。

Let's take advantage of this to set \(c = 1\) :

让我们利用这一点来设置 \(c = 1\) :

Any solution to this two-variable equation with rational \(a = \frac{p}{q}\) and \(b = \frac{r}{s}\) can be scaled into an integer solution to the original three-variable equation: \((a * qs, b * qs, qs)\) .

此二变量方程的任何有理数 \(a = \frac{p}{q}\) 和 \(b = \frac{r}{s}\) 的解都可以缩放为原始三变量方程的整数解: \((a * qs, b * qs, qs)\) 。

We also moved the 4 to the left, this will make things more convenient for us later.

我们还将 4 移到了左边,这将使我们以后的事情更方便。

Now, let's multiply by the denominators, to make the whole equation a pure polynomial:

现在,让我们乘以分母,使整个方程成为纯多项式:

\(a(a+1)(a+b) + b(b+1)(a+b) + (a+1)(b+1) - 4(a+1)(b+1)(a+b) = 0\)

\(a(a+1)(a+b) + b(b+1)(a+b) + (a+1)(b+1) - 4(a+1)(b+1)(a+b) = 0\)

This introduces a few extraneous solutions, eg.

这引入了一些无关的解决方案,例如。

\((a = 1, b = -1)\) .

\((a = 1, b = -1)\) 。

But we just ignore them.

但我们只是忽略它们。

We can plot the above expression as a function; it looks like this:

我们可以将上面的表达式绘制为函数;它看起来像这样:

Now, let's draw a line through the two points where we know this curve intersects the \(z=0\) plane: \((-11, -4)\) and \((\frac{11}{9}, \frac{-5}{9})\) .

现在,让我们通过已知该曲线与 \(z=0\) 平面相交的两个点画一条线: \((-11, -4)\) 和 \((\frac{11}{9}, \frac{-5}{9})\) 。

We derive these by starting from the two solutions to the three-value equation, and converting \((a,b,c) \rightarrow (\frac{a}{c}, \frac{b}{c})\) .

我们通过从三值方程的两个解开始,并转换 \((a,b,c) \rightarrow (\frac{a}{c}, \frac{b}{c})\) 来推导它们。

And as we can see, the line has a third point of intersection.

正如我们所看到的,这条线有第三个交点。

And because the line is along the \(z=0\) plane, the third point must also be along the \(z=0\) plane, ergo it must also be a solution.

并且因为该线沿着\(z=0\)平面,所以第三个点也必须沿着\(z=0\)平面,因此它也一定是一个解。

Now, let us prove that this point is rational , so it still corresponds to a valid solution to the original problem.

现在,让我们证明这一点是有理的,因此它仍然对应于原问题的有效解。

We can parametrize the line as \((a = -11 + (\frac{11}{9} + 11) * t, b = -4 + (\frac{-5}{9} + 4) * t)\) .

我们可以将该线参数化为 \((a = -11 + (\frac{11}{9} + 11) * t, b = -4 + (\frac{-5}{9} + 4) * t)\) 。

\(t=0\) gives the first point, \(t=1\) gives the second point.

\(t=0\) 给出第一个点,\(t=1\) 给出第二个点。

Then, we can look at how \(a(a+1)(a+b) + b(b+1)(a+b) + (a+1)(b+1) - 4(a+1)(b+1)(a+b)\) behaves along the line by substituting \(a\) and \(b\) with their expressions based on \(t\) .

然后,我们可以通过用基于 \(t\) 的表达式替换 \(a\) 和 \(b\) 来查看 \(a(a+1)(a+b) + b(b+1)(a+b) + (a+1)(b+1) - 4(a+1)(b+1)(a+b)\) 的行为方式。

This gives us the curve: \(y = \frac{9071}{81} * t^3 + \frac{16748}{81} * t^2 + \frac{7677}{81} * t\) .

这给出了曲线: \(y = \frac{9071}{81} * t^3 + \frac{16748}{81} * t^2 + \frac{7677}{81} * t\) 。

Here's a plot of that curve, showing all three intersections:

这是该曲线的图,显示了所有三个交点:

You can then take the new \(t\) and plug it into the line and get back your new point: \((\frac{-5951}{9071}, \frac{-9841}{9071})\) .

然后,您可以将新的 \(t\) 插入线路中并取回新点: \((\frac{-5951}{9071}, \frac{-9841}{9071})\) 。

The underlying reason the new \(t\) (and hence the new point) is rational is: the curve is a degree-3 polynomial in \(t\) , and if a degree-3 polynomial has three solutions, then it fully factors into \(k(x-a)(x-b)(x-c)\) .

新的 \(t\) (以及新点)是有理数的根本原因是:曲线是 \(t\) 中的 3 次多项式,如果 3 次多项式有三个解,则它完全分解为 \(k(x-a)(x-b)(x-c)\) 。

The degree-2 term of this equals \(-k(a+b+c)\) .

其 2 次项等于 \(-k(a+b+c)\) 。

Hence, if the degree-2 and degree-3 terms are rational (which they are, because we constructed the polynomial out of an equation with rational coefficients), and two of the solutions are rational, the third solution must be rational as well.

因此,如果 2 次和 3 次项是有理数(它们是有理数,因为我们用有理数系数的方程构造了多项式),并且其中两个解是有理数,则第三个解也必须是有理数。

From here, we can brute-force our way to getting more solutions.

从这里,我们可以通过暴力方式获得更多解决方案。

Unfortunately, we can't directly keep going with the three points we have: if you were to repeat the above process to generate a new point starting from any two of the three points we now have, you would just get back the third point.

不幸的是,我们不能直接继续我们拥有的三个点:如果你要重复上述过程,从我们现在拥有的三个点中的任意两个点开始生成一个新点,你只会得到第三个点。

To get past this, we'll use a clever trick to generate even more solutions: convert \((x, y)\) into \((y, x)\) .

为了解决这个问题,我们将使用一个巧妙的技巧来生成更多解决方案:将 \((x, y)\) 转换为 \((y, x)\) 。

Now, with this in mind, we just brute-force, repeatedly using the "find the third point on the line" algorithm and coordinate flipping to get as many new solutions as possible.

现在,考虑到这一点,我们只是暴力破解,重复使用“找到直线上的第三个点”算法和坐标翻转来获得尽可能多的新解决方案。

Here's the python code:

这是Python代码:

This is horribly inefficient, but it does the job.

这是非常低效的,但它可以完成工作。

And out we get:

我们得到:

This is a positive rational solution to the two-equation formula; add \(c=1\) and you get a positive rational solution to the three-equation formula.

这是二元方程公式的正有理解;添加 \(c=1\) 即可得到三方程公式的正有理解。

And from here, we multiply by the denominator, and get the original solution:

从这里,我们乘以分母,得到原始解:

This does not prove that this is the smallest solution: for that you actually would have to go into the much deeper elliptic curve theory that I tried hard to avoid.

这并不能证明这是最小的解决方案:因为你实际上必须进入我努力避免的更深入的椭圆曲线理论。

But it gives you a solution to the problem, and the underlying math actually is elliptic curve math in disguise: "find the third intersecting point on the line and flip the coordinates" is exactly the same thing as the elliptic curve addition law , except flipping across the diagonal axis instead of the x axis.

但它为你提供了问题的解决方案,其底层数学实际上是变相的椭圆曲线数学:“找到直线上的第三个交点并翻转坐标”与椭圆曲线加法定律完全相同,只是翻转的是对角轴而不是x轴。

This "addition law" we came up with even satisfies associativity.

我们提出的这个“加法定律”甚至满足结合性。

中文为机器翻译,仅供参考。