# Equality (mathematics)

In mathematics, equality is a relationship between two quantities or expressions, stating that they have the same value, or represent the same mathematical object. Equality between A and B is written A = B, and pronounced "A equals B". In this equality, A and B are distinguished by calling them left-hand side (LHS), and right-hand side (RHS). Two objects that are not equal are said to be "distinct".
Equality is often considered a kind of primitive notion, meaning, it is not formally defined, but rather informally said to be "a relation each thing bears to itself and nothing else". This characterization is notably circular ("nothing else"). This makes equality a somewhat slippery idea to pin down.
Basic properties about equality like reflexivity, symmetry, and transitivity have been understood intuitively since at least the ancient Greeks, but weren't symbolically stated as general properties of relations until the late 19th century by Giuseppe Peano. Other properties like substitution and function application weren't formally stated until the development of symbolic logic.
There are generally two ways that equality is formalized in mathematics: through logic or through set theory. In logic, equality is a primitive predicate (a statement that may have free variables) with the reflexive property (called the Law of identity), and the substitution property. From those, one can derive the rest of the properties usually needed for equality. Logic also defines the principle of extensionality, which defines two objects of a certain kind to be equal if they satisfy the same external property (See the example of sets below).
After the foundational crisis in mathematics at the turn of the 20th century, set theory (specifically Zermelo–Fraenkel set theory) became the most common foundation of mathematics in order to resolve the crisis. In set theory, any two sets are defined to be equal if they have all the same members. This is called the Axiom of extensionality. Usually set theory is defined within logic, and therefore uses the equality described above, however, if a logic system does not have equality, it is possible to define equality within set theory.

## Etymology

In English, the word equal is derived from the Latin aequālis ('like', 'comparable', 'similar'), which itself stems from aequus ('level', 'just'). The word entered Middle English around the 14th century, borrowed from Old French equalité (modern égalité). More generally, the interlingual synonyms of equal have been used more broadly throughout history (see § Geometry).
Before the 16th century, there was no common symbol for equality, and equality was usually expressed with a word, such as aequales, aequantur, esgale, faciunt, ghelijck, or gleich, and sometimes by the abbreviated form aeq, or simply ⟨æ⟩ and ⟨œ⟩. Diophantus's use of ⟨ἴσ⟩, short for ἴσος (ísos 'equals'), in Arithmetica (c. 250 AD) is considered one of the first uses of an equals sign.
The sign =, now universally accepted in mathematics for equality, was first recorded by Welsh mathematician Robert Recorde in The Whetstone of Witte (1557). The original form of the symbol was much wider than the present form. In his book, Recorde explains his symbol as "Gemowe lines", from the Latin gemellus ('twin'), using two parallel lines to represent equality because he believed that "no two things could be more equal."
Recorde's symbol was not immediately popular. After its introduction, it wasn't used again in print until 1618 (61 years later), in an anonymous Appendix in Edward Wright's English translation of Descriptio, by John Napier. It wasn't until 1631 that it received more than general recognition in England, being adopted as the symbol for equality in a few influential works. Later used by several influential mathematicians, most notably, both Isaac Newton and Gottfried Leibnitz, and due to the prevalence of calculus at the time, it quickly spread throughout the rest of Europe.

## Basic properties
### Reflexivity

       For every a, one has a = a.

### Symmetry

       For every a and b, if a = b, then b = a.

### Transitivity

       For every a, b, and c, if a = b and b = c, then a = c.

### Substitution

       Informally, this just means that if a = b, then a can replace b in any mathematical expression or formula without changing its meaning. (For a formal explanation, see § Axioms) For example:Given real numbers a and b, if a = b, then $a>0$ implies $b>0$.

