# How to write math expressions on the blog

To write mathematical expressions in your blog posts, you can use a piece of software called MathJax.  To write a MathJax formula in your post, you enclose it within special parentheses: for inline formulas (those that appear in the same line as your text), enclose the formula in (…), and for displayed formulas (those that appear on a line of their own), use […] .  These parentheses signal to your browser to run a code snippet that renders your formula in elegant mathematical notation.  (You must have JavaScript enabled in your browser for MathJax to work properly.)

This tutorial is brief; a much longer one can be found on StackExchange.  To see how any of the formulas was made, right-click on it and choose “Show Math As > TeX Commands”.  This will show you the MathJax code that was put between the parentheses to generate that expression.

(Note that in some browsers, such as Firefox, the MathJaX right-click menu that contains this command may be obscured by the browser’s own right-click menu. Click somewhere outside the main browser canvas — such as in the address bar — to dismiss the browser menu and reveal the MathJaX one behind it).

1. For inline formulas, enclose the formula in (…). For displayed formulas, use […] . These render differently: ( sum_{i=0}^n i = frac{n^2+n}{2} ) (inline) or [ sum_{i=0}^n i = frac{n^2+n}{2}tag{displayed}]
2. For superscripts and subscripts, use ^ and _. For example, x_i^2: ( x_i^2 ).
3. By default, superscripts, subscripts, and other operations apply only to the next “group”. A “group” is either a single symbol, or any formula surrounded by curly braces {…}. If you do 10^10, you will get a surprise: ( 10^10 ). But 10^{10} gives what you probably wanted: ( 10^{10} ).
4. For a fraction, use frac: frac{a}{b} produces ( frac{a}{b} ); and frac{a+1}{b+1} is ( frac{a+1}{b+1} ).
5. For Greek letters, use alpha, beta, …, omega: ( alpha, beta, … omega ). For uppercase, use Gamma, Delta, …, Omega: ( Gamma, Delta, …, Omega ).
6. Square root sign: Use sqrt, which adjusts to the size of its argument: sqrt{x^3} ( sqrt{x^3} ); sqrt[3]{frac xy} ( sqrt[3]{frac xy} ). For complicated expressions, consider using {…}^{1/2} instead.
7. Parentheses Ordinary symbols ()[] make parentheses and brackets ( (2+3)[4+4] ). These do not scale with the formula in between, so if you write (frac12) the parentheses will be too small: ( (frac12) ).  Using left(…right) will make the sizes adjust automatically to the formula they enclose: left(frac12right) is ( left(frac12right) ).
8. There are a very large number of special symbols and notations, too many to list here; see this shorter listing, or this exhaustive listing. Some of the most common include:
• lt gt le ge neq ( lt, gt, le, ge, neq ). You can use not to put a slash through almost anything: notlt ( notlt ) but it often looks bad.
• times div pm mp ( times, div, pm, mp ). cdot is a centered dot: ( xcdot y )
• cup cap setminus subset subseteq  supset in notin emptyset  ( cup, cap, setminus, subset, subseteq  ,supset, in, notin, emptyset )
• to rightarrow leftarrow Rightarrow Leftarrow mapsto ( to, rightarrow, leftarrow, Rightarrow, Leftarrow, mapsto )
• approx sim cong equiv prec ( approx, sim , cong, equiv, prec ).
• ldots is the dots in ( a_1, a_2, ldots ,a_n ) cdots is the dots in ( a_1+a_2+cdots+a_n )
9. Spaces MathJaX usually decides for itself how to space formulas, using a complex set of rules. Putting extra literal spaces into formulas will not change the amount of space MathJaX puts in: a?b and a????b are both ( a b ). To add more space, use , for a thin space ( a,b ); ; for a wider space ( a;b ). quad and qquad are large spaces: ( aquad b ), ( aqquad b ).
10. To set plain text, use text{…}: ( {xin smid xtext{ is extra large}} ). You can nest ( … ) inside of text{…}.