1

I have the following equations :

    \begin{equation}\label{eq:4: Partial  W }
      \begin{align}
\frac{\partial s}
     {\partial W}
    & = \frac{\partial \sum_{i=1}^{n} (y_i -(W\cdot x_i+b))^2}
                         {\partial W}\\
    & = \sum_{i=1}^{n} 2(y_i -W\cdot x_i-b)\cdot(-x_i))
    = 2\cdot \sum_{i=1}^{n} (-y_i\cdot x_i + W\cdot x_i^2 + b\cdot x_i )  \stackrel{!}{=} 0    \\ \\
    &\Longleftrightarrow W\cdot(\sum_{i=1}^{n} x_i^2) + b\cdot(\sum_{i=1}^{n}x_i) = \sum_{i=1}^{n}x_i\cdot y_i
  \end{align}
\end{equation}
\begin{equation}\label{eq:5: Partial  b }
      \begin{align}
\frac{\partial s}
     {\partial b}
    & = \frac{\partial \sum_{i=1}^{n} (y_i -(W\cdot x_i+b))^2}
                         {\partial b}\\
    & = \sum_{i=1}^{n} 2(y_i -W\cdot x_i-b)\cdot(-1))
    = 2\cdot \sum_{i=1}^{n} (-y_i\cdot+ W\cdot x_i+ b)  \stackrel{!}{=} 0    \\ \\
    &\Longleftrightarrow W\cdot(\sum_{i=1}^{n} x_i) +\sum_{i=1}^{n}b = \sum_{i=1}^{n} y_i\\
    &\Longleftrightarrow W\cdot(\sum_{i=1}^{n}x_i) + n\cdot b = \sum_{i=1}^{n} y_i
  \end{align}
\end{equation}

the result looks as followed : enter image description here

My question is how may align the 2nd equation, and put both equation IDs at the end of each one and not the middle .

  • You seem to be asking for the tbtags option and for the align environment: type texdoc amsmath at a terminal emulator prompt, then read pages 2 and 6-7 of the manual. – GuM Jun 8 '17 at 14:32
3

Put everything in one align environment, don't enclose this in an equation environment, and use \nonumber on lines that should not be numbered.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{align}
\frac{\partial s}{\partial W}
&= \frac{\partial \sum_{i=1}^{n} (y_i -(W\cdot x_i+b))^2}
                    {\partial W} \nonumber \\
&= \sum_{i=1}^{n} 2(y_i -W\cdot x_i-b)\cdot(-x_i))
 = 2\cdot \sum_{i=1}^{n} (-y_i\cdot x_i + W\cdot x_i^2 + b\cdot x_i )  
   \stackrel{!}{=} 0    \nonumber\\ \nonumber\\
&\Longleftrightarrow W\cdot(\sum_{i=1}^{n} x_i^2) + b\cdot(\sum_{i=1}^{n}x_i) 
 = \sum_{i=1}^{n}x_i\cdot y_i \label{eq:4: Partial  W } \\
\frac{\partial s}{\partial b}
&= \frac{\partial \sum_{i=1}^{n} (y_i -(W\cdot x_i+b))^2}
                    {\partial b} \nonumber \\
&= \sum_{i=1}^{n} 2(y_i -W\cdot x_i-b)\cdot(-1))
 = 2\cdot \sum_{i=1}^{n} (-y_i\cdot+ W\cdot x_i+ b)  
   \stackrel{!}{=} 0    \nonumber \\ \nonumber \\
&\Longleftrightarrow W\cdot(\sum_{i=1}^{n} x_i) +\sum_{i=1}^{n}b 
 = \sum_{i=1}^{n} y_i \nonumber \\
&\Longleftrightarrow W\cdot(\sum_{i=1}^{n}x_i) + n\cdot b 
 = \sum_{i=1}^{n} y_i \label{eq:5: Partial  b }
\end{align}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.