### Operation application

       For every a and b, with some operation $f(x)$, if a = b, then $f(a)=f(b)$. For example:Given integers a and b, if a = b, then $3a+1=3b+1$. (Here, $f(x)=3x+1$, a unary operation.)Given natural numbers a, b, c, and d, if $a^{2}=2b^{2}$ and $c=d\neq 0$, then $a^{2}/c=2b^{2}/d$. (Here, $f(x,y)=x/y$, a binary operation.)Given real functions ⁠$g$⁠ and ⁠$h$⁠ over some variable a, if $g(a)=h(a)$ for all a, then d/da g(a)=d/da h(a){\textstyle {\frac {d}{da}}g(a)={\frac {d}{da}}h(a)} for all a. (Here, f(x)=dx/da {\textstyle f(x)={\frac {dx}{da}}}. An operation over functions (i.e. an operator), called the derivative).
The first three properties are generally attributed to Giuseppe Peano for being the first to explicitly state these as fundamental properties of equality in his Arithmetices principia (1889). However, the basic notions have always existed; for example, in Euclid's Elements (c. 300 BC), he includes 'common notions': "Things that are equal to the same thing are also equal to one another" (transitivity), "Things that coincide with one another are equal to one another" (reflexivity), along with some operation-application properties for addition and subtraction. The operation-application property was also stated in Peano's Arithmetices principia, however, it had been common practice in algebra since at least Diophantus (c. 250 AD). The substitution property is generally attributed to Gottfried Leibniz (c. 1686), and often called Leibniz Law.

## Equations

An equation is a symbolic equality of two mathematical expressions connected with an equals sign (=). Algebra is the branch of mathematics concerned with equation solving: the problem of finding values of some variable, called unknown, for which the specified equality is true. Each value of the unknown for which the equation holds is called a solution of the given equation; also stated as satisfying the equation. For example, the equation $x^{2}-6x+5=0$ has the values $x=1$ and $x=5$ as its only solutions. The terminology is used similarly for equations with several unknowns. The set of solutions to an equation or system of equations is called its solution set. For example, the set of all solution pairs $(x,y)$ of the equation $x^{2}+y^{2}=1$ forms the unit circle in analytic geometry; therefore, this equation is called the equation of the unit circle.
In mathematical logic and computer science, an equation may described as a binary formula or Boolean-valued expression, which may be true for some values of the variables (if any) and false for other values. More specifically, an equation represents a binary relation (i.e., a two-argument predicate) which may produce a truth value (true or false) from its arguments. In computer programming, the computation from the two expressions is known as comparison.

### Identities

An identity is an equality that is true for all values of its variables in a given domain. An "equation" may sometimes mean an identity, but more often than not, it specifies a subset of the variable space to be the subset where the equation is true. An example is $\left(x+1\right)\left(x+1\right)=x^{2}+2x+1$, which is true for each real number $x$. There is no standard notation that distinguishes an equation from an identity, or other use of the equality relation: one has to guess an appropriate interpretation from the semantics of expressions and the context. Sometimes, but not always, an identity is written with a triple bar: $\left(x+1\right)\left(x+1\right)\equiv x^{2}+2x+1.$ This notation was introduced by Bernhard Riemann in his 1857 Elliptische Funktionen lectures (published in 1899).
Alternatively, identities may be viewed as an equality of functions, where instead of writing $f(a)=g(a){\text{ for all }}a$, one may simply write $f=g$. This is called the extensionality of functions. Viewed like this, the operation-application property still applies, but here, the operations are operators on a function space (a function acting on functions) like composition and the derivative, or functionals like function evaluation or the integral.

### Definitions

Equations are often used to introduce new terms or symbols for constants, assert equalities, and introduce shorthand for complex expressions, which is called "equal by definition", and often denoted with ($:=$). It is similar to the concept of assignment of a variable in computer science. For example, e:=∑$_{n=0}$$^∞$ 1/n! {\textstyle \mathbb {e} :=\sum _{n=0}^{\infty }{\frac {1}{n!}}} defines Euler's number, and $i^{2}=-1$ is the defining property of the imaginary number $i$.
In mathematical logic, this is called an extension by definition (by equality) which is a conservative extension to a formal system. This is done by taking the equation defining the new constant symbol as a new axiom of the theory. The first recorded symbolic use of "Equal by definition" appeared in Logica Matematica (1894) by Cesare Burali-Forti, an Italian mathematician. Burali-Forti, in his book, used the notation ($=_{\text{Def}}$).

