\documentclass[12pt,a4paper]{article}
%\documentclass[12pt,a4paper]{book}
\usepackage{amsmath}      %%para \overleftrightarrow e para \!
%\usepackage{lineno}       %%numero de linha numeracao de linhas
\usepackage{lineno}       %%numero de linha numeracao de linhas
\begin{document}

\section{Numerando Linhas Matemáticas}

\subsection{Exemplo 1}

\begin{enumerate}
\item $|MA_{k}|^2=(x-x_{k})^2+(y-y_{k})^2$
\item $(x-x_{k})^2+(y-y_{k})^2=(x^2-2\cdot x_{k}\cdot x+x_{k}^2)+(y^2-2\cdot y_{k}\cdot y+y_{k}^2)$
\item $(x-x_{k})^2+(y-y_{k})^2=x^2+x_{k}^2+(-2\cdot x_{k}\cdot x)+y^2+y_{k}^2+(-2\cdot y_{k}\cdot y)$
\end{enumerate}

\subsection{Exemplo 2}

\linenumbers
\begin{linenomath*}
\begin{eqnarray*}
|MA_{k}|^2=(x-x_{k})^2+(y-y_{k})^2\\
(x-x_{k})^2+(y-y_{k})^2=(x^2-2\cdot x_{k}\cdot x+x_{k}^2)+(y^2-2\cdot y_{k}\cdot y+y_{k}^2)\\
(x-x_{k})^2+(y-y_{k})^2=x^2+x_{k}^2+(-2\cdot x_{k}\cdot x)+y^2+y_{k}^2+(-2\cdot y_{k}\cdot y)
\end{eqnarray*}
\end{linenomath*}
\nolinenumbers

\subsection{Exemplo 3}

\begin{gather}
\begin{align}
|MA_{k}|^2&=(x-x_{k})^2+(y-y_{k})^2\\
(x-x_{k})^2+(y-y_{k})^2&=(x^2-2\cdot x_{k}\cdot x+x_{k}^2)+(y^2-2\cdot y_{k}\cdot y+y_{k}^2)\\
(x-x_{k})^2+(y-y_{k})^2&=x^2+x_{k}^2+(-2\cdot x_{k}\cdot x)+y^2+y_{k}^2+(-2\cdot y_{k}\cdot y)
\end{align}
\end{gather}

\subsection{Exemplo 4}

\begin{gather}
\begin{align}
& |MA_{k}|^2=(x-x_{k})^2+(y-y_{k})^2\\
& (x-x_{k})^2+(y-y_{k})^2=(x^2-2\cdot x_{k}\cdot x+x_{k}^2)+(y^2-2\cdot y_{k}\cdot y+y_{k}^2)\\
& (x-x_{k})^2+(y-y_{k})^2=x^2+x_{k}^2+(-2\cdot x_{k}\cdot x)+y^2+y_{k}^2+(-2\cdot y_{k}\cdot y)
\end{align}
\end{gather}

\end{document}
