78

What does := mean?

bobobobo
  • 9,502
ilhan
  • 973

2 Answers2

94

It is borrowed from computer programming: it means that the item on the left hand side is being defined to be what is on the right hand side. For example, $$y := 7x+2$$ means that $y$ is defined to be $7x+2$.

This is different from, say, writing $$1 = \sin^2(\theta) + \cos^2(\theta)$$ where we are saying that the two sides are equal, but we are not defining "1" to be the expression "$\sin^2(\theta) + \cos^2(\theta)$".

Basically, some people think that there should be notational difference between saying "I define blah to be equal to blankety" and saying "blah is equal to blankety". So they use := for the first and = for the latter. Usually, it is clear from context which of the two uses of the equal sign is intended (often because of signal words like "Let", "We define", etc.)

Arturo Magidin
  • 398,050
  • 10
    Are you sure it comes from CS? I study CS and see $:=$ mainly in maths/theory contexts. Programming languages use = and == nowadays. I have also seen $\leftarrow$ in the context of formal semantics, but hardly ever $:=$. – Raphael Mar 05 '11 at 23:24
  • @Raphael The := is used in pseudocode. – Mateen Ulhaq Mar 05 '11 at 23:34
  • Some remarks: (a) usage of := is not universally accepted in mathematics (b) it's best to avoid the use of e.g.: "Define y:=7x+2", where the "define" appears twice. – Douglas S. Stones Mar 06 '11 at 02:16
  • @Raphael: The use of = and == dates back only as far as C, which was the first to use = for assignation and == for comparison. := was used in Pascal, among others. – Arturo Magidin Mar 06 '11 at 03:03
  • 13
    FORTRAN used = for assignment and .EQ. for comparison. ALGOL used := for assignment and = for comparison. I'm showing my age. – Ross Millikan Mar 06 '11 at 03:27
  • PL/SQL (Oracle) also uses := for assignment. – Rob P. Mar 06 '11 at 03:40
  • := is used in Mathcad to mean " equals by definition. – Mykie Mar 06 '11 at 04:29
  • Seconding Douglas's comment, $:=$ is nowhere near a universal convention (I assume this is what he means by "accepted"; many people "accept" it but do not themselves use it). As the OP's experience shows, it is good practice to explain what it means, once, before using it in writing. I have no idea of its history but my impression is that it does not predate computer programming. (It seems more popular with younger people and people who use computers than with others.) – anon Mar 06 '11 at 04:56
  • 3
    @Raphael: Perhaps "computer programming" is a better description for what I had in mind, so I have changed it as such. As far as I am aware, it was indeed derived from certain computer languages that used := for assignment. – Arturo Magidin Mar 06 '11 at 05:02
  • 6
    Other symbols I have seen used for "is defined to be equal to" are three horizontal lines instead of two, and $=$ with either a triangle or "def" written directly above it. I have seen variants of these used by people who predate widespread knowledge of computer programming. It would be interesting to know the earliest uses of a special symbol for this (and what symbols were chosen). An advantage of $:=$ is that it has a partner, $=:$, allowing it to distinguish which side is equal to the other by definition. Nine times out of ten it is the left, but the flexibility is nice. – anon Mar 06 '11 at 05:02
  • In my experience, most mathematicians prefer to reserve $\equiv$ for equivalence relations (as in $x \equiv 3 \pmod{4}$). – Nate Eldredge Mar 06 '11 at 05:53
  • 1
    "The Comprehensive $\LaTeX$ Symbol List" (http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-a4.pdf) says: "discussions on comp.text.tex have revealed that there are a variety of ways to indicate the mathematical notion of “is defined as”. Common candidates include “$\triangleq$” (\triangleq), “$\equiv$” (\equiv), “$:=$” (various), and “$\stackrel{\text{def}}{=}$” (\stackrel{\text{\tiny def}}{=})." – joriki Mar 06 '11 at 14:45
  • 4
    I was aware of Pascal using :=, but not the others. I think it is possible that the language designers of that time where influenced by maths (as has happened a number of times), but := is so far the only easily typable symbol mentioned here, so it is perfectly reasonable to assume it stems from programming languages in the first place. For completeness, I have seen an older TCS-prof (former mathematician) use $=_{df}$ consistently. There might have been an e in there, but not legible. – Raphael Mar 06 '11 at 15:36
  • Mathematica also uses := for creating dynamically evaluated functions. f[x_]:=x^2 evaluates independently every time f[2] is requested, while g[x_]=x^2 evaluates only once and stores the value to be recalled upon request. If g is changed in the future, the original value that was requested is returned. Individual needs determine which one wins the time vs. space efficiency battle. – bzc Mar 18 '11 at 16:44
  • I think it comes from Pascal as mentioned above, but I am trying to think of any examples of languages proceeding pascal with the same notation. I cannot think of any. – John Alexiou Mar 18 '11 at 19:50
  • I have also seen following$\triangleq$, $\equiv$, $\cong$, $\doteq $ : perhaps it means equal in value, congruential, or numerically equal but not numerically identical events, or equal as a comparability relation (congruence) or in order theory,. Something short of '=', which in a total order which means identity Inumeriacl identity of the events)a – William Balthes Oct 12 '17 at 10:02
  • lthough entities can have the same number and be numerically equal in value but not numerically identical, identical (so its a little confusing as to what '=' means in a total order, particular if multi-imensional. where both orders are numerical,particularly when \equiv which is defined as the identity symbol is often used for the weaker 'equal in value' between two events whose values in the domain rank are numerically equal yet are not numerically identical events (and particularly given that $\equiv $ is often defined as 'identity'as above not just equivalence or congruence – William Balthes Oct 12 '17 at 10:07
  • I know I'm a little late to the party. But does =: mean the same thing? I've seen the symbol reversed being used and can't find a definite answer. I suspect it does though. – generic purple turtle Nov 20 '20 at 16:03
  • @genericpurpleturtle: I would expect that to mean that the object on the right is defined to be whatever expression is on the left. E.g., instead of $f(x):= 2x+1$, you could have $2x+1 =: f(x)$. But again, this is not standard mathematical notation that has a universal understanding of its meaning, the way other symbols do. – Arturo Magidin Nov 20 '20 at 16:40
  • Can you also use the opposite, i.e. $=:$ if the definition is from the right? For example I have a long derivation, and now I want to define the result by a new symbol? – Maverick Meerkat Dec 15 '20 at 09:20
  • @MaverickMeerkat that's exactly how it's done. same with :<=> and <=>: for boolean variables. – peter Nov 22 '21 at 02:31
7

I think the Bourbaki used it first.. not sure.. I know physicists use $\equiv$

Dar Far
  • 499
  • 2
    I use $:=$ for definitions and $\equiv$ for identities. In the latter case, I think of the symbol as being $=$ with emphatic underline. :) (If it matters, I'm not a physicist.) – Blue Mar 19 '11 at 00:36
  • 5
    $\equiv$ is indeed used by physicists as "is defined as". In modulo arithmetic it is also used as "is equivalent mod (integer subscript of $\equiv$)". For example, writing $8 \equiv_{3} 2$ means "8 is equivalent to 2 mod 3". It is also used to signify more general conruence relations. I would recommend that you not use $\equiv$ as an emphatic identity, @DayLateDon, to avoid confusion when sharing your work with others. – karmic_mishap Oct 25 '11 at 19:16
  • 1
    @karmic_mishap: I picked up the "$\equiv$ for identity" thing from somewhere I can no longer remember. "Emphatic equals" is just how I explain it to myself. :) – Blue Oct 25 '11 at 21:28
  • 2
    Come to think of confusion ... I recall years ago as a teacher writing "?" above the equals sign of a to-be-proven identity, and then post-proof, replacing "?" with "!". ("Are they equal? Indeed!") I'd seen this elsewhere, too. Of course, that's a particularly bad idea nowadays, with "!=" the modern shorthand for "not-equals". It's curious --and unfortunate-- that the symbol for emphasis became the symbol for negation. Granted, ASCII isn't the richest glyph set, and coders needed something, but why settle on the symbol that means in prose the exact opposite of what it means in code? Irony? – Blue Oct 25 '11 at 21:38
  • 1
    @Blue I think != was chosen because it somehow resembled $\ne$ where ! "strikes through" =. – Ruslan Nov 18 '14 at 13:28
  • @Ruslan: My question was mostly rhetorical and/or comical, as I believe you are correct that != is meant to resemble "$\neq$". Of course, non-coding uses of ~, @, #, %, ^, etc, differ considerably from their coding counterparts; even so, re-purposing "percent" as "modulo" seems somehow less disconcerting than completely inverting the (for lack of a better word) "intrinsic" meaning of !. I wonder what the language designers thought of this; did they just shrug it off? did they relish the irony even a little? – Blue Nov 18 '14 at 14:35
  • @Ruslan Interestingly, Apple's new Swift programming language uses ? to represent optional (possibly-nil) values, and ! to indicate non-optional (definitely-not-nil!) values. So, there, ! is the symbol for negation and emphasis!(!) – Blue Nov 18 '14 at 14:36
  • How do these physicists know which side of this symmetric symbol is to be defined? Do they always put the new variable on the left? – peter Nov 22 '21 at 02:35
  • @Blue What's the difference between an identity and an equality? – peter Nov 22 '21 at 02:36
  • @peter: $(x+y)^2=4$ is an equality, true for some particular pairs of $x$ and $y$ values, whereas $(x+y)^2 \equiv x^2+2xy+y^2$ (with whatever alternative to "$\equiv$" one prefers) is an identity, true for arbitrary pairs of $x$ and $y$ values. – Blue Nov 22 '21 at 07:35
  • so its there to save me from writing the quantifiers. that's actually useful, i've never seen it consistently used that way though. do you happen to know a book which does that? – peter Nov 22 '21 at 17:44
  • Could you provide a reference where Bourbaki uses it? From slightly skimming some volumes, I didn't find it there. – red_trumpet Sep 26 '23 at 14:25