## In logic
### History

Equality is often considered a primitive notion, informally said to be "a relation each thing bears to itself and to no other thing". This tradition can be traced back to at least 350 BC by Aristotle: in his Categories, he defines the notion of quantity in terms of a more primitive equality (distinct from identity or similarity), stating:
   "The most distinctive mark of quantity is that equality and inequality are predicated of it. Each of the aforesaid quantities is said to be equal or unequal. For instance, one solid is said to be equal or unequal to another; number, too, and time can have these terms applied to them, indeed can all those kinds of quantity that have been mentioned. That which is not a quantity can by no means, it would seem, be termed equal or unequal to anything else. One particular disposition or one particular quality, such as whiteness, is by no means compared with another in terms of equality and inequality but rather in terms of similarity. Thus it is the distinctive mark of quantity that it can be called equal and unequal." ― (Translated by E. M. Edghill)
Aristotle had separate categories for quantities (number, length, volume) and qualities (temperature, density, pressure), now called intensive and extensive properties. The Scholastics, particularly Richard Swineshead and other Oxford Calculators in the 14th century, began seriously thinking about kinematics and quantitative treatment of qualities. For example, two flames have the same heat-intensity if they produce the same effect on water (e.g, warming vs boiling). Since two intensities could be shown to be equal, and equality was considered the defining feature of quantities, it meant those intensities were quantifiable.
Around the 19th century, with the growth of modern logic, it became necessary to have a more concrete description of equality. With the rise of predicate logic due to the work of Gottlob Frege, logic shifted from being focused on classes of objects to being property-based. This was followed by a movement for describing mathematics in logical foundations, called logicism. This trend lead to the axiomatization of equality through the law of identity and the substitution property especially in mathematical logic and analytic philosophy.
The precursor to the substitution property of equality was first formulated by Gottfried Leibniz in his Discourse on Metaphysics (1686), stating, roughly, that "No two distinct things can have all properties in common." This has since broken into two principles, the substitution property (if $x=y$, then any property of $x$ is a property of $y$), and its converse, the identity of indiscernibles (if $x$ and $y$ have all properties in common, then $x=y$). Its introduction to logic, and first symbolic formulation is due to Bertrand Russell and Alfred Whitehead in their Principia Mathematica (1910), who claim it follows from their axiom of reducibility, but credit Leibniz for the idea.

### Axioms

Law of identity: Stating that each thing is identical with itself, without restriction. That is, for every $a$, $a=a$. It is the first of the traditional three laws of thought. Stated symbolically as:
   $\forall a(a=a)$
Substitution property: Sometimes referred to as Leibniz's law, generally states that if two things are equal, then any property of one must be a property of the other. It can be stated formally as: for every a and b, and any formula $\phi (x),$ (with a free variable x), if $a=b$, then $\phi (a)$ implies $\phi (b)$. Stated symbolically as:
   $(a=b)\implies {\bigl\phi (a)\Rightarrow \phi (b){\bigr ]}$
Function application is also sometimes included in the axioms of equality, but isn't necessary as it can be deduced from the other two axioms, and similarly for symmetry and transitivity. (See § Derivations of basic properties) In first-order logic, these are axiom schemas (usually, see below), each of which specify an infinite set of axioms. If a theory has a predicate that satisfies the Law of Identity and Substitution property, it is common to say that it "has equality," or is "a theory with equality."
The use of "equality" here somewhat of a misnomer in that any system with equality can be modeled by a theory without standard identity. Those two axioms are strong enough, however, to be isomorphic to a model with idenitity; that is, if a system has a predicate staisfying those axioms without standard equality, there is a model of that system with standard equality. If, however, one is given that a predicate is true equality, then those properties are enough, since if $x$ has all the same properties as $y$, and $x$ has the property of being equal to $x$, then $y$ has the property of being equal to $x$.
As axioms, one can deduce from the first using universal instantiation, and the from second, given $a=b$ and $\phi (a)$, by using modus ponens twice. Alternatively, each of these may be included in logic as rules of inference. The first called "equality introduction", and the second "equality elimination" (also called paramodulation), used by some theoretical computer scientists like John Alan Robinson in their work on resolution and automated theorem proving.

