[Tex/LaTex] using subequations

amsmathequationserrors

I have an equation consisting of two parts and would like to use subequation for that.
Here's the code:

\usepackage{amsmath}

\begin{subequations}
\begin{equation}
\operatorname{min}_{a,b,c} 
\frac{1}{2}\mathbf{w}^{T}\mathbf{w} + C \sum_{i=1}^{l}\xi_{i} 

\end{equation}
\begin{equation}
y_{i}\left(\mathbf{w}^{T}\phi(x_{i})+b\right)
\end{equation}

\end{subequations}

I'm getting an error:

final.tex:118:Missing $ inserted.
final.tex:118:Display math should end with $$.

Can anybody help with that?

Best Answer

Paragraph breaks (which are produced by empty lines, too) don't quite work in math mode. Once you remove the empty line, the code compiles fine:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{subequations}
\begin{equation}
  \operatorname{min}_{a,b,c} 
  \frac{1}{2}\mathbf{w}^{T}\mathbf{w} + C \sum_{i=1}^{l}\xi_{i} 
\end{equation}    
\begin{equation}
  y_{i}\left(\mathbf{w}^{T}\phi(x_{i})+b\right)
\end{equation}
\end{subequations}

\end{document}