Is there a mathematical symbol that means "For every element"? I want the meaning to have similar function as an iteration, say for loop.

  • 7
    $\begingroup$ What about the "for all" quantifier, i.e. $\forall$? $\endgroup$ – dtldarek Jun 19 '12 at 14:15
  • $\begingroup$ I don't think that counts since it takes all elements at once and is not iterable. $\endgroup$ – drum Jun 19 '12 at 14:16
  • 2
    $\begingroup$ @drum: If I understand your last comment, no; unless you happen to have some enumeration indexed by $\mathbb{N}$, in which case the usual way of writing it is "for $i=1,2,3,\ldots$" $\endgroup$ – Arturo Magidin Jun 19 '12 at 14:17
  • 6
    $\begingroup$ In writing, you'll probably be better off being clear and using words, not symbols. $\endgroup$ – lhf Jun 19 '12 at 14:20
  • 5
    $\begingroup$ Your question would be much clearer if you gave an example of an actual use. Maybe you are looking for induction? E.g. "By induction over $i\ge 2$, define $a_i=a_{i-1}+a_{i-2}$." This applies to any well-ordered set. $\endgroup$ – Generic Human Jun 19 '12 at 15:32

From your comments, it seems that you want to take the elements of your index set in a specific order, as in an iteration.

There is no single symbol for that; the general shorthand only works when the index set has order type $\omega$, that is, it is indexed by $\mathbb{N}$, in which case the standard way of signaling this would be "for $i=1,2,3,\ldots$".

| cite | improve this answer | |

This should work.

$\forall x\in A\cdots$

| cite | improve this answer | |
  • $\begingroup$ Just to make sure I follow, this means something along the lines of "for all x containing member A", right? $\endgroup$ – Andrew Apr 16 '15 at 5:45
  • 7
    $\begingroup$ For all x in A. You have it backwards. $\endgroup$ – ncmathsadist Apr 16 '15 at 13:21
  • 3
    $\begingroup$ These conditions should be separate. It would be too easy to think that this means "for all elements in A" it should read: ∀x; x ∈ A. Which separately says "for all x" and then "x is an element of A". $\endgroup$ – ashley Oct 26 '17 at 18:17
  • $\begingroup$ @ashley That's not always right. Some systems of logic admit unrestricted comprehension: "for all $x$ (in the universe)". But in many logics (esp. type and set theories) admitting that kind of construction leads to contradictions. E.g. Russell's paradox can use unrestricted comprehension to construct the set of sets that do not contain themselves. $\endgroup$ – HTNW Apr 22 at 20:27

I still think the universal quantifier is the answer you are looking for.

From the wording you use e.g. "loop" and "iteration", I infer that your confusion might be coming form the fact that in mathematics there are no variables only constants (here I using the meaning from computer science). For example when you define $x = 2$, even if mathematician would say it is a variable, in fact (in computer science sense) it is a constant: you set $x$ only once, and afterwards it does not change. If it would, then we would have a contradiction i.e. $x = 2 \land x \neq 2$ (please note, that if there are other $x$-es in the text, it just means that those are different constants, but with the same name).

So, when computer scientist wrote

for i from 2 to n do 
    a[i] := a[i-1] + a[i-2]

then mathematician would write $\forall i \in \{2,\ldots,n\}.\ a_i = a_{i-1} + a_{i-2}$. The order does not matter, $a_i$-s are constants that are defined by such recursive formula and that's it. You might not know how many solutions there are (none, single, many?), but usually you do if the formula is simple enough. You don't care how to compute it, how much time would it take or worry if you have enough memory to calculate it--those problems are just uninteresting :-)

Welcome to mathematics!

P.S. Naturally, there are domains of mathematics (notably theoretical computer science :D) in which you do care about such things, I am just teasing you ;-)