### Derivations of basic properties

* Reflexivity of Equality: This follows immediately from the Law of Identity.
* Symmetry of Equality: Given $a=b$, take the formula $\phi (x):x=a$. So we have $(a=b)\implies ((a=a)\Rightarrow (b=a))$. Since $a=b$ by assumption, and $a=a$ by Reflexivity, we have that $b=a$.
* Transitivity of Equality: Given $a=b$ and $b=c$, take the formula $\phi (x):x=c$. So we have $(b=a)\implies ((b=c)\Rightarrow (a=c))$. Since $b=a$ by symmetry, and $b=c$ by assumption, we have that $a=c$.
* Function application: Given some function $f(x)$, assume there are elements a and b from its domain such that a = b, then take the formula $\phi (x):f(a)=f(x)$. So we have $(a=b)\implies [(f(a)=f(a))\Rightarrow (f(a)=f(b))]$ Since $a=b$ by assumption, and $f(a)=f(a)$ by reflexivity, we have that $f(a)=f(b)$.

## In set theory

Set theory is the branch of mathematics that studies sets, which can be informally described as "collections of objects." Although objects of any kind can be collected into a set, set theory – as a branch of mathematics – is mostly concerned with those that are relevant to mathematics as a whole. Sets are uniquely characterized by their elements; this means that two sets that have precisely the same elements are equal (they are the same set). In a formalized set theory, this is usually defined by an axiom called the Axiom of extensionality.
For example, using set builder notation,
    $\{x\in \mathbb {Z} \mid 0<x\leq 3\}=\{1,2,3\},$
Which states that "The set of all integers greater than 0 but not more than 3 is equal to the set containing only 1, 2, and 3", despite the differences in notation.
José Ferreirós credits Richard Dedekind for being the first to explicitly state the principle, (although he does not assert it as a definition):
   "It very frequently happens that different things a, b, c... considered for any reason under a common point of view, are collected together in the mind, and one then says that they form a system S; one calls the things a, b, c... the elements of the system S, they are contained in S; conversely, S consists of these elements. Such a system S (or a collection, a manifold, a totality), as an object of our thought, is likewise a thing; it is completely determined when, for every thing, it is determined whether it is an element of S or not." ― Richard Dedekind, 1888 (Translated by José Ferreirós)

### Background

Around the turn of the 20th century, mathematics faced several paradoxes and counter-intuitive results. For example, Russell's paradox showed a contradiction of naive set theory, it was shown that the parallel postulate cannot be proved, the existence of mathematical objects that cannot be computed or explicitly described, and the existence of theorems of arithmetic that cannot be proved with Peano arithmetic. The result was a foundational crisis of mathematics.
The resolution of this crisis involved the rise of a new mathematical discipline called mathematical logic, which studies formal logic within mathematics. Subsequent discoveries in the 20th century then stabilized the foundations of mathematics into a coherent framework valid for all mathematics. This framework is based on a systematic use of axiomatic method and on set theory, specifically Zermelo–Fraenkel set theory, developed by Ernst Zermelo and Abraham Fraenkel. This set theory (and set theory in general) is now considered the most common foundation of mathematics.

### Set equality based on first-order logic with equality

In first-order logic with equality (See § Axioms), the axiom of extensionality states that two sets that contain the same elements are the same set.
* Logic axiom: $x=y\implies \forall z,(z\in x\iff z\in y)$
* Logic axiom: $x=y\implies \forall z,(x\in z\iff y\in z)$
* Set theory axiom: $(\forall z,(z\in x\iff z\in y))\implies x=y$
The first two are given by the substitution property of equality from first-order logic; the last is a new axiom of the theory. Incorporating half of the work into the first-order logic may be regarded as a mere matter of convenience, as noted by Azriel Lévy.
    "The reason why we take up first-order predicate calculus with equality is a matter of convenience; by this, we save the labor of defining equality and proving all its properties; this burden is now assumed by the logic."

