Sometimes, your post will need some maths equations. This site has been set up with MathJax to let you use LaTex notation to generate arbitrary mathematical expressions.
MathJax lets you add maths formulae to your posts using the well established \( \LaTeX \) (pronounced ‘latek’) language. Special tags make is relatively easy to inset mathematical equations using a special markup language that is the basis for probably all the mathematical typesetting that you see on the web and in print. Equations can be arbitrarily complex with automatic numbering and referencing or they may be simple statements placed inline with your text.
$$
\begin{equation}
E = mc^2
\end{equation}
$$
Inline use
Equations can be placed inline with text for better flow like this: \( e^{i\pi} + 1 = 0 \). This style works well where the equation is relatively simple. Even something like \(d = \sqrt{x^2+y^2} \) still fits within a line without too much disruptionand may not need calling out as a separate block in your text.
More complex equations like this one, \( f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi \), or this one \( \begin{vmatrix}a&b\\c&d\end{vmatrix}=ad-bc \) may not work so well because the height has to be adjusted to accommodate the rendered equation and things can get a bit cramped. If this looks OK to you then it is fine. Both these equations look much better placed in separate areas using ‘display’ mode.
$$f(x) = \int_{-\infty}^\infty \hat{f}(\xi)\,e^{2 \pi i \xi x}\,d\xi$$
All LaTex equations need to be enclosed within delimiters. Unfortunately the standards for these delimiters are not so well defined. In this implementation, inline equations must be placed between \(
and \)
delimiters like this:
Markdown | Render |
---|---|
...calculated as \( v=r\omega \) will be ... | …calculated as \( v=r\omega \) will be … |
Separate Lines
It is often more convenient to have equations, or a series of equations, displayed in their own space on the page. You can do that with an inline style but in its own paragraph. By default, equations are use the display method and are centered on the page:
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$
The delimiter for block equations is different – the equation should be placed between a pair of $$
delimiters. Thus this markdown
$$q=\frac{1+y}{1+2z^2}$$
produces:
$$q=\frac{1+y}{1+2z^2}$$
because the block display mode puts the rendered equation in an image div centered on the layout, it is more tricky to put block equations into tables
Examples
You can get the Latex markup for any equation if you right-click and then select Show Math as TeX commands.
Markdown | Render |
---|---|
$$\int_0^\infty e^{-x^2} dx=\frac{\sqrt{\pi}}{2}$$ | $$\int_0^\infty e^{-x^2} dx=\frac{\sqrt{\pi}}{2}$$ |
$$\sum_{n=1}^{\infty} 2^{-n} = 1$$ | $$\sum_{n=1}^{\infty} 2^{-n} = 1$$ |
$$x=\frac{1+\kappa}{1+2\zeta^2}$$ | $$x=\frac{1+\kappa}{1+2\zeta^2}$$ |
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$ | $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$ |
Matrix$$<br>\begin{matrix}<br>1 & x & x^2 \\<br>1 & y & y^2 \\<br>1 & z & z^2 \\<br>\end{matrix}<br>$$ | $$ \begin{matrix} 1 & x & x^2 \\ 1 & y & y^2 \\ 1 & z & z^2 \\ \end{matrix} $$ |
Matrix with brackets$$<br>\left[<br>\begin{matrix}<br>1 & x & x^2 \\<br>1 & y & y^2 \\<br>1 & z & z^2 \\<br>\end{matrix}<br>\right]<br>$$ | $$ \left[ \begin{matrix} 1 & x & x^2 \\ 1 & y & y^2 \\ 1 & z & z^2 \\ \end{matrix} \right] $$ |
Conditional Equations$$<br>|x| = \left\{ \begin{array}{rl}<br>-x &\mbox{ if $x<0$} \\<br>x &\mbox{ otherwise}<br>\end{array} \right.<br>$$ | $$ |x| = \left\{ \begin{array}{rl} -x &\mbox{ if $x<0$} \\ x &\mbox{ otherwise} \end{array} \right. $$ |
Another way to do conditional equations:$$<br>f(n) =<br>\begin{cases}<br>n/2, & \text{if $n$ is even} \\<br>3n+1, & \text{if $n$ is odd}<br>\end{cases}<br>$$ | $$ f(n) = \begin{cases} n/2, & \text{if $n$ is even} \\ 3n+1, & \text{if $n$ is odd} \end{cases} $$ |
Aligned Equations:$$<br>\begin{align}<br>\sqrt{37} & = \sqrt{\frac{73^2-1}{12^2}} \\<br>& = \sqrt{\frac{73^2}{12^2}\cdot\frac{73^2-1}{73^2}} \\<br>& = \sqrt{\frac{73^2}{12^2}}\sqrt{\frac{73^2-1}{73^2}} \\<br>& = \frac{73}{12}\sqrt{1 - \frac{1}{73^2}} \\<br>& \approx \frac{73}{12}\left(1 - \frac{1}{2\cdot73^2}\right)<br>\end{align}<br>$$ | $$ \begin{align} \sqrt{37} & = \sqrt{\frac{73^2-1}{12^2}} \\ & = \sqrt{\frac{73^2}{12^2}\cdot\frac{73^2-1}{73^2}} \\ & = \sqrt{\frac{73^2}{12^2}}\sqrt{\frac{73^2-1}{73^2}} \\ & = \frac{73}{12}\sqrt{1 – \frac{1}{73^2}} \\ & \approx \frac{73}{12}\left(1 – \frac{1}{2\cdot73^2}\right) \end{align} $$ |
Systems of Equations:$$<br>\left\{<br>\begin{aligned}<br>a_1x+b_1y+c_1z &=d_1+e_1 \\<br>a_2x+b_2y&=d_2 \\<br>a_3x+b_3y+c_3z &=d_3<br>\end{aligned}<br>\right.<br>$$ | $$ \left\{ \begin{aligned} a_1x+b_1y+c_1z &=d_1+e_1 \\ a_2x+b_2y&=d_2 \\ a_3x+b_3y+c_3z &=d_3 \end{aligned} \right. $$ |
Equations can be tagged (numbered). To refer to the equation later, use a label.
$$x=\frac{1+y}{1+2z^2}\tag{20} \label{eq20}$$
$$x+y^{2x}\tag{21} $$
$$x+y^{2x}\tag{22} $$
In equation \(\eqref{eq20}\), we find the value of an interesting integral (not really):
$$
\begin{equation}
\int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}
\label{eq:sample}
\end{equation}
$$
Equations can also be given some explanatory text:
$$
\begin{align}
v + w & = 0 &&\text{Given} \tag 1\\
-w & = -w + 0 && \text{additive identity} \tag 2\\
-w + 0 & = -w + (v + w) && \text{equations $(1)$ and $(2)$}
\end{align}
$$
More Inspiration
These sites will give you some examples. The opening and closing tags may differ slightly from those supported on these pages. Remember that MathJax only renders stuff from the math sections.
- Mathjax tutorial and quick reference
- Latex Mathematical Expressions
- LaTeX quick reference (PDF)
- LaTeX Cookbook
Further Information
MathJax is enable on this site using the Simple MathJax plugin for WordPress
The MathJax documentation should tell you pretty well everything you need to know: