[Tex/LaTex] How to move equation numbers to right hand side

equations

I'm writing a mathematical article and I want the equation numbers to appear on the right hand side and the end of the line however they are currently appearing underneath the equation on the left. How can I change this?

EXAMPLE:

\documentclass{article} 
\usepackage[utf8]{inputenc}

\usepackage{natbib} 
\usepackage[section]{placeins} 
\usepackage{graphicx} 
\usepackage{wrapfig} 
\usepackage{float} 
\usepackage{mathtools} 
\usepackage{amsmath} 
\usepackage{geometry} 
\geometry{ a4paper, total={170mm,257mm}, left=20mm, top=20mm, }

\begin{document}
\maketitle

\section{Equations}
The horizontal and vertical links and network nodes can now be defined as the following matrices: \

\textbf{Horizonal Links} \newline

For 1 \leq i \leq m+1 \ $and$ \ 1 \leq j \leq n

\begin{description} 
\item[(a)]

\begin{equation} A_{ij}^X= \begin{cases} 1, & \text{if the link between ($i,j$) and ($i,j+1$) exists}\ \ 0, & \text{otherwise}\ \ \end{cases}

\end{equation} $$

\item[(b)]

\begin{equation} X_{ij} = l_{ij}

\end{equation}

where $l_{ij}$ is the length of the link between ($i,j$) and ($i,j+1$). If >there is no link between ($i,j$) and ($i,j+1$) then $l_{ij}$=0

\end{description}

\bibliographystyle{plain} 
\bibliography{references} 
\end{document}

Best Answer

Your coding style is, shall we way, not exactly tidy. Here's a minimalist fix-up that should get you going, at least for a little while. Good news: after the code clean-up, the equation numbers show up on the right-hand edge.

\documentclass{article} 

\usepackage[utf8]{inputenc}
\usepackage{natbib} 
\usepackage[section]{placeins} 
\usepackage{graphicx} 
\usepackage{wrapfig} 
\usepackage{float} 
\usepackage{mathtools} 
%%\usepackage{amsmath}  is loaded by 'mathtools' -- no need to load it explicitly
\usepackage{geometry} 
\geometry{ a4paper, total={170mm,257mm}, left=20mm, top=20mm}

\begin{document}

\section{Equations}

The horizontal and vertical links and network nodes can now be defined as the following matrices

\subsection*{Horizonal Links} 

For $1 \leq i \leq m+1$ and $1 \leq j \leq n$

\begin{description} 
\item[(a)]
\begin{equation} 
A_{ij}^X= 
\begin{cases} 
  1, & \text{if the link between ($i,j$) and ($i,j+1$) exists}\\ 
  0, & \text{otherwise}
\end{cases}
\end{equation}

\item[(b)]
\begin{equation} 
    X_{ij} = l_{ij}
\end{equation}
where $l_{ij}$ is the length of the link between ($i,j$) and ($i,j+1$). 
If there is no link between ($i,j$) and ($i,j+1$) then $l_{ij}$=0

\end{description}
\end{document}