TITLE: Say $a=b$. Is "Do the same thing to both sides of an equation, and it still holds" an axiom?
QUESTION [51 upvotes]: Recently I have started reviewing mathematical notions, that I have always just accepted. Today it is one of the fundamental ones used in equations: 

If we have an equation, then the equation holds if we do the same to both sides. 

This seems perfectly obvious, but it must be stated as an axiom somewhere, presumably in formal logic(?). Only, I don't know what it would be called, or indeed how to search for it - does anybody knw?

REPLY [6 votes]: Any deterministic process that is performed on the same inputs will result in the same output. That is the definition of "deterministic". If two things are equal, then you're applying the same process to the same thing, so you get the same output. The expression "x = 5" is claiming that the symbol "x" and the symbol "5" represent the same value. Thus, "f(x)" and "f(5)" also must represent the same value, since they are both f applied to the same value.
In CS, the term "function" is sometimes used to refer to nondeterministic processes; for instance, "choose a random number from between 1 and n" might be considered a "function" of n by some programmers (though not functional programmers), even though the process applied to the same number can result in different outputs. So you do have to be sure that your process is deterministic.
Another issue one has to be careful abut is that the process takes values as inputs, not expressions. For instance, if $f$ represents the process "subtract 1 from the numerator and denominator", then $f(\frac{2}{3}) =\frac{1}{2} $ while $f(\frac{4}{6}) =\frac{3}{5} $  ; although the expressions $\frac{2}{3}$ and $\frac{4}{6}$ represent the same value, $f$ applied to them do not result in expressions that represent the same value, because $f$ is acting on the representations of those values, and not the values themselves. Sometimes, a process that is expressed as acting on the representation can still be well-defined as a function of the value. For instance, squaring the numerator and denominator results in the same value, regardless of what representation of a rational number you pick.
A final issue is that although a = b implies f(a) = f(b), f(a) = f(b) does not imply a = b. This means that not only do you have to be careful about "canceling" an operation that's been done to both sides, you also have to be careful about getting extraneous solutions.