ThmDex – An index of mathematical definitions, results, and conjectures.
We understand both functions $I_E$ and $I_{X \setminus E}$ as functions from $X$ to $\{ 0, 1 \}$. Since the domain and codomain sets are the same, it suffices to show that they attain the same values on $X$.

If $X$ is empty, then the equality $I_{X \setminus E}(x) = 1 - I_E(x)$ holds vacuously for all $x \in X$, so assume that $X$ is nonempty and let $x \in X$. If $x \in E$, then \begin{equation} 1 - I_E(x) = 1 - 1 = 0 = I_{X \setminus E}(x) \end{equation} If instead $x \in X \setminus E$, then \begin{equation} 1 - I_E(x) = 1 - 0 = 1 = I_{X \setminus E} \end{equation} Result R977: Ambient set is union of subset and complement of subset shows that $X = E \cup (X \setminus E)$. That is, these two cases exhaust all possible scenarios. Since $x \in X$ was arbitrary, the claim is established. $\square$