# Set Builder Notation for Powers of relations

So my relation is z = {(z,z+1)|z ∈ ℤ}

How would I define z^2 in set builder notation?

I know this is how you calculate it but I'm unsure as to how to define it z^2 = z^1 ∘ z

I was thinking maybe this, but I'm not sure: a ∘ b | a ∈ s^1 and b ∈ s

In general, let $R \subseteq A \times A$ be a relation. Then $$R^{2} = \{(a,c) \mid \exists b \in A \colon (a,b) \in R \wedge (b,c) \in R \}.$$ In your specific case we get, setting $Z := \{ (z, z+1) \mid z \in \mathbb Z \}$, \begin{align*} Z^{2} &= \{ (a,c) \mid \exists b \in \mathbb Z \colon (a,b) \in Z \wedge (b,c) \in Z \} \\ &= \{ (z, z+2) \mid z \in \mathbb Z\}. \end{align*}