# What is the sigma algebra generated by the indicator function of random variable?

I was thinking what is the $\sigma$-algebra generated by the random variable $Z= \mathbb{I}(X+Y=0)$ where $X,Y\sim\operatorname{Bern}(p)$ iid. (Note: $\mathbb{I}$ is the indicator function.)

-

It's the smallest $\sigma$-algebra making $Z$ measurable. As the values of $Z$ are $0$ or $1$, $\sigma(Z)=\{\emptyset,\Omega, Z^{-1}(\{0\}),Z^{-1}(\{1\})\}$ and $$Z^{-1}(\{0\})=\{X\neq -Y\}=\{X=1,Y=-1\}\cup\{X=1,Y=-1\}.$$