# How to make an index optional?

Can I define a relation between variables, such that the expression will also be evaluated (then assuming all indices are equal) when no index is given? $$x_i + y_j = \delta_{ij} \stackrel{Mathematica\ recognizes \ then\ that}{\Rightarrow} x + y = \delta_{ii} = 1$$  

INITIAL QUESTION WAS: I define a relation for the annihilation and creation operator $a_i$ and $a_j$ like this $$[a_i, a_j^\dagger] = \delta_{ij}.$$

The commutator can be defined with the Quantum Notation package. I want to make the index ($i$, resp. $j$) optional, such that Mathematica recognizes that $$[a, a^\dagger] =1,$$ i.e. it assumes $i=j$ if no index is given. Is there a way to do this?

• how do you currently define the relation? (for existing indices) Commented Oct 4, 2013 at 6:35
• showing us your code could make things easier Commented Oct 4, 2013 at 15:39
• Dear Wizard, Dear Pinguin Dirk, I actually define the relation exactly like this $$[a_i, a_j^\dagger] = KroneckerDelta[ij],$$ since the Quantum Notation package supports commutator notation. I just asked out of curiosity, in the moment I am using the "double definition" (one time with and one time without indices) as swish suggested. Commented Oct 5, 2013 at 18:10