### Set equality based on first-order logic without equality

In first-order logic without equality, two sets are defined to be equal if they contain the same elements. Then the axiom of extensionality states that two equal sets are contained in the same sets.
* Set theory definition: $(x=y)\ :=\ \forall z,(z\in x\iff z\in y)$
* Set theory axiom: $x=y\implies \forall z,(x\in z\iff y\in z)$
Or, equivalently, one may choose to define equality in a way that mimics, the substitution property explicitly, as the conjunction of all atomic formuals:
* Set theory definition: $(x=y):=$$\;\forall z(z\in x\implies z\in y)\,\land \,$$\forall w(x\in w\implies y\in w)$
* Set theory axiom: $(\forall z,(z\in x\iff z\in y))\implies x=y$
In either case, the Axiom of Extensionality based on first-order logic without equality states:
* $\forall z(z\in x\Rightarrow z\in y)\implies \forall w(x\in w\Rightarrow y\in w)$

### Proof of basic properties

* Reflexivity: Given a set $X$, assume $z\in X$, it follows trivially that $z\in X$, and the same follows in reverse, therefore $\forall z,(z\in X\iff z\in X)$ , thus $X=X$.
* Symmetry: Given sets $X,Y$, such that $X=Y$, then $\forall z,(z\in X\iff z\in Y)$, which implies $\forall z,(z\in Y\iff z\in X)$, thus $Y=X$.
* Transitivity: Given sets $X,Y,Z$, such that (1) $X=Y$ and (2) $Y=Z$, assume $z\in X$, then $z\in Y$ by (1), which implies $z\in Z$ by (2), and similarly for the reverse, therefore $\forall z,(z\in X\iff z\in Z)$, thus $X=Z$.
* Function application: Given $a=b$ and $f(a)=c$, then $(a,c)\in f$. Since $a=b$ and $c=c$, then $(a,c)=(b,c)$. This is the defining property of an ordered pair. Since $(a,c)=(b,c),$ by the Axiom of Extensionality, they must belong to the same sets, so, since $(a,c)\in f,$ we have $(b,c)\in f,$ or $f(b)=c.$ Thus $f(a)=f(b).$

## Similar relations
### Approximate equality

