# Is there a mathematical symbol for "For every element"?

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

• What about the "for all" quantifier, i.e. $\forall$? Jun 19, 2012 at 14:15
• I don't think that counts since it takes all elements at once and is not iterable.
– drum
Jun 19, 2012 at 14:16
• @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$" Jun 19, 2012 at 14:17
• In writing, you'll probably be better off being clear and using words, not symbols.
– lhf
Jun 19, 2012 at 14:20
• 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. Jun 19, 2012 at 15:32

This should work.

$\forall x\in A\cdots$

• Just to make sure I follow, this means something along the lines of "for all x containing member A", right? Apr 16, 2015 at 5:45
• For all x in A. You have it backwards. Apr 16, 2015 at 13:21
• 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". Oct 26, 2017 at 18:17
• @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.
– HTNW
Apr 22, 2020 at 20:27
• Unrestricted comprehension puts you in Russell Paradox territory. All discussions demand a context. Jun 30, 2021 at 17:54

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 ;-)

• 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. Jul 22, 2016 at 12:14
• @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$. Jul 22, 2016 at 14:09
• You say that there variables can't vary in maths, but when you do ∀i isn't the i a different value each time ? Nov 23, 2017 at 4:20
• @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. Nov 23, 2017 at 7:08
• @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? Nov 23, 2017 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. • 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"? Nov 23, 2017 at 4:28 • @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. Nov 23, 2017 at 9:43 • What are good examples of "there exists X such that P"? Nov 23, 2017 at 17:40 • @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. Nov 23, 2017 at 22:16 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\$".

Looking for a formal notation for the same, I think that $$\{\dots\}$$ should be the right answer, either $$\{1,2,3,4,5\}$$ or $$\{x$$ $$|$$ some condition here$$\}$$

Then a 'loop' that, say, gives the double for every element of a set $$A=\{x$$ $$|$$ some condition here$$\}$$, can be written as $$\{y$$ $$|$$ $$\forall x\in A,$$ $$y=2x\}$$

As per programming, depending on the application it makes sense to loop a set. For example in python there is the set() function that ensures that a collection of values (i.e. a list or a tuple) is a set (with no duplicates,) and is definitely iterable.

Representing for what is shown this as incident cofinal retreats will work.

$$\forall \in_n:\in_n \in A$$

$$A$$ would be cofinaly filtered if $$\langle \in_n,\geq \rangle$$ is prime in element number.