How can I label an inline math formula/sentence/word? [duplicate]

I tried to label a specific inline math formula in the paragraph. For a simple example,

\section{This is the third section}
$a^{2}+b^{2}=c^{2}$\label{formula:1}
Formula \ref{formula:1} is useful!


However, I found that \ref{formula:1} corresponds to the number of the section.

So the output by the above codes is 'Formula 3 is useful!' But What I want to label is $a^{2}+b^{2}=c^{2}$, and what I want to get is 'Formula 1 is useful!'. How can I realize it?

• How about this answer? Or just a plain \hyperref and \hypertarget?
– user121799
Feb 27, 2019 at 3:43
• @marmot The answer is exactly what I want! Thanks! Feb 27, 2019 at 3:54
• @Zarko Sorry for not saying clearly before, I mean neither \tag nor \eqno works in math mode. So I'm not able to use special tag for formula designation with them. Feb 27, 2019 at 3:58
• Glad to hear! What should we do, then? AFAIK the technically correct way is to close your question as a duplicate of the other one.
– user121799
Feb 27, 2019 at 4:16