| cite | improve this answer | |
  • 2
    $\begingroup$ How might you extend this notation to higher dimensions. This would be useful for nested loops. For example $\forall i\in \{1,\dots,I\}, \ \forall j\in \{1,\dots,J\}, \ \forall k\in \{1,\dots,K\}\ \ a_{ijk}=\cdots$. However this notation seems a bit cumbersome at higher dimensions. $\endgroup$ – Aaron Hendrickson Jul 22 '16 at 12:14
  • 1
    $\begingroup$ @AaronHendrickson Note, that even the identifier with indices $a_{i, j, k, l, m, n, \ldots}$ is cumbersome at higher dimensions. On the other hand, observe that $\forall i \in I.\ \forall j \in J.\ a_{i,j} = \ldots$ is equivalent to $\forall (i,j) \in I \times J.\ a_{i,j}$. So, in higher dimensions, instead multiple indices one would use tuples, and then quantify over product of relevant sets. For example, if we wanted $i_1 \in I_1$ and so on up to $i_k \in I_k$, then we could set $\mathcal{I} = \prod_{j=1}^{k}I_j$ and write $\forall \bar\imath \in \mathcal{I}.\ a_{\bar\imath}=\ldots$. $\endgroup$ – dtldarek Jul 22 '16 at 14:09
  • $\begingroup$ You say that there variables can't vary in maths, but when you do ∀i isn't the i a different value each time ? $\endgroup$ – Pacerier Nov 23 '17 at 4:20
  • $\begingroup$ @Pacerier There is no "each time" (because there is no time). If you want to use time, then they would be there all at the same time. The exact meaning of the quantifier is a bit more involved, but a rough simplification would be that you get a bunch of formulas $a_{34}=a_{33}+a_{32}$, $a_{5426}=a_{5425}+a_{5424}$, and so on with every possible/allowed values, and the $i$ is not even there. As I said, that's not technically correct (study logic if you want to know more), but this is a good intuition for quantification over finite sets. $\endgroup$ – dtldarek Nov 23 '17 at 7:08
  • $\begingroup$ @dtldarek, So is it that when you do ∀i for the range 10 to 15, we end up having i1, i2, i3, i4, i5, i6? Thus, it's like an array? $\endgroup$ – Pacerier Nov 23 '17 at 17:43

The very concept of "doing something in some order" doesn't really make sense in mathematics. Things are defined once and for all, the whole set exists "all the time". This has the great advantage that there is no ambiguity: "do you mean, the variable at position $n$ before or after we looped past it?"

If you come from imperative programming, you may be surprised that it's possible to do any useful stuff when you're not allowed to modify something after its definition. But it's quite possible – also in programming! What you could write in C as

int v[14];
v[0] = first_value;
for(int i=1; i<14; ++i)
  v[i] = function_for_next(v[i-1]);

can also be written, without explicit mention of an "order" in which the set is traversed, as recursive buildup of e.g. a linked list. In Haskell,

v = vBuild 0 firstValue
     where vBuild 14 _ = []
           vBuild i lastValue
               = lastValue : vBuild (i+1) (functionForNext lastValue)

or simply

v = take 14 $ iterate functionForNext firstValue

This also works for arbitrarily more complicated examples, in fact you only need a very simple notational system to calculate anything that can be calculated at all. And in mathematics, you're usually not so much interested in how to calculate results (so it's not a problem if some calculations are a bit less efficient without explicit state, mutable variables, iterations etc.), but it's always very important that expressions aren't ambiguous so you can prove various properties.

| cite | improve this answer | |
  • $\begingroup$ Do you mind elaborating the last paragraph with an example? It's hard to wrap around my head the "Why would maths not be concerned with how results are worked out"? $\endgroup$ – Pacerier Nov 23 '17 at 4:28
  • $\begingroup$ @Pacerier mathematical theorems are often formulated like “there exists $X$ such that $P$”, without any direct elaboration as to how $X$ can actually be obtained. In fact, for some examples like Banach-Tarski it's not really possible to construct the concrete solution, instead its existance is inferred from an axiom. $\endgroup$ – leftaroundabout Nov 23 '17 at 9:43
  • $\begingroup$ What are good examples of "there exists X such that P"? $\endgroup$ – Pacerier Nov 23 '17 at 17:40
  • $\begingroup$ @Pacerier Picard-Lindelöf: there exists a unique solution to any Lipschitz-continuous ODE. Nash existance theorem: in a game with a finite number of players who can choose from finitely many pure strategies, there exists a Nash equilibrium. Borsuk-Ulam theorem: for any continuous mapping from the $n$-sphere, there exists a pair of antipodal points with identical function values. $\endgroup$ – leftaroundabout Nov 23 '17 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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