# Missing { inserted in a Math Expression

I am having troubles with the math packages or commands, which I am unable to tell.

I have the following as packages:

\usepackage{float}
\usepackage{gensymb}
\usepackage{courier}
\usepackage{array}% http://ctan.org/pkg/array
\usepackage{rotating}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{mathtools}
\usepackage{multirow}


And the following simple text does not compile:

pixels, $Y$, and a similar set of predicted segmentation, $Y^'$ (in the binary case, i.e. where $Y_i$,
$Y_i^'$  $\in{0,1}, \forall i \in[1,n]$ is as follows in Equation \ref{eq:iou}:


resulting with:

Missing { inserted.

Check that your $'s match around math expressions. If they do, then you've probably used a symbol in normal text that needs to be in math mode. Symbols such as subscripts ( _ ), integrals ( \int ), Greek letters ( \alpha, \beta, \delta ), and modifiers (\vec{x}, \tilde{x} ) must be written in math mode. See the full list here.If you intended to use mathematics mode, then use$ … $for 'inline math mode', $$…$$ for 'display math mode' or alternatively \begin{math} … \end{math}. <to be read again> ^ l.463 ...milar set of predicted segmentation,$Y^'
$(in the binary case, i.e... A left brace was mandatory here, so I've put one in. You might want to delete and/or insert some corrections so that I will find a matching right brace soon. (If you're confused by all this, try typing I}' now.) ! Missing } inserted. <inserted text> } l.463 ...ilar set of predicted segmentation,$Y^'$(in the binary case, i.e.... I've inserted something that you may have forgotten. (See the <inserted text> above.) With luck, this will get me unwedged. But if you really didn't forget anything, try typing 2' now; then my insertion and my current dilemma will both disappear.  AND Missing { inserted. Check that your$'s match around math expressions. If they do, then you've probably used a symbol in normal text that needs to be in math mode. Symbols such as subscripts ( _ ), integrals ( \int ), Greek letters ( \alpha, \beta, \delta ), and modifiers (\vec{x}, \tilde{x} ) must be written in math mode. See the full list here.If you intended to use mathematics mode, then use $…$ for 'inline math mode', $$…$$ for 'display math mode' or alternatively \begin{math} … \end{math}.

^
l.464 $Y_i^'$  $\in{0,1}, \forall i \in[1,n]$ is as follows in Equation \ref...
A left brace was mandatory here, so I've put one in.
You might want to delete and/or insert some corrections
so that I will find a matching right brace soon.
(If you're confused by all this, try typing I}' now.)

! Missing } inserted.
<inserted text>
}
l.464 $Y_i^'$
$\in{0,1}, \forall i \in[1,n]$ is as follows in Equation \ref...
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing 2' now; then
my insertion and my current dilemma will both disappear.


Do I need an additional package here, since I already have \usepackage{mathtools}? I have tried including \usepackage{amsmath} and \usepackage{amssymb} (together and also individually) but the error remains.

Your example can be simplified to

\documentclass{article}

\begin{document}

$Y_i^'$  $\in{0,1}, \forall i \in[1,n]$
\end{document}


the markup ^' is incorrect and also you should have a single math expression not split in two

\documentclass{article}

\begin{document}

$Y'_i \in \{0,1\}, \forall i \in [1,n]$
\end{document}