Footnote inside stackrel

I am writing an equation and I'd like to put above the equal sign $(=)$ a footnote describing shortly the reason for that equality.

I tried

$x^2\stackrel{\footnote{foo}}{=}x\ast x$

but this only shows the footnote's number above the equal sign but no foo on the bottom of the page.

Any idea? What is the best way to do this kind of trick?

-

Use \footnotemark inside and \footnotetext outside.

\documentclass{article}
%\usepackage{amsmath}
\begin{document}
$x^2\stackrel{\footnotemark}{=}x\ast x$
\footnotetext{foo}
\end{document}
-
Great! Should I use \footnotesize\footnotemark to get the same size as the normal \footnote command? I tried but it looks like no effect. –  Sigur Nov 11 '12 at 16:09
@Sigur: You don't have to worry about the size. It is automatically taken care of. I mean they are same as if you use \footnote. –  Harish Kumar Nov 11 '12 at 16:12
Hum, I discovered the problem. With amsart class we have different sizes for the numbers. With article class, everything is OK. Please, try with amsart. test\footnote{bla} $\stackrel{\footnotemark}{=}$\footnotetext{foo} $\stackrel{\footnotesize\footnotemark}{=}$\footnotetext{fookjkj} –  Sigur Nov 11 '12 at 16:16
@Sigur: I don't know much about the internals of amsart as I don't use it much. This looks like a potential candidate for a fresh question. –  Harish Kumar Nov 11 '12 at 23:32
ok, I'll let the question open for a while. –  Sigur Nov 12 '12 at 15:25

I don't think it's really a good idea; the strange number, coming from nowhere, above the equals symbol will hardly be interpreted as a footnote marker.

Footnote markers in math formulas should be avoided because they can get confused with exponents. Why not simply add the explanation beside the formula?

$x^2 = x * x \qquad\text{(by definition)}$

(recall that \text requires amsmath). If the explanation is too long it can go after the formula or, if you really prefer footnotes, the footnote marker can be added in the "short explanation".

-
I have more than one explanation to write on the same expression. So I guess that putting numbers above the equal signs is the best solution for the moment. –  Sigur Nov 11 '12 at 16:20