0
$$
\left(
\begin{array}{c}
m+n\\
m
\end{array}
\right)
= \frac{(m+n)!}{m!n!}
= \frac{\overbrace{(m+n)(m+n-1)\cdots(n+1)}^\mbox{$m$ factors}}{\underbrace{m(m-1)\cdots 1}_\mbox{$m$ factors}}
$$

I am getting an error and cannot figure out the cause.

egreg
  • 1,121,712

2 Answers2

6

I suggest you use \[ \] instead $$ $$ for display math formulas. Like @WillieWong say, with amsmath package You can get a result, perhaps, more appropriate:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\[
  \binom{m+n}{m}
     = \frac{(m+n)!}{m!\,n!}
     = \frac{\overbrace{(m+n)(m+n-1)\cdots(n+1)}^{m \text{ factors}}}{\underbrace{m(m-1)\cdots 1}_{m \text{ factors}}}
  \]
 \end{document}

enter image description here

juanuni
  • 1,987
2

This will do:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$$
\left(
\begin{array}{c}
m+n\\
m
\end{array}
\right)
= \frac{(m+n)!}{m!n!}
= \frac{\overbrace{(m+n)(m+n-1)\cdots(n+1)}^{\mbox{$m$ factors}}}{\underbrace{m(m-1)\cdots 1}_{\mbox{$m$ factors}}}
$$
\end{document}

The ^\mbox{$m$ factors} was changed to ^{\mbox{$m$ factors}} in two cases (one for superscript and another for subscript), which should be grouped using curly braces.

Jagath
  • 4,287
  • 2
    If one is using amsmath, one might as well use \binom instead of doing it by hand in the left hand side. It may also make sense using \text instead of \mbox. – Willie Wong Jul 18 '16 at 03:29
  • @WillieWong: I do agree with you regarding the use of \text instead of \mbox. – Jagath Jul 18 '16 at 04:23