# 配方法

配方法是一种代数技巧，它将二次表达式 \( ax^{2} + bx + c \) 改写为一个线性项的平方加上一个常数，即 \( a(x + h)^{2} + k \)。它用于求解二次方程、求抛物线的顶点，并且在高等数学中，用于将指数和积分中的二次型化为标准形式。求根公式本身就是对这一方法运用一次的结果——作用于一个系数为符号的一般二次方程。<sup>[1](https://openstax.org/books/elementary-algebra-2e/pages/10-3-solve-quadratic-equations-using-the-quadratic-formula)</sup>

| 关键事实 | 详情 |
|---|---|
| 作用 | 将 \( ax^{2} + bx + c \) 改写为 \( a(x + h)^{2} + k \)，即一个二项式的平方加上一个常数<sup>[1](https://openstax.org/books/elementary-algebra-2e/pages/10-3-solve-quadratic-equations-using-the-quadratic-formula)</sup> |
| 核心步骤 | 对于 \( x^{2} + bx \)，加上 \( (b/2)^{2} \)；例如 \( x^{2} + 8x + 16 = (x + 4)^{2} \)<sup>[2](https://openstax.org/books/algebra-1/pages/9-2-3-completing-the-square)</sup> |
| 主要推论 | 将此法一般地应用于 \( ax^{2} + bx + c = 0 \)，即得求根公式 \( x = \frac{-b \pm \sqrt{b^{2} - 4ac}}{2a} \)<sup>[1](https://openstax.org/books/elementary-algebra-2e/pages/10-3-solve-quadratic-equations-using-the-quadratic-formula)</sup> |
| 顶点式 | 任何二次函数 \( y = ax^{2} + bx + c \) 都可改写为 \( y = a(x - h)^{2} + k \)，其中顶点为 \( (h, k) \)<sup>[3](https://math.libretexts.org/Bookshelves/Algebra/Elementary_Algebra_%28LibreTexts%29/09%3A_Solving_Quadratic_Equations_and_Graphing_Parabolas/9.05%3A_Graphing_Parabolas)</sup> |
| 历史渊源 | 花拉子米（Al-Khwarizmi）的《还原与对消计算概要》约成书于825年，通过配方法的几何证明求解了二次方程<sup>[4](https://webspace.science.uu.nl/~wepst101/wisl901/goodpractices/2010-Khwarizmi.pdf)</sup> |
| 方程之外 | 对二次型指数配方，可将其化为均值为 \( \mathbf{A}^{-1}\mathbf{b} \)、协方差为 \( \mathbf{A}^{-1} \) 的高斯分布<sup>[5](https://healthml.github.io/Math4ML/chapter_probability/gaussian.html)</sup> |

## 方法

目标是把一个二次表达式变成一个完全平方式三项式，再加上剩余的部分。对于首项系数为1的二次式 \( x^{2} + bx \)，配成平方所需的数是 \( (b/2)^{2} \)，即 \( x \) 的系数的一半的平方。加上它便得到一个可因式分解的三项式：<sup>[2](https://openstax.org/books/algebra-1/pages/9-2-3-completing-the-square)</sup>

\[ x^{2} + bx + \left(\frac{b}{2}\right)^{2} = \left(x + \frac{b}{2}\right)^{2} \]

OpenStax的例题用数字展示了这一模式。要解 \( x^{2} + 8x = 48 \)，取8的一半并平方得16，两边同加16，再因式分解：\( x^{2} + 8x + 16 = (x + 4)^{2} \)，所以 \( (x + 4)^{2} = 64 \)。然后由平方根性质得 \( x + 4 = \pm 8 \)，解为 \( x = 4 \) 和 \( x = -12 \)。<sup>[2](https://openstax.org/books/algebra-1/pages/9-2-3-completing-the-square)</sup>

当首项系数不为1时，先把它从含变量的项中提取出来。解 \( 0 = 2x^{2} + 12x - 7 \) 时，写成 \( 0 = 2(x^{2} + 6x) - 7 \)，对 \( x^{2} + 6x \) 配方得 \( (x + 3)^{2} \)，再由 \( (x + 3)^{2} = 25/2 \) 开平方继续求解。<sup>[6](https://opentextbc.ca/intermediatealgebraberg/chapter/completing-the-square/)</sup>

## 几何图景

这个名称描述的是一种面积模型。将 \( x^{2} \) 表示为一个边长为 \( x \) 的正方形。把 \( 2x \) 项对半分，作为宽为1的矩形贴在两条相邻的边上，使每条边延长为 \( x + 1 \)。扩大后的图形是一个面积为 \( (x + 1)^{2} \) 的正方形，但缺了一个角上的小块，此处面积为 \( 1 \times 1 = 1 \)。补上这个角便完成了正方形，剩余的常数则相应调整：\( x^{2} + 2x + 12 = (x + 1)^{2} + 11 \)。<sup>[6](https://opentextbc.ca/intermediatealgebraberg/chapter/completing-the-square/)</sup>

**教学工具。** 代数拼图块以实物方式给出同样的构造：学生搭建完全平方式二次式的几何模型，记录可行的表达式，然后从代数上识别其中的规律，包括 \( x \) 项系数为负的情形。<sup>[7](https://education.ti.com/activity/detail/completing-the-square)</sup>

## 推导求根公式

将上述步骤应用于一般方程 \( ax^{2} + bx + c = 0 \)（其中 \( a \neq 0 \)），按固定的步骤顺序即可得出求根公式。<sup>[1](https://openstax.org/books/elementary-algebra-2e/pages/10-3-solve-quadratic-equations-using-the-quadratic-formula)</sup>

1. 分离含变量的项：\( ax^{2} + bx = -c \)。
2. 除以 \( a \)：\( x^{2} + \frac{b}{a}x = -\frac{c}{a} \)。
3. 两边同加 \( \left(\frac{1}{2} \cdot \frac{b}{a}\right)^{2} = \frac{b^{2}}{4a^{2}} \)。
4. 对左边因式分解：\( \left(x + \frac{b}{2a}\right)^{2} = \frac{b^{2} - 4ac}{4a^{2}} \)。
5. 应用平方根性质并解出 \( x \)：

\[ x = \frac{-b \pm \sqrt{b^{2} - 4ac}}{2a} \]

根号下的量 \( b^{2} - 4ac \) 即判别式，它决定了解的性质：若为负数，则方程无实数解，因为负数的平方根不是实数。<sup>[1](https://openstax.org/books/elementary-algebra-2e/pages/10-3-solve-quadratic-equations-using-the-quadratic-formula)</sup>

## 解方程之外的用途

**顶点式。** 配方法将 \( y = ax^{2} + bx + c \) 转化为 \( y = a(x - h)^{2} + k \)，由此可直接读出顶点 \( (h, k) \)。对于 \( y = x^{2} + 4x + 9 \)，加上再减去4，因式分解 \( x^{2} + 4x + 4 = (x + 2)^{2} \)，得到 \( y = (x + 2)^{2} + 5 \)，顶点为 \( (-2, 5) \)。当首项系数不为1时，先把它从前两项中提取出来；\( y = 2x^{2} - 4x + 8 \) 变为 \( y = 2(x - 1)^{2} + 6 \)，顶点为 \( (1, 6) \)。<sup>[3](https://math.libretexts.org/Bookshelves/Algebra/Elementary_Algebra_%28LibreTexts%29/09%3A_Solving_Quadratic_Equations_and_Graphing_Parabolas/9.05%3A_Graphing_Parabolas)</sup>

**高斯分布。** 每个正态分布都是以某个二次函数为指数的指数函数，因此在与正态分布打交道时，对指数配方是一种标准技巧。一个正比于 \( \exp\left(-\frac{1}{2}\mathbf{x}^{\top}\mathbf{A}\mathbf{x} + \mathbf{b}^{\top}\mathbf{x}\right) \) 的分布（其中 \( \mathbf{A} \) 正定）就是高斯分布 \( \mathcal{N}(\mathbf{A}^{-1}\mathbf{b}, \mathbf{A}^{-1}) \)。同样的步骤可推导多元高斯的边缘分布和条件分布：在分块指数中配方，分离出一个可积掉的平方项，剩下一个协方差为 \( (\mathbf{V}_{AA} - \mathbf{V}_{AB}\mathbf{V}_{BB}^{-1}\mathbf{V}_{BA})^{-1} \) 的高斯分布。<sup>[5](https://healthml.github.io/Math4ML/chapter_probability/gaussian.html)</sup><sup> • </sup><sup>[8](https://cs229.stanford.edu/section/more_on_gaussians.pdf)</sup>

**数值计算。** 教科书上的求根公式并不是在有限精度算术中同时计算两个根的最准确方法：当两个同号且量级相近的量相减时，其中一个根会损失精度。将 \( ax^{2} + bx + c = 0 \) 乘以 \( 4a \) 再配方，反而能得到一种避免这种相消的替代公式。<sup>[9](https://people.csail.mit.edu/bkph/articles/Quadratics.pdf)</sup>

## 历史

与配方法等价的方法早于其代数表述。巴比伦泥板通过一组有序运算求解二次问题，其步骤与现代方法如此接近，以至于用袖珍计算器解二次方程竟与书吏的指示如出一辙，连在同一阶段查阅平方根表都对应得上。<sup>[10](https://www.open.edu/openlearn/mod/oucontent/view.php?id=1976&printable=1)</sup>

这一方法的名称来自穆罕默德·伊本·穆萨·花拉子米（Muhammad ibn Musa al-Khwarizmi，约790年至850年），他的《还原与对消计算概要》（*al-Kitab al-mukhtasar fi hisab al-jabr wa'l-muqabala*）约成书于825年，给出了所有类型的一次和二次方程的完整解法。<sup>[4](https://webspace.science.uu.nl/~wepst101/wisl901/goodpractices/2010-Khwarizmi.pdf)</sup> 对每一种类型，他先给出法则——实质上就是针对数值例子的求根公式——随后给出配方法的几何证明。<sup>[11](https://mathshistory.st-andrews.ac.uk//HistTopics/Quadratic_etc_equations/)</sup> 在他对 \( x^{2} + 10x = 39 \) 的证明中，他从一个边长为 \( x \) 的正方形出发，在四边各加一个宽为 \( 10/4 \)、长为 \( x \) 的矩形，再补上缺失的角，构成一个更大的正方形。<sup>[12](https://mathshistory.st-andrews.ac.uk/Biographies//Al-Khwarizmi/)</sup> 与巴比伦人不同，花拉子米至少能在数值上处理有两个正根的方程；当平方项系数不为1时，他先通过乘法或除法将该系数化为1，然后再继续。<sup>[13](https://www.math.mcgill.ca/darmon/courses/history/katz.pdf)</sup>

## 选择解法

OpenStax列出了四种解二次方程的方法：因式分解、平方根性质、配方法和求根公式。其推荐顺序是：当二次式容易因式分解时先尝试因式分解；当方程形如 \( ax^{2} = k \) 或 \( a(x - h)^{2} = k \) 时用平方根性质；否则用求根公式，它能解任何二次方程。配方法被描述为一种多数人觉得繁琐的方法，之所以保留在课程中，是因为求根公式正是由它推导而来，而且这一过程在代数的其他领域还会再次出现。<sup>[1](https://openstax.org/books/elementary-algebra-2e/pages/10-3-solve-quadratic-equations-using-the-quadratic-formula)</sup>

## References

1. [10.3 Solve Quadratic Equations Using the Quadratic Formula, Elementary Algebra 2e, OpenStax](https://openstax.org/books/elementary-algebra-2e/pages/10-3-solve-quadratic-equations-using-the-quadratic-formula)
2. [9.2.3 Completing the Square, Algebra 1, OpenStax](https://openstax.org/books/algebra-1/pages/9-2-3-completing-the-square)
3. [9.5: Graphing Parabolas, Elementary Algebra, LibreTexts](https://math.libretexts.org/Bookshelves/Algebra/Elementary_Algebra_%28LibreTexts%29/09%3A_Solving_Quadratic_Equations_and_Graphing_Parabolas/9.05%3A_Graphing_Parabolas)
4. [Historical Background: Quadratic equations in the Babylonian Empire and al-Khwarizmi](https://webspace.science.uu.nl/~wepst101/wisl901/goodpractices/2010-Khwarizmi.pdf)
5. [The Gaussian distribution, Mathematics for Machine Learning](https://healthml.github.io/Math4ML/chapter_probability/gaussian.html)
6. [10.3 Completing the Square, Intermediate Algebra, BCcampus Open Textbooks](https://opentextbc.ca/intermediatealgebraberg/chapter/completing-the-square/)
7. [Completing the Square, Texas Instruments Education Activity](https://education.ti.com/activity/detail/completing-the-square)
8. [More on Gaussians, CS229 Section Notes, Stanford University](https://cs229.stanford.edu/section/more_on_gaussians.pdf)
9. [Numerically Stable Method for Solving Quadratic Equations, W. Kahan](https://people.csail.mit.edu/bkph/articles/Quadratics.pdf)
10. [Babylonian mathematics, OpenLearn, The Open University](https://www.open.edu/openlearn/mod/oucontent/view.php?id=1976&printable=1)
11. [Quadratic etc equations, MacTutor History of Mathematics](https://mathshistory.st-andrews.ac.uk//HistTopics/Quadratic_etc_equations/)
12. [Al-Khwarizmi (790–850), MacTutor History of Mathematics](https://mathshistory.st-andrews.ac.uk/Biographies//Al-Khwarizmi/)
13. [A history of mathematics (Katz), McGill University course text](https://www.math.mcgill.ca/darmon/courses/history/katz.pdf)

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

Topic: 物质世界与数学 › 数学与统计学 › 数与代数

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/completing-the-square

English original: https://www.edgepedia.org/completing-the-square
