# Logically speaking, why can variables be substituted?

Suppose that $$a^2+a+1=b$$ Suppose also that $a=5/4$. What makes it valid to substitute $5/4$ into the first equation? Is it because equality is transitive?

• It's by definition of equality and because in deductive systems there is a postulated rule that allows you to make such a substituion. Commented Oct 19, 2013 at 20:15
• @GitGud, what do you mean by postulated rule? Commented Oct 19, 2013 at 20:16
• I mean it's something that is true axiomatically. It's like that because you define it like that. Why is it that $1=1$ is true? It's by definition of equality, we define it that way. Commented Oct 19, 2013 at 20:17

It's just a basic principle of first-order logic with equality that if $a = b$ and $P(b)$ for a formula $P$, then $P(a)$. It's probably the most important aspect of equality that usually "goes without saying" in mathematics, except in logic courses.

• Does this principle have a name? Commented Oct 19, 2013 at 20:22
• @user101939 If you want to know the name to read about about it, you should look for first order logic with equality, predicate calculus with equality. Check this link. Commented Oct 19, 2013 at 20:27
• @user101939 It is called Leibniz law Commented Oct 19, 2013 at 20:32
• Yeah, I just call it the substitution property. Commented Oct 19, 2013 at 20:32

The reason why you can make such a substitution is that $a$ and $\dfrac{5}{4}$ are precisely the same, just written differently. Here's a long-winded way of making the substitution you describe.

\begin{align*} a &= \frac{5}{4} & \\ a^2 &= \left(\frac{5}{4}\right)^2 &\text{squaring both sides}\\ a^2 + a &= \left(\frac{5}{4}\right)^2 + \frac{5}{4} &\text{adding the first two lines}\\ a^2 + a + 1 &= \left(\frac{5}{4}\right)^2 + \frac{5}{4}+1 &\text{adding $1$ to both sides}\\ b &= \left(\frac{5}{4}\right)^2 + \frac{5}{4}+1 &\text{using the fact that $a$ satisfies the given equation} \end{align*}

The right hand side is precisely what you obtain when you replace $a$ by $\dfrac{5}{4}$.

There are at least two ways to understand equality.

One way to treat it is as a primitive logical identity sign: $a=b$ means that ‘$a$’ and ‘$b$’ are signs for the same thing. Since they represent one and the same object, any property that can be proved of the object represented by $a$ must also hold of the object represented by $b$, because they are the same object. In this case one automatically gets a general substitution principle: $a$ can be replaced by $b$ because they mean the same thing: they are names for the same object.

Another way to proceed is the way that ZF set theory does, and to take equality as a defined property. For example, ZF says that ‘$a=b$’ is an abbreviation for $$\forall x(x\in a\iff x\in b).$$

Two sets are defined to be equal if they contain the same elements. If one does this, substitution must be asserted axiomatically, or proved as a theorem. Without such a proof (trivial if substitution is an axiom) it might or might not hold. Transitivity is similar.

But the usual understanding in algebra is the first type: when we write something like ‘$x = \frac54$’ we mean that the name ‘$x$’ is a synonym for whatever object is denoted by $\frac54$.

• This isn’t quite accurate. Whether a logical system takes equality as a primitive relation or a defined one, one almost always gives the substitutivity property as an axiom or rule of the system. In principle one certainly could have a system where substitutivity was a theorem, but that’s not what’s done in most presentations of ZF(C), or any other standard theory I know. Commented Dec 19, 2013 at 3:29