# 拉格朗日四平方定理

**拉格朗日四平方定理**断言，任何正整数都可以表示为不超过四个整数平方之和，即对某些整数 \( x, y, z, w \in \mathbb{Z} \)，可写成 \( n = x^{2} + y^{2} + z^{2} + w^{2} \) 的形式。约瑟夫-路易·拉格朗日（Joseph-Louis Lagrange）于1770年发表了第一个证明，使用了如今被称为欧拉四平方恒等式的工具<sup>[1](https://mathworld.wolfram.com/LagrangesFour-SquareTheorem.html)</sup>。这一结果是加性数论的一个基础性命题——加性数论是数论中研究哪些整数可以由给定集合中的数相加而构成的分支，此处给定的集合是完全平方数<sup>[2](https://dlmf.nist.gov/27.13)</sup>。

| 关键事实 | 详情 |
|---|---|
| 命题陈述 | 每个正整数都是至多四个整数平方之和<sup>[1](https://mathworld.wolfram.com/LagrangesFour-SquareTheorem.html)</sup> |
| 首个证明 | 拉格朗日，1770年，使用欧拉四平方恒等式<sup>[1](https://mathworld.wolfram.com/LagrangesFour-SquareTheorem.html)</sup> |
| 更早的历史 | 巴歇在1621年翻译丢番图著作时提出此命题，此前已验证至120；费马声称已证但未留下证明<sup>[3](https://proofwiki.org/wiki/Lagrange%27s_Four_Square_Theorem/Historical_Note)</sup> |
| 欧拉的角色 | 约1730年起研究此问题，证明了较弱版本，并于1772年提交完整证明，1780年发表<sup>[3](https://proofwiki.org/wiki/Lagrange%27s_Four_Square_Theorem/Historical_Note)</sup> |
| 在华林问题中的地位 | 拉格朗日证明了 \( g(2) = 4 \)，这是华林1770年关于幂和之猜想中第一个获解的情形<sup>[2](https://dlmf.nist.gov/27.13)</sup> |
| 计数公式 | 雅可比：\( n \) 的四平方表示数等于 \( n \) 的不能被4整除的因数之和的八倍<sup>[4](https://www.researchgate.net/publication/231812171_A_Simple_Proof_of_Jacobi%27s_Two-Square_Theorem)</sup> |
| 三平方的精化 | 勒让德（1798）：除形如 \( 4^{n}(8k+7) \) 的数以外，三个平方足以表示所有数<sup>[1](https://mathworld.wolfram.com/LagrangesFour-SquareTheorem.html)</sup> |

## 历史背景

这一结果有着悠久的前史。一些资料表明，亚历山大的丢番图（Diophantus of Alexandria）至少从经验上已知此事实，也有人将首次正式陈述归功于皮埃尔·德·费马（Pierre de Fermat）。有据可查的是，克洛德·加斯帕尔·巴歇·德·梅齐里亚克（Claude Gaspard Bachet de Méziriac）在将命题彻底验证至120之后，于1621年在其翻译的丢番图《算术》（*Arithmetica*）中陈述了该定理。费马在自己收藏的这部书中读到此事并进行了研究，但他的证明至今未被找到<sup>[3](https://proofwiki.org/wiki/Lagrange%27s_Four_Square_Theorem/Historical_Note)</sup>。

莱昂哈德·欧拉（Leonhard Euler）接过了这个问题，约1730年与克里斯蒂安·哥德巴赫（Christian Goldbach）讨论此事，并在那一时期发表了较弱版本的证明，即每个整数都是至多四个整数或有理数平方之和<sup>[3](https://proofwiki.org/wiki/Lagrange%27s_Four_Square_Theorem/Historical_Note)</sup><sup> • </sup><sup>[5](https://hsm.stackexchange.com/questions/17477/where-did-lagrange-prove-the-four-squares-theorem)</sup>。欧拉在这一问题上工作了大约四十年，之后拉格朗日才取得成功；欧拉随后于1772年提交了自己的证明，最终于1780年发表，并在其中宣称他的证明与拉格朗日的证明大不相同，用他的话说，更为省力<sup>[3](https://proofwiki.org/wiki/Lagrange%27s_Four_Square_Theorem/Historical_Note)</sup><sup> • </sup><sup>[5](https://hsm.stackexchange.com/questions/17477/where-did-lagrange-prove-the-four-squares-theorem)</sup>。命名问题曾引发评论：数学家伦纳德·尤金·迪克森（Leonard Eugene Dickson）的数学史著作记载了对将拉格朗日的名字附于一个费马已陈述、欧拉长期研究的定理之上的批评<sup>[6](https://mathshistory.st-andrews.ac.uk/Extras/Carmichael_Hardy_1/)</sup>。

## 证明结构

**两个要素。** 标准证明结合了两个事实<sup>[7](https://a-warded.org/open-book/university-number-theory/lesson-32)</sup>：

1. 四个平方之和的乘积仍是四个平方之和。
2. 每个素数都可以写成四个平方之和。

第一个事实即欧拉四平方恒等式，由欧拉首次发现。设 \( A = a^{2} + b^{2} + c^{2} + d^{2} \)，\( B = x^{2} + y^{2} + z^{2} + w^{2} \)；则<sup>[7](https://a-warded.org/open-book/university-number-theory/lesson-32)</sup>

该恒等式被称为欧拉四平方恒等式，即 \[ (a^{2}+b^{2}+c^{2}+d^{2})(x^{2}+y^{2}+z^{2}+w^{2}) = (ax-by-cz-dw)^{2} + (ay+bx+cw-dz)^{2} + (az-bw+cx+dy)^{2} + (aw+bz-cy+dx)^{2}. \]

这一恒等式是精确的，表明可表示为四平方之和的数集在乘法下封闭。由于1显然是平方数，该恒等式将整个定理归约为素数情形：一旦每个素数可表示，则通过将其素因子的表示相乘，每个整数都可表示<sup>[7](https://a-warded.org/open-book/university-number-theory/lesson-32)</sup><sup> • </sup><sup>[8](https://www.researchgate.net/publication/253950757_On_the_computation_of_representations_of_primes_as_sums_of_four_squares)</sup>。拉格朗日的原始论证——本质上保留在现代阐述中——沿此思路展开<sup>[9](https://planetmath.org/ProofOfLagrangesFourSquareTheorem)</sup>。

该恒等式还有一种代数解读：它是四元数乘积的范数等于范数之积这一命题，从而将该定理与整四元数的算术联系起来<sup>[10](https://math.uchicago.edu/~may/VIGRE/VIGRE2008/REUPapers/Ng.pdf)</sup>。

## 华林问题

该定理是华林问题中第一个获解的情形。爱德华·华林（Edward Waring）于1770年提出——未加证明且数值证据有限——每个正整数 \( n \) 都是四个平方之和、九个立方之和、十九个四次方之和，依此类推。拉格朗日于1770年证明了 \( g(2) = 4 \)，在随后的139年间，\( g(k) \) 的存在性对 \( k = 3, 4, 5, 6, 7, 8, 10 \) 相继得到证明<sup>[2](https://dlmf.nist.gov/27.13)</sup>。

## 表示的计数

拉格朗日定理只断言表示的存在性。雅可比四平方定理给出了精确计数：正整数 \( n \) 表示为四个平方之和的表示数等于 \( n \) 的不能被4整除的因数之和的八倍<sup>[4](https://www.researchgate.net/publication/231812171_A_Simple_Proof_of_Jacobi%27s_Two-Square_Theorem)</sup>。此公式已有多种证明方式。以 \( q \)-级数研究著称的澳大利亚数学家迈克尔·D·赫希霍恩（Michael D. Hirschhorn）发表了一个仅使用雅可比三重积恒等式的两页证明<sup>[11](https://mathoverflow.net/questions/84897/proofs-of-jacobis-four-square-theorem)</sup>，1987年《美国数学会会刊》（*Proceedings of the American Mathematical Society*）上的一篇论文同样从三重积恒等式简单地导出了该公式<sup>[12](https://www.ams.org/proc/1987-101-03/S0002-9939-1987-0908644-9/)</sup>。乔治·安德鲁斯（George Andrews）、沙洛什·B·埃哈德（Shalosh B. Ekhad）和多伦·蔡尔伯格（Doron Zeilberger）于1992年给出了雅可比公式的一个简短初等证明，以及一个有限形式的推广<sup>[13](https://arxiv.org/abs/math/9206203)</sup>。对于奇数，有一个基于卷积公式 \( r_{4}(n) = \sum_{r+s=n} r_{2}(r)\, r_{2}(s) \) 的初等证明，归功于狄利克雷<sup>[11](https://mathoverflow.net/questions/84897/proofs-of-jacobis-four-square-theorem)</sup>。

## 精化与计算

**三平方。** 并非总需要四个平方。阿德里安-马里·勒让德（Adrien-Marie Legendre）于1798年证明，拉格朗日定理中的数4可以减为3，但形如 \( 4^{n}(8k+7) \) 的数除外，这些数确实需要四个平方<sup>[1](https://mathworld.wolfram.com/LagrangesFour-SquareTheorem.html)</sup>。

**精化的表示。** 后续工作通过对四个平方施加额外条件来加强该定理。例如，孙智伟及其合作者证明了每个自然数 n 都可表示为四个自然数 x, y, z, w 的平方和 x² + y² + z² + w²，使得 P(x,y,z) 为平方数，其中 P 取遍一系列多项式，如 x、2x、x − y 以及 x² + ky²（k = 2, 3, 5, 6, 8, 12）；同一篇论文还提出了1-3-5猜想，断言每个 n 都有这样的表示使得 x + 3y + 5z 为平方数<sup>[14](https://arxiv.org/abs/1604.06723)</sup>。相关工作表明，每个正整数都可写成四个平方之和，使得 \( |x + y - z| \) 为4的幂，或使 \( x + y + 2z \) 为4的幂<sup>[15](https://arxiv.org/abs/1701.05868)</sup>，进一步的精化仍在通过三元二次型的算术理论加以研究<sup>[16](https://arxiv.org/abs/2511.23223)</sup>。

**寻找表示。** 拉格朗日的证明是构造性的，但尚不清楚相关算法是否以确定性多项式复杂度产生任何素数或非素数的四平方表示<sup>[8](https://www.researchgate.net/publication/253950757_On_the_computation_of_representations_of_primes_as_sums_of_four_squares)</sup>。在包括整数分解的多项式时间算法等假设下，已知有确定性多项式时间算法可将一个数表示为满足限制同余条件的四平方之和；此类表示是确定性误差缩减中所用的 LPS 拉马努金图上导航算法的基础<sup>[17](https://academic.oup.com/imrn/article/2021/18/13839/5610520)</sup>。

## References

1. [Lagrange's Four-Square Theorem, Wolfram MathWorld](https://mathworld.wolfram.com/LagrangesFour-SquareTheorem.html)
2. [DLMF §27.13, Additive Number Theory, NIST](https://dlmf.nist.gov/27.13)
3. [Lagrange's Four Square Theorem/Historical Note, ProofWiki](https://proofwiki.org/wiki/Lagrange%27s_Four_Square_Theorem/Historical_Note)
4. [A simple proof of Jacobi's four-square theorem, Proceedings of the AMS (ResearchGate copy)](https://www.researchgate.net/publication/231812171_A_Simple_Proof_of_Jacobi%27s_Two-Square_Theorem)
5. [Where did Lagrange prove the Four Squares Theorem?, History of Science and Mathematics Stack Exchange](https://hsm.stackexchange.com/questions/17477/where-did-lagrange-prove-the-four-squares-theorem)
6. [Carmichael note on Hardy and the naming of the theorem, MacTutor History of Mathematics](https://mathshistory.st-andrews.ac.uk/Extras/Carmichael_Hardy_1/)
7. [Lagrange's Four-square Theorem, A-Warded number theory course](https://a-warded.org/open-book/university-number-theory/lesson-32)
8. [On the computation of representations of primes as sums of four squares, ResearchGate](https://www.researchgate.net/publication/253950757_On_the_computation_of_representations_of_primes_as_sums_of_four_squares)
9. [Proof of Lagrange's four-square theorem, PlanetMath](https://planetmath.org/ProofOfLagrangesFourSquareTheorem)
10. [Quaternions and the Four Square Theorem, University of Chicago REU paper](https://math.uchicago.edu/~may/VIGRE/VIGRE2008/REUPapers/Ng.pdf)
11. [Proofs of Jacobi's four-square theorem, MathOverflow](https://mathoverflow.net/questions/84897/proofs-of-jacobis-four-square-theorem)
12. [A simple proof of Jacobi's four-square theorem, Proceedings of the American Mathematical Society](https://www.ams.org/proc/1987-101-03/S0002-9939-1987-0908644-9/)
13. [Andrews, Ekhad, Zeilberger (1992), A Short Proof of Jacobi's Formula, arXiv](https://arxiv.org/abs/math/9206203)
14. [Refining Lagrange's four-square theorem, arXiv](https://arxiv.org/abs/1604.06723)
15. [Restricted sums of four squares, arXiv](https://arxiv.org/abs/1701.05868)
16. [On restricted sums of four squares and Zhi-Wei Sun's x+24y conjecture, arXiv](https://arxiv.org/abs/2511.23223)
17. [Complexity of Strong Approximation on the Sphere, International Mathematics Research Notices](https://academic.oup.com/imrn/article/2021/18/13839/5610520)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Oct 15, 2026 · Edited: Sep 17, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Number theory › Diophantine problems and approximation › Linear and additive Diophantine equations

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/lagranges-four-square-theorem

English original: https://www.edgepedia.org/lagranges-four-square-theorem
