[Tex/LaTex] How to underline an equation with a curly brace and an explanation?

equationsmathematics

How would I underline an equation with a curly brace and an explanation?, like I've pictured below?

I've tried to use the amsmath package, but the \underline directive does not produce the brace and creates ugly space between the A, B and =.

enter image description here

Best Answer

\underline is not \underbrace. Use

 \usepackage{amsmath}
  ..........
 \begin{document}

 \[ \underbrace{A=B}_{\text{Fermat}} \]
  ...........

\end{document}