History
The equals sign, while almost universally recognizable today (unlike, ironically, the universal quantifier, ∀), is a fairly recent phenomenon, when compared to geometry, algebra, etc. In earlier mathematical writings, if a writer wanted to assert that two quantities were equal, he wrote, "<thing 1> is equal to <thing 2>." In long proofs, this phrase took up a surprisingly large portion of the entire text, as equation after equation was presented.
In 1557, a solution was proposed by Robert Redcorde. In his book The Whetstone of Witte, Robert introduced some of his own shorthand: "to avoid the tediouse repetition of these woordes: is equalle to: I will sette as I doe often in woorke use, a pair of paralleles, or Gemowe lines of one lengthe, thus: =, bicause noe 2 thynges, can be maore equalle."1
This notation was so convenient that it eventually became widely adopted. It is interesting to note, however, that it did not immediately catch on. Some liked the idea but thought the lines should be vertical, as in ||, and others wanted to use æ, short for the Latin æqualis2.
Derived Symbols3
- ≠: Not equal to (the slash indicates negation). != is a modification of this symbol to accommodate ASCII keyboards (!= looks vaguely like ≠, if you squint).
- ≈: Approximately equal to. The squiggly lines suggest imprecision, I guess.
- ∼: Similar to, as in geometric shapes with the same proportions but different absolute sizes. Looks very much like the tilde character, ~, but is technically different according to the Unicode spec (i.e., strange fonts may render "similar" and "tilde" differently).
- ≡ has two meanings:
- Indicates equivalence or identity. This is usually a stronger assertion than equality. For example, if a is 5, then it is true that a=5, but it is not true that a≡5, because it would be invalid to replace 5 with a anywhere we see it. ≡ is usually used in geometry, to state that two shapes are congruent, rather than just similar.
- In modular arithmetic, indicates congruence under a certain modulus. Usually used as in 5≡8 (mod 3), meaning that 5 and 8 differ by a multiple of 3 (more concisely, 3 divides 8 - 5).
- ≅: Congruent to. Used in the same context as meaning 1 of ≡. This is rarely, if ever, used for anything but geometrical identities.
Usage
Mathematics
The = sign is used to assert that the expression on its left side is equal to the expression on its right side. A common technique for deriving or proving something is to start with a known fact, stated as lhs0=rhs0, and then manipulate it to yield lhs1=rhs1, continuing until an equation containing the desired quantity is obtained.
Because the = symbol asserts that its operands are equal, this makes them interchangeable as well. So, given the equation F=ma, and another equation involving F, we can replace F with ma everywhere in the second equation. This helps to combine multiple facts by synthesizing them into another, new fact.
Programming
Disclaimer: The single character '=' can mean different things in different languages. Look at the specification for your language or compiler before recklessly using = in your own programs. Also, this list of languages is not complete, and never will be.
With that said, however, = almost always means one of two things: assignment or equality.
- Assigment: This is the trend in current, C-like languages, such as C, C++, C#, and Java, as well as the BASIC family and Perl. It instructs the computer to store the value of the right-hand side into the location on the left-hand side. It is important, then, that the left-hand side be a valid lvalue in this context. If the language is typed, then the RHS must be coerced into the type of the LHS. If this is not possible, a compiler error usually results.
- Equality: This is used in languages with a more mathematical structure, rather than the more algorithmic flavor of some languages. Examples include LISP, Prolog, the BASIC family (again!), and Pascal. When used in this way, the = operator tests its two operands for equality. The = expression evaluates to either true or false (or an equivalent for the language), depending on the values of its operands.
Both of these functions are necessary to create a flexible language, and so both sets of languages have some way of accessing the "alternate" functionality of the = operator. C-like languages usually use == for equality, and Perl uses eq or others, depending on context. LISP uses set or a variant, and Pascal uses := (pronounced "gets"). Due to the nature of Prolog, assignment and testing for equality are usually synonymous (!!), but in some cases the "is" operator is used to force assignment. In the BASIC family, = is used for both functions, being interpreted differently depending on context.
This can serve as a source of confusion for novice programmers, who have a tendency to use plain old = for both functions, which can be a tricky bug to catch. It's also a source of problems for experienced programmers who are just a little tired or sloppy. In this case it can be even harder to find, because experienced programmers know they are above such typos and won't even look for them. Note that some languages make this harder to do than others. In C, ints and booleans are the same thing, so it's easy to slip up. Java, for example, does not allow an int where a boolean is expected, so this is harder. However, if you want to compare two boolean values, it's possible to accidentally perform assignment instead.
1 http://members.aol.com/jeff94100/witte.jpg
2 http://www-history.mcs.st-and.ac.uk/Mathematicians/Recorde.html
3 IE users may have trouble viewing some of these symbols. This appears to be because IE does not have as much support for Unicode as FF. In particular, when I open this page with IE, "Congruent to" does not display correctly, and all three of "Congruent to", "Similar to", and "Equivalent to" have funny tooltips on their links. I can't seem to fix this, but if you have an idea let me know.