# Is it bad math style to use the same index symbol in different indexed objects?

The title says it all (I'm referring to the case, when writing for example an article to be published or something similar - something where the writing itself should also be of quality).

Example: "Let $A_1,A_2,\ldots,A_n$ be subsets of a set $L$ and $f:L\rightarrow L$. Then define $B=\cup_{i=0}^n A_i$ and $C=\cup_{i=1}^{\infty} f^i (A_2)$, where $f^i$ is $f$ iterated with itself $i$ times."

So (in this example), would it be a problem to use $i$ twice as an index variable the ranges over different sets ? Or is it ok to think of $i$ as being define like a (lets do a computer-science analogy) "local variable", that is only used to create the object "in" which it is defined ($B$ for example) and after the object is created, the variable is "freed" again (so it can be used again to define $C$) ?

If it is NOT okay to do that, when is it allowed to use the same symbol again, after its first use ? After half a page ? After two pages ? In index-heavy proofs one would very soon have finished all letters commonly used as indices, of one would always have to use a different letter. And indexing sets with letters like $x$ or $f$ seems even worse style to me (ok, maybe there are areas in math, in which this would be common practice, but I don't know any).

One time when you might want to avoid that is in expressions like $$\sum_{i\in A} f(i) \cdot \sum_{j\in B} g(j)$$ since you might want to use the distributive law to get $$\sum_{i\in A}\sum_{j\in B} f(i)g(j).$$ The expression $\sum_{j\in B} g(j)$ is what logicians call an "alphabetic variant" of $\sum_{i\in B} g(i)$. This idea also shows up in thing like $$(\forall i\ \varphi(i))\ \&\ (\forall j\ \chi(j))$$ and you want to put it in "prenex form" with all quantifiers at the beginning: $$\forall i\ \forall j\ (\varphi(i)\ \&\ \chi(j)).$$

Yes, it's okay to do that, at least as long as none of your readers find it too confusing. Your "local variable" analogy describes the situation perfectly, although in mathematics we like to call such variables "bound" instead of "local".

The only situation where it's not OK to reuse a variable symbol like that is when a previous use of it is still "in scope" and might be referred to. Even then, it's a fairly (perhaps unfortunately) common abuse of notation, especially in applied usage where there are strong conventions about certain variables and indices being denoted with certain letter.

That said, even when reusing a variable symbol is technically valid, you should avoid it in situations where it may be prone to causing confusion. For a particularly nasty example, see the physics lecture notes referred to in this answer (in Finnish, alas), where the author first introduces the "global" variables $n$ and $N$, and then a family of variables $n_1$, $n_2$, ..., $n_n$ that sum up to $N$, giving us the lovely equation \begin{aligned}P &= \frac{N!}{n_1!(N-n_1)!}\cdot\frac{(N-n_1)!}{n_2!(N-n_1-n_2)!}\dotsb\frac{(N-\sum_{i=1}^{n-2}n_i)!}{n_{n-1}!n_n!}\cdot\frac{n_n!}{n_n!} \\ &= N! \prod_{i=1}^n \frac{1}{n_i!}\end{aligned} \tag{1.3}

Please, for the love of God, if you find your equations looking like that, do something about them.

Another common readability problem to watch out for is the "stealth variable" — a "global" variable that is defined only once, in the middle of a body of text, and never used again until ten or even a hundred pages later. Yes, I've seen such things in a textbook more than once. Combining this with improper variable reuse, so that the stealth variable is first defined, then used for some unrelated purpose in a bound context, and later used again as originally defined (but without repeating the definition) makes the result particularly confusing.

• There are areas in computer science too where we would unhesitatingly speak about bound variables rather than local ones. There's not quite a strict distinction, though I'd tend to use "bound variable" when thinking about it as a placeholder symbol for substituting in a value, and a "local variable" when thinking about it as a name for a mutable storage location., Mar 3, 2012 at 19:18
• The $n_n$ is pretty cool :D Mar 3, 2012 at 19:36
• Also, if your equations run over into the equation number, you should do something about that too. Mar 3, 2012 at 20:16
• @Nate: Hmm, it didn't (quite) run into it for me, but I went and line-wrapped it to more closely match the original. Mar 3, 2012 at 20:20