# 二元关系

二元关系是一组有序对，记录一个集合中的哪些元素与另一个集合中的哪些元素相关，形式化地写作子集 \( R \subseteq A \times B \)。当两个集合是同一个集合 \( A \) 时，即 \( R \subseteq A \times A \)，则称为 \( A \) 上的二元关系，这是数学中最常处理的情形。<sup>[1](https://math.libretexts.org/Bookshelves/Mathematical_Logic_and_Proof/Proofs_and_Concepts_-_The_Fundamentals_of_Abstract_Mathematics_%28Morris_and_Morris%29/07%3A_Equivalence_relations/7.01%3A_Binary_relations)</sup><sup> • </sup><sup>[2](https://builds.openlogicproject.org/content/sets-functions-relations/sets-functions-relations.pdf)</sup> 若 \( (a, b) \in R \)，则写作 \( a R b \)，并称 \( a \) 与 \( b \) 具有关系 \( R \)；记号 \( xRy \) 与成员关系记号一样常用。<sup>[3](https://plato.stanford.edu/archives/win2006/entries/set-theory/primer.html)</sup><sup> • </sup><sup>[4](https://www.math.wichita.edu/discrete-book/sec_relationsfunctions.html)</sup>

| 关键事实 | 细节 |
|---|---|
| 定义 | 从 \( A \) 到 \( B \) 的关系是 \( A \times B \) 的任意子集；\( A \) 上的二元关系是 \( A \times A \) 的任意子集，没有进一步的限制。<sup>[1](https://math.libretexts.org/Bookshelves/Mathematical_Logic_and_Proof/Proofs_and_Concepts_-_The_Fundamentals_of_Abstract_Mathematics_%28Morris_and_Morris%29/07%3A_Equivalence_relations/7.01%3A_Binary_relations)</sup> |
| 定义域与值域 | 定义域 \( \mathrm{dom}\,R \) 是 \( R \) 中所有有序对的第一个坐标构成的集合；值域 \( \mathrm{ran}\,R \) 是所有第二个坐标构成的集合。<sup>[3](https://plato.stanford.edu/archives/win2006/entries/set-theory/primer.html)</sup> |
| 函数作为关系 | 关系 \( F \) 是函数，当且仅当每个 \( a \in \mathrm{dom}\,F \) 恰好与一个 \( b \) 相关。<sup>[3](https://plato.stanford.edu/archives/win2006/entries/set-theory/primer.html)</sup> |
| 等价关系 | 自反、对称且传递。<sup>[5](https://math.libretexts.org/Courses/Mount_Royal_University/Higher_Arithmetic/2%3A_Binary_relations/2.2%3A_Equivalence_Relations%2C_and_Partial_order)</sup> |
| 偏序 | 自反、反对称且传递；若每对不同的元素都可比较，则该序是全序（线性序）。<sup>[5](https://math.libretexts.org/Courses/Mount_Royal_University/Higher_Arithmetic/2%3A_Binary_relations/2.2%3A_Equivalence_Relations%2C_and_Partial_order)</sup><sup> • </sup><sup>[6](https://opendsa-server.cs.vt.edu/ODSA/Books/umw/cpsc340/fall-2022/CPSC340_Fall2022_3/html/SetDef.html)</sup> |
| 表示法 | 有向图（当且仅当 \( (a,b) \in R \) 时从 \( a \) 到 \( b \) 画箭头）或布尔邻接矩阵。<sup>[1](https://math.libretexts.org/Bookshelves/Mathematical_Logic_and_Proof/Proofs_and_Concepts_-_The_Fundamentals_of_Abstract_Mathematics_%28Morris_and_Morris%29/07%3A_Equivalence_relations/7.01%3A_Binary_relations)</sup><sup> • </sup><sup>[7](https://a-warded.org/open-book/university-discrete-mathematics/lesson-40)</sup> |
| 历史 | 德·摩根在1846年至1863年的论文中将关系引入逻辑学；皮尔士（1870）将关系与布尔的代数相结合；施罗德在其《逻辑代数》第三卷中处理了二元关系的代数。<sup>[8](https://plato.stanford.edu/archives/fall2011/entries/algebra-logic-tradition/)</sup> |

## 定义与基本词汇

集合论定义建立在有序对之上，其标准构造是库拉托夫斯基（Kuratowski）于1921年发表的对诺伯特·维纳（Norbert Wiener）1914年早期建议的修改：\( (a, b) = \{\{a\}, \{a, b\}\} \)。这个集合具有定义性质：\( (a, b) = (a', b') \) 当且仅当 \( a = a' \) 且 \( b = b' \)，因此两个坐标都可以唯一读出，且当 \( a \neq b \) 时 \( (a, b) \neq (b, a) \)。<sup>[3](https://plato.stanford.edu/archives/win2006/entries/set-theory/primer.html)</sup><sup> • </sup><sup>[9](https://www.philosophy.rutgers.edu/joomlatools-files/docman-files/settheory_rpx.2.10.pdf)</sup>

由于关系只是一组有序对的集合，它承载所有通常的集合运算：关系的并、交、差都逐对计算，两个关系的笛卡尔积与任意集合的笛卡尔积定义方式相同。<sup>[10](https://www.cs.utexas.edu/~misra/Classes.dir/ClassNotes.dir/337.pdf)</sup> 这个定义刻意宽松。\( A \times B \) 的任意子集都算作一个关系，即使其有序对之间没有可辨识的模式；有序对本身规定了一切，至于这组有序对是用什么性质描述的，并不重要。<sup>[1](https://math.libretexts.org/Bookshelves/Mathematical_Logic_and_Proof/Proofs_and_Concepts_-_The_Fundamentals_of_Abstract_Mathematics_%28Morris_and_Morris%29/07%3A_Equivalence_relations/7.01%3A_Binary_relations)</sup><sup> • </sup><sup>[3](https://plato.stanford.edu/archives/win2006/entries/set-theory/primer.html)</sup>

数集和日常集合上的熟悉例子说明了其范围。实数集 \( \mathbb{R} \) 上的小于关系 \( < \)、论域上的相等关系 \( = \)、以及集合族上的子集关系 \( \subset \) 都是二元关系；人员集合上的“是……的姐妹”、“比……高”和“是……的父亲或母亲”也是如此。<sup>[1](https://math.libretexts.org/Bookshelves/Mathematical_Logic_and_Proof/Proofs_and_Concepts_-_The_Fundamentals_of_Abstract_Mathematics_%28Morris_and_Morris%29/07%3A_Equivalence_relations/7.01%3A_Binary_relations)</sup><sup> • </sup><sup>[11](https://dspace.unililzone.com/api/core/bitstreams/b99d669f-6f3e-4ef2-9ec4-afeca04f3f08/content)</sup> 在 \( \mathbb{N} \times \mathbb{N} \) 上，对角线上的有序对构成恒等关系 \( \mathrm{Id}_X = \{\langle x, x \rangle : x \in X\} \)，对角线上方的有序对构成小于关系，下方的构成大于关系。<sup>[2](https://builds.openlogicproject.org/content/sets-functions-relations/sets-functions-relations.pdf)</sup>

## 集合上关系的性质

对于单个集合上的关系，有四个性质在整个数学中反复出现。集合 \( S \) 上的关系 \( R \) 是：

- **自反的**，若每个元素都与自身相关。
- **对称的**，若 \( a R b \) 蕴含 \( b R a \)。
- **反对称的**，若 \( a R b \) 且 \( b R a \) 共同迫使 \( a = b \)。<sup>[5](https://math.libretexts.org/Courses/Mount_Royal_University/Higher_Arithmetic/2%3A_Binary_relations/2.2%3A_Equivalence_Relations%2C_and_Partial_order)</sup>

这些性质的两种组合构成了本学科的大部分内容。自反、对称且传递的关系是等价关系；它表现得像广义的相等，将其集合划分为相互关联的元素类。自反、反对称且传递的关系是偏序；它表现得像广义的 \( \le \)，它所排序的集合称为偏序集。若偏序中每对不同的元素都可比较，则该序是全序或线性序。<sup>[5](https://math.libretexts.org/Courses/Mount_Royal_University/Higher_Arithmetic/2%3A_Binary_relations/2.2%3A_Equivalence_Relations%2C_and_Partial_order)</sup><sup> • </sup><sup>[6](https://opendsa-server.cs.vt.edu/ODSA/Books/umw/cpsc340/fall-2022/CPSC340_Fall2022_3/html/SetDef.html)</sup>

## 函数作为特殊关系

每个函数 \( f : A \to B \) 都是一组有序对，因此是 \( A \times B \) 的子集；函数在关系中的特殊之处在于唯一性。二元关系 \( F \) 是函数，当且仅当对其定义域中的每个 \( a \)，恰好存在一个 \( b \) 使得 \( a F b \)，该 \( b \) 称为 \( F \) 在 \( a \) 处的值。<sup>[3](https://plato.stanford.edu/archives/win2006/entries/set-theory/primer.html)</sup> 这种对比在亲属关系中可见：“\( m \) 是 \( p \) 的母亲”这一关系是从人到人的函数，而“\( s \) 是 \( p \) 的儿子”则不是，因为一个人可能有不止一个儿子，也可能没有。<sup>[1](https://math.libretexts.org/Bookshelves/Mathematical_Logic_and_Proof/Proofs_and_Concepts_-_The_Fundamentals_of_Abstract_Mathematics_%28Morris_and_Morris%29/07%3A_Equivalence_relations/7.01%3A_Binary_relations)</sup>

## 表示法：有向图与矩阵

有限集上的二元关系有两种标准图示。有向图为 \( A \) 的每个元素画一个点，当且仅当 \( (a, b) \) 属于该关系时从 \( a \) 到 \( b \) 画一个箭头；其英文名称是“有向图”英文全称的缩写。<sup>[1](https://math.libretexts.org/Bookshelves/Mathematical_Logic_and_Proof/Proofs_and_Concepts_-_The_Fundamentals_of_Abstract_Mathematics_%28Morris_and_Morris%29/07%3A_Equivalence_relations/7.01%3A_Binary_relations)</sup> 等价地，该关系被编码为布尔邻接矩阵，其中条目 \( (i, j) \) 记录第 \( i \) 个元素是否与第 \( j \) 个元素相关。

有向图视角还将关系与可达性联系起来。\( R \) 的传递闭包是包含 \( R \) 的最小传递关系；在有向图中，它恰好记录哪些顶点可以通过某条有向路径从哪些顶点到达，并且可以通过邻接矩阵的迭代布尔乘法计算，经典算法是沃舍尔（Warshall）算法。<sup>[12](https://cs.clarku.edu/~cs122/class/digraphs-relations/)</sup><sup> • </sup><sup>[13](https://www.math-cs.gordon.edu/courses/cs321/lectures/graphs.html)</sup>

## 关系的运算

由于关系是集合，它们继承并、交和补运算，但本学科特有的运算是关系运算。逆运算交换每个有序对，交换两个集合的角色。<sup>[8](https://plato.stanford.edu/archives/fall2011/entries/algebra-logic-tradition/)</sup>

这些运算是为逻辑目的而引入的。奥古斯都·德·摩根（Augustus De Morgan）在其六篇系列论文“论三段论”（1846年至1863年）中，在第二篇（1850年）中用一般的二元关系取代了系词“是”；允许三段论的两个前提中使用不同的关系，促使他引入复合来表达结论，以及逆运算和其他运算，其主要论文是第四篇（1860年），“论三段论第四篇及关系逻辑”。<sup>[8](https://plato.stanford.edu/archives/fall2011/entries/algebra-logic-tradition/)</sup> 美国逻辑学家和哲学家查尔斯·桑德斯·皮尔士（Charles Sanders Peirce）受那篇1860年论文的启发，于1870年将乔治·布尔（George Boole）的代数提升到二元关系，在并、交、补之外增加了复合和逆运算；他的论文“关系逻辑的一种记号描述”（1870年）被广泛认为引入了一阶谓词逻辑的基本词汇，并且通过使用无限制的并和交，他将量词引入了逻辑代数。虽然德·摩根被认为首次提出了关系的概念，但关系理论的实际奠基人通常被认为是皮尔士。<sup>[8](https://plato.stanford.edu/archives/fall2011/entries/algebra-logic-tradition/)</sup><sup> • </sup><sup>[14](https://plato.stanford.edu/entries/peirce-logic/)</sup> 德国数学家恩斯特·施罗德（Ernst Schröder，1841年至1902年）在其《逻辑代数》第三卷中考察了二元关系的逻辑代数，特别关注用其他关系符号表示其中一个关系符号来求解方程 \( E(x, y, z, \ldots) = 0 \)。<sup>[8](https://plato.stanford.edu/archives/fall2011/entries/algebra-logic-tradition/)</sup> 皮尔士的关系演算作为关系逻辑的一种替代性代数方法，仍然引人关注。<sup>[15](https://plato.stanford.edu/archives/win2003/entries/peirce-logic/)</sup>

## 超越有序对的关系及在计算中的应用

二元情形可以推广。一般关系由任意长度的元组组成：分别表示孩子、父亲和母亲的三元组 \( (c, f, m) \) 的亲属关系，或满足 \( x^2 + y^2 = z^2 \) 的三元组 \( (x, y, z) \) 的毕达哥拉斯关系。数据库关系不必是二元的，实践中通常也不是。<sup>[10](https://www.cs.utexas.edu/~misra/Classes.dir/ClassNotes.dir/337.pdf)</sup> 关系数据模型是数据库管理系统的核心，它将数据组织成称为关系的二维表，可以看作集合数据模型的推广，将二元关系扩展到任意结构的关系。<sup>[16](https://ebooks.inflibnet.ac.in/csp4/chapter/relational-model/)</sup>

二元关系也构成自己的范畴。范畴 Rel 以集合为对象、以二元关系为态射，是范畴论中一个被充分理解的部分，关系按上述链式方式复合。<sup>[17](https://mathoverflow.net/questions/33978/is-there-a-standard-notation-for-binary-relations-in-category-theory)</sup> 在基础方面，二元关系的标准理论——包括其运算、特殊性质的判据及其在这些运算下的不变性——已在类型论中形式化，作为证明助手的框架。<sup>[18](https://arxiv.org/abs/2102.08595)</sup>

## References

1. [Binary relations, Definition 7.1.2 and examples, Morris & Morris, *Proofs and Concepts*, via Mathematics LibreTexts](https://math.libretexts.org/Bookshelves/Mathematical_Logic_and_Proof/Proofs_and_Concepts_-_The_Fundamentals_of_Abstract_Mathematics_%28Morris_and_Morris%29/07%3A_Equivalence_relations/7.01%3A_Binary_relations)
2. [Sets, Functions, Relations, Open Logic Project](https://builds.openlogicproject.org/content/sets-functions-relations/sets-functions-relations.pdf)
3. [Basic Set Theory (relations, functions, ordered pairs), Stanford Encyclopedia of Philosophy, after Hrbacek & Jech, *Introduction to Set Theory*, 3rd ed.](https://plato.stanford.edu/archives/win2006/entries/set-theory/primer.html)
4. [Relations and Functions, Wichita State University discrete mathematics text](https://www.math.wichita.edu/discrete-book/sec_relationsfunctions.html)
5. [Equivalence Relations and Partial Order, Pamini Thangarajah, Mathematics LibreTexts](https://math.libretexts.org/Courses/Mount_Royal_University/Higher_Arithmetic/2%3A_Binary_relations/2.2%3A_Equivalence_Relations%2C_and_Partial_order)
6. [Sets and Relations, CS3 Data Structures & Algorithms, OpenDSA](https://opendsa-server.cs.vt.edu/ODSA/Books/umw/cpsc340/fall-2022/CPSC340_Fall2022_3/html/SetDef.html)
7. [Representing Relations With Digraphs And Matrices, A-Warded open discrete mathematics text](https://a-warded.org/open-book/university-discrete-mathematics/lesson-40)
8. [The Algebra of Logic Tradition, Stanford Encyclopedia of Philosophy (Fall 2011 edition)](https://plato.stanford.edu/archives/fall2011/entries/algebra-logic-tradition/)
9. [Elements of Set Theory (Kuratowski pair and Wiener 1914), Rutgers University](https://www.philosophy.rutgers.edu/joomlatools-files/docman-files/settheory_rpx.2.10.pdf)
10. [The Relational Data Model, course notes of Sriram Misra, University of Texas at Austin](https://www.cs.utexas.edu/~misra/Classes.dir/ClassNotes.dir/337.pdf)
11. [A Guide to Business Mathematics, applications of relations to databases](https://dspace.unililzone.com/api/core/bitstreams/b99d669f-6f3e-4ef2-9ec4-afeca04f3f08/content)
12. [Digraphs and Relations, lecture notes, Clark University](https://cs.clarku.edu/~cs122/class/digraphs-relations/)
13. [Graphs and Networks, Gordon College lecture notes (Warshall's algorithm)](https://www.math-cs.gordon.edu/courses/cs321/lectures/graphs.html)
14. [Peirce's Deductive Logic, Stanford Encyclopedia of Philosophy](https://plato.stanford.edu/entries/peirce-logic/)
15. [Peirce's Logic, Stanford Encyclopedia of Philosophy (Winter 2003 edition)](https://plato.stanford.edu/archives/win2003/entries/peirce-logic/)
16. [Relational Model, Database Management System, INFLIBNET e-books](https://ebooks.inflibnet.ac.in/csp4/chapter/relational-model/)
17. [Is there a standard notation for binary relations in category theory?, MathOverflow](https://mathoverflow.net/questions/33978/is-there-a-standard-notation-for-binary-relations-in-category-theory)
18. [Farida Kachapova (2021), Formalizing relations in type theory, arXiv](https://arxiv.org/abs/2102.08595)

---
*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: 物质世界与数学 › 数学与统计学 › 逻辑与离散数学 › Formal logic and foundations › Set theory › Elementary set theory

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/binary-relation

English original: https://www.edgepedia.org/binary-relation
