# Using set notation for sets with repeating characters

Consider the following set:

{x, y, yy, yyyy, yyyyyyyy, yyyyyyyyyyyyyyyy, ...}

How would set builder notation be used to represent such a set? My understanding of the limitation is very limited as I only have experience using it for sets whose only elements are numbers, but never with character strings.

I also do not understand how to specify just one starting character that doesn't seem to be involved in any pattern.

• Your problem is not how to use set notation for sets with repeating characters -- your problem is how to notate that a string has repeating characters. – user14972 Sep 24 '17 at 22:32
• I was thinking try something like let $W_n(str)$ mean the value of str repeated n times then you could use that notation to specify things in the set builder notation. – user451844 Sep 24 '17 at 22:33
• $\{w \mid w=x \lor \exists n \in \Bbb N [w=y^{2^n}]\}$? – Kenny Lau Sep 24 '17 at 22:33
• $\{x\} \cup \{y^{2^n}: n\in\mathbb{N}\}$ could also work depending on context and level of formality – Brevan Ellefsen Sep 24 '17 at 22:36
• Do you intend for $yy\dots y$ to be a string, or some multiplicative operation applied repeatedly? – Brevan Ellefsen Sep 24 '17 at 22:37

First you want a notation for repeating a string n times.
Let s be a string and define by induction, s^1 = s and s^(n+1) = ss^n.
Your set appears to be { x, y, yy, y^(4n) : n in N }.

It depends on what symbol juxtaposition means. Assuming it means multiplication, use this:

$$\{x\}\cup\bigcup_{n=0}^\infty \left\{ y^{\left( 2^n\right)} \right\}\tag{1}$$

The part on the right means

$$\left\{ y^{\left( 2^0\right)} \right\} \cup \left\{ y^{\left( 2^1\right)} \right\} \cup \left\{ y^{\left( 2^2\right)} \right\} \cup \left\{ y^{\left( 2^3\right) }\right\} \cup \cdots = \left\{ y, y^2, y^4, y^8, \cdots\right\}$$

The “$\{x\}\cup$” part on the left is because $x$ doesn’t seem to fit the definition of the pattern.

I used braces so much, because you can only unite sets. If your elements are themselves sets of elements, then uniting them without braces gives you a set of elements, while uniting them with braces gives a set of sets of elements.

If juxtaposition doesn’t mean multiplication, you will just need to define your own notation and adjust $(1)$ accordingly.