Anyone know what could be causing the problem here?
$$h(s) =
\begin{cases}
(a,0)\ & \text{if } a \not\in S\ &
(a,1)\ & \text{if } a \in S
\end{cases}
$$
Anyone know what could be causing the problem here?
$$h(s) =
\begin{cases}
(a,0)\ & \text{if } a \not\in S\ &
(a,1)\ & \text{if } a \in S
\end{cases}
$$
You have one & too many and one \\ too few.
You don't have any blank lines in the math material either, do you?
As egreg pointed out, with mathtools package there's cases*, where the second column is in text mode by default.
Moreover see also Why is [ … ] preferable to $$ … $$?
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
h(s) =
\begin{cases}
(a,0) & \text{if $a\notin S$} \\
(a,1) & \text{if $a \in S$}
\end{cases}
\]
or
\[
h(s) =
\begin{cases*}
(a,0) & if $a\notin S$ \\
(a,1) & if $a \in S$
\end{cases*}
\]
\end{document}
\text{if $a\notin S$}; with mathtools there's cases* where the second column is in text mode by default. Note \notin rather than \not\in.
– egreg
Mar 30 '17 at 17:15