this is explained in (among other places) the documentation for the amsthm package -- texdoc amsthm.
briefly, here is how this works. (explanation based on the definitions in amsthm.)
the basic pattern is
\newtheorem{<environment name>}{<header text>}
this establishes a counter with the same name as the environment name. say you want an environment that produces the heading "Theorem n." where "n" increases by 1 every time the environment is invoked. then it is enough to type
\newtheorem{thm}{Theorem}
in the preamble to set this up, and in the body, every instance of
\begin{thm}
theorem text
\end{thm}
will have the desired header with the theorem number increasing by 1 with
each invocation. equivalent theorem-class objects are defined by giving
them different names, e.g.
\newtheorem{cor}{Corollary}
\newtheorem{lem}{Lemma}
each such object will have its own counter when defined in this way.
however, many authors prefer to use a single counter for all, or many,
such objects. in this case, the counter to be used is specified as an
option between the environment name and the header text:
\newtheorem{thm}{Theorem}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{lem}[thm]{Lemma}
here, all three objects will be numbered sequentially with the same
counter, namely thm.
another common alternative is to number theorem-class objects within a
surrounding environment, e.g. chapter or section. to accomplish this,
a different option is chosen, namely the form specified after the header text:
\newtheorem{thm}{Theorem}[section]
\newtheorem{cor}[thm]{Corollary}
\newtheoren{lem}[thm]{Lemma}
in this case, the same counter will be used as above, but this time, it will
result in a two-part number, e.g. "Theorem 2.4" for the fourth theorem in
section 2, which might be followed by "Corollary 2.5".
it is even possible to number theorem-class objects consecutively with
sections -- \newtheorem{thm}[section]{Theorem} -- or even with
equations -- \newtheorem{thm}[equation]{Theorem}. in such a situation,
it is important to remember to specify the same counter for all the
theorem-class objects for which it should apply.
in the case where no number is wanted, the *-ed form is used:
\newtheorem*{mainthm}{Main Theorem}
any option is invalid in this situation.
\newtheorem{thm}{Theorem}[chapter] \newtheorem{defn}[thm]{Definition}
but it seems as if there output was the same (except of course for the numbering), but their [] orders were different (one had the square brackets in the second position and the other the third). I don't see why the outputs are the same.
Thanks, Brian
– Relative0 Jan 24 '14 at 02:30