Numerical approximation is the study of algorithms that use numerical approximation (as opposed to symbolic manipulations) for the problems of mathematical analysis.
Calculations are likely to involve rounding errors and other approximation errors. Log tables, slide rules, and calculators produce approximate answers to all but the simplest calculations. The results of computer calculations are normally an approximation, expressed in a limited number of significant digits, although they can be programmed to produce more precise results.
If viewed as a binary relation, (denoted by the symbol $\approx$) between real numbers or other things, if precisely defined, is not an equivalence relation since it's not transitive, even if modeled as a fuzzy relation.
In computer science, equality is given by some relational operator. Real numbers are often approximated by floating-point numbers (A sequence of some fixed number of digits of a given base, scaled by an integer exponent of that base), thus it is common to store an expression that denotes the real number as to not lose precision. However, the equality of two real numbers given by an expression is known to be undecidable (specifically, real numbers defined by expressions involving the integers, the basic arithmetic operations, the logarithm and the exponential function). In other words, there cannot exist any algorithm for deciding such an equality (see Richardson's theorem).

### Equivalence relation

An equivalence relation is a mathematical relation that generalizes the idea of similarity or sameness. It is defined on a set $X$ as a binary relation $\sim$ that satisfies the three properties: reflexivity, symmetry, and transitivity. Reflexivity means that every element in $X$ is equivalent to itself ($a\sim a$ for all $a\in X$). Symmetry requires that if one element is equivalent to another, the reverse also holds ($a\sim b\implies b\sim a$). Transitivity ensures that if one element is equivalent to a second, and the second to a third, then the first is equivalent to the third ($a\sim b$ and $b\sim c\implies a\sim c$). These properties are enough to partition a set into disjoint equivalence classes. Conversely, every partition defines an equivalence class.
The equivalence relation of equality is a special case, as, if restricted to a given set $S$, it is the strictest possible equivalence relation on $S$; specifically, equality partitions a set into equivalence classes consisting of all singleton sets. Other equivalence relations, since they're less restrictive, generalize equality by identifying elements based on shared properties or transformations, such as congruence in modular arithmetic or similarity in geometry.

#### Congruence relation

In abstract algebra, a congruence relation extends the idea of an equivalence relation to include the operation-application property. That is, given a set $X$, and a set of operations on $X$, then a congruence relation $\sim$ has the property that $a\sim b\implies f(a)\sim f(b)$ for all operations $f$ (here, written as unary to avoid cumbersome notation, but $f$ may be of any arity). A congruence relation on an algebraic structure such as a group, ring, or module is an equivalence relation that respects the operations defined on that structure.

### Isomorphism

In mathematics, especially in abstract algebra and category theory, it is common to deal with objects that already have some internal structure. An isomorphism describes a kind of structure-preserving correspondence between two objects, establishing them as essentially identical in their structure or properties.
More formally, an isomorphism is a bijective mapping (or morphism) $f$ between two sets or structures $A$ and $B$ such that $f$ and its inverse $f^{-1}$ preserve the operations, relations, or functions defined on those structures. This means that any operation or relation valid in $A$ corresponds precisely to the operation or relation in $B$ under the mapping. For example, in group theory, a group isomorphism $f:G\mapsto H$ satisfies $f(a*b)=f(a)*f(b)$ for all elements $a,b$, where $*$ denotes the group operation.
When two objects or systems are isomorphic, they are considered indistinguishable in terms of their internal structure, even though their elements or representations may differ. For instance, all cyclic groups of order $\infty$ are isomorphic to the integers, $\mathbb {Z}$, with addition. Similarly, in linear algebra, two vector spaces are isomorphic if they have the same dimension, as there exists a linear bijection between their elements.
The concept of isomorphism extends to numerous branches of mathematics, including graph theory (graph isomorphism), topology (homeomorphism), and algebra (group and ring isomorpisms), among others. Isomorphisms facilitate the classification of mathematical entities and enable the transfer of results and techniques between similar systems. Bridging the gap between isomorphism and equality was one motivation for the development of category theory, as well as for homotopy type theory and univalent foundations.

### Geometry

In geometry, formally, two figures are equal if they contain exactly the same points. However, historically, geometric-equality has always been taken to be much broader. Euclid and Archimedes used "equal" (ἴσος isos) often referring to figures with the same area or those that could be cut and rearranged to form one another. For example, Euclid stated the Pythagorean theorem as “the square on the hypotenuse is equal to the squares on the sides, taken together”; and Archimedes said that “a circle is equal to the rectangle whose sides are the radius and half the circumference.”
This notion persisted until Adrien-Marie Legendre, who introduced the term "equivalent" to describe figures of equal area and restricted "equal" to what we now call “congruent”—the same shape and size, or if one has the same shape and size as the mirror image of the other. Euclid's terminology continued in the work of David Hilbert in his Grundlagen der Geometrie, who further refined Euclid's ideas by introducing the notions of polygons being "divisibly equal" (zerlegungsgleich) if they can be cut into finitely many triangles which are congruent, and "equal in content" (inhaltsgleichheit) if one can add finitely many divisibly equal polygons to each such that the resulting polygons are divisibly equal.
After the rise of set theory, around the 1960s, there was a push for a reform in mathematics education called New Math, following Andrey Kolmogorov, who, in an effort to restructure Russian geometry courses, proposed presenting geometry through the lens of transformations and set theory. Since a figure was seen as a set of points, it could only be equal to itself, as a result of Kolmogorov, the term "congruent" became standard in schools for figures that were previously called "equal", which popularized the term.
While Euclid addressed proportionality and figures of the same shape, it wasn’t until the 17th century that the concept of similarity was formalized in the modern sense. Similar figures are those that have the same shape but can differ in size; they can be transformed into one another by scaling and congruence. Later a concept of equality of directed line segments, equipollence, was advanced by Giusto Bellavitis in 1835.