Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I am sorry if this is quite elementary question. But I always think, that why we use $:=$ at some places, instead of $=$. Is there any fundamental difference between these two? Before reading Terry Tao's blog (4 months ago), I had never seen a symbol like this (:=).

share|improve this question
6  
The former is usually used for definitions. This is adapted from some programming languages. The notation is deliberately unsymmetrical... –  J. M. Sep 11 '11 at 14:41
    
@J. M. Oh.. I too thought the same, but wasn't sure. Because my first year math books have definition notation of this type: $\displaystyle {{=}^{\mathrm{def}}}$. –  gaurav Sep 11 '11 at 14:49
2  
2  
I've also seen $\stackrel{\Delta}{=}$ used for definitions. I don't think there is an established notation in general; most just use $=$ and indicate that it is a definition rather than a relation in the surrounding text. –  Rahul Sep 11 '11 at 15:32
add comment

2 Answers

up vote 8 down vote accepted

Some authors like to distinguish the assertion "A is equal to B" from "define A as an object equal to B".

In math, the first one is always $A=B$ (I've never seen anything else, at least). But for definitions, I've seen

  1. $A \triangleq B$
  2. $A \equiv B$
  3. $A \stackrel{\mathrm{def}}{=} B$
  4. $A := B$

Often the triple equal sign is used for strong notions of equivalence (such as in binary relations) or with the "mod" symbol.

In computer programming, we are typographically limited of course. The assignment operator is usually distinguished from the comparison operator, and this is done in different ways depending on the language. For example in Pascal you assign x := 5 and compare x = 5. However in C you assign x = 5 and compare x == 5. (It should be noted that in C this syntax has caused untold confusion and a few famous bugs.)

My favorite (meaning "most awful") example is in PHP and javascript where one can do a "strict compare" with x === 5. Finally, some languages have ridiculous vagaries like distinguishing which comparision operator is used based on the type of variable (usually strings being different from numerics), with syntaxes like .eq. and related.

share|improve this answer
    
better answer! Thanks. –  gaurav Sep 11 '11 at 15:37
    
"syntaxes like .eq. and related." - Heh... man, that sure was old... ;) –  J. M. Sep 11 '11 at 15:41
    
@J.M. Yeah, .eq. is FORTRAN77 (I'm showing my age here). –  Fixee Sep 11 '11 at 15:42
    
I know; I've had the pleasure of re-implementing old code... :D –  J. M. Sep 11 '11 at 15:43
add comment

The notation := was used in some early programming languages. The meaning of x := 3 was "assign 3 to the variable x". So, the assignment could be distinguished from the the test if (x = 3) .... In mathematics the obvious meaning is "Let x be 3".

Modern programming languages use x = 3 for the assignment, and == for the equality test if (x == 3) ....

share|improve this answer
    
"Early" and "modern", eh? You may find some disagreement with those characterizations. –  GEdgar Sep 11 '11 at 16:59
    
@Edgar: I know ... I did't find a better characterization at the moment of writing. I thought of Algol, Pascal with ':=', and Java, Javascript, C++, Python with '='. But I know the old C, Fortran with "=", etc. I wanted to say that I don't see ':=' so often today but surely there are some. Well, perhaps I should have written in some ones is ':=' and in other ones is '='. –  Jiri Sep 11 '11 at 19:03
    
Mathematica uses := and = as (delayed and immediate) assignment operators, and == for equality comparisons. –  J. M. Sep 11 '11 at 21:37
    
Early and modern seems pretty accurate. Languages that don't use "==" for comparison or "=" for assignment could be called post-modern. :) –  Andres Riofrio Mar 20 '12 at 18:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.