[Tex/LaTex] wrong with the \begin{definition}

pdftexundefined

I am completely new in LaTeX. I wrote this below code in TeXworks but it doesn't work:

\documentclass{article}
\usepackage{amsthm}
\begin{document}
\section{Introduction}
In this section I introduce some concepts which we need to fully understand the Ellipsoid method.
\begin{definition}
A set $S\in \mathbb R^n$ is said affine set if for every $x,y \in S$ and every $\lambda in \mathbb R$ we have $\lambda x+(1-\lambda )y\in S$.
\end{definition}
\end{document}

Could you please help me what is the problem?

Best Answer

Very simple: there is no definition theorem-like environment by default. There's only a ‘definition’ theorem style. So here is how to define it, numbered by section:

\documentclass{article}
\usepackage{amsthm, amssymb}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]

\begin{document}

\section{Introduction}
In this section I introduce some concepts which we need to fully understand the Ellipsoid method.
\begin{definition}
A set $S\in \mathbb R^n$ is said affine set if for every $x,y \in S$ and every $\lambda \in \mathbb R$ we have $\lambda x+(1-\lambda )y\in S$.
\end{definition}

\end{document} 

enter image description here