# Receiving this error in latex for "missing $inserted" and that "You need to enclose all mathematical expressions.." This is latex Overleaf and I'm receiving this error with no idea on how to fix it edit: Here is the code \begin{definition}[Dirichlet Character] Any map$\chi:(\mathbb{Z}/n\mathbb{Z})* \rightarrow \mathbb{C}$is said to be a Dirichlet Character of modulus$n$if for any two integers$a$and$b$, \begin{itemize} \item$\chi(ab) = \chi(a)\chi(b) \hspace{2pt} \text{(multiplicity)}$\item$\chi(a)$=$\begin{cases}
$0$ & \text{if } $\gcd(a,n) > 1$ \\
\text{non-zero} & \text{if }$\gcd(a,n) = 1$ \\
\end{cases}$\item$\chi(a+m)$=$\chi(a)$\text{(periodic with period$m$)} \end{itemize} \end{definition}  • please show code as text, not an image but you have $ inside a cases environment, which is already math so generates an error. In general you have far too many $ so a = b$ not $a$ = $b$ Apr 27 at 19:33

This works, because each equations are in one math environment (see @DavidCarlisle comment):

\documentclass{article}
\usepackage{amsmath, amssymb, amsthm}
\theoremstyle{definition}  % for upright text in definition
\newtheorem{definition}{Definition}

\begin{document}
\begin{definition}[Dirichlet Character]
Any map $\chi:(\mathbb{Z}/n\mathbb{Z})* \rightarrow \mathbb{C}$ is said to be a Dirichlet Character of modulus $n$ if for any two integers $a$ and $b$,
\begin{itemize}
\item $\chi(ab) = \chi(a)\chi(b)$ \quad(multiplicity)
\item $\chi(a) = \begin{cases} 0 & \text{if } \gcd(a,n) > 1 \\ \ne 0 & \text{if } \gcd(a,n) = 1 \\ \end{cases}$
\item $\chi(a+m) = \chi(a)$      \quad(periodic with period $m$)
\end{itemize}
\end{definition}
\end{document}


Edite: Considered @Mico comment.

• +1. For the sake of good house-keeping, err good math typography, I would be tempted to (a) add the instruction \theoremstyle{definition} immediately before \newtheorem{definition}{Definition}, (b) replace \chi: with \chi\colon and (c) replace non-zero with \ne0.
– Mico
Apr 28 at 4:47
• @Mico, thank you very much. Apr 28 at 4:57