# Error in \sum in state

I use the following:

\documentclass{article}
\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{textcomp}
\usepackage{mathtools}

\date{\today}
\title{Some Title}

\begin{document}
\section{Introduction}
bla afdsdjkh
\begin{algorithm}
\caption{Caption}
\textbf{INPUT:} Some input\\
\textbf{OUTPUT:} Some Output
\begin{algorithmic}
\State Function $UpdateNodes($x$)$:
\State   Set $AED_i$ = $\sum_{j=1}^{n}$  $DM_i_j$ / $n$
\end{algorithmic}
\end{algorithm}
\end{document}


Although I get the required result for the line:

\State  Set $AED_i$ = $\sum_{j=1}^{n}$  $DM_i_j$ / $n$


I get an error message: