Math is not part of CommonMark, but GitHub, GitLab, Jupyter, Obsidian, Typora and most documentation tools render LaTeX between dollar signs with KaTeX or MathJax. The commands are the same as in LaTeX.
All ways to write it
Inline math with single dollar signs.Some tools only$E = mc^2$
Display math on its own lines.Some tools only$$ \sum_{i=1}^{n} i = \frac{n(n+1)}{2} $$
GitHub also accepts a math code fence.Some tools only```math \sqrt{2} ```
Example
You type
The area is $A = \pi r^2$.
$$
\int_0^\infty e^{-x^2}\,dx = \frac{\sqrt{\pi}}{2}
$$Renders the formula inline in the sentence, then the integral centered on its own line.
Questions
Where do I find the LaTeX command for a symbol?
The LaTeX symbol reference lists each one with its command and whether KaTeX renders it.
Why is my dollar sign turning into math?
Escape it as \$ when you mean a price, especially when a line has two dollar amounts.
Math (LaTeX) in Confluence
Markdown Macro+ renders $...$ inline and $$...$$ block math with KaTeX. For equations outside a Markdown macro, LaTeX Math for Confluence adds inline and block math macros. Look up commands in the LaTeX symbol reference.