# MathJax

Back to: Index
In order to use mathjax.js put this into the header:
<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-MML-AM_CHTML' async></script>

## Example

When $$a \ne 0$$, there are two solutions to $$ax^2 + bx + c = 0$$ and they are
$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$

$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$

## Modes

### Inline mode

$$\sum_{i=0}^n i^2=\frac{(n^2+n)(2n+1)}{6}$$ = $$\sum_{i=0}^n i^2=\frac{(n^2+n)(2n+1)}{6}$$

### Display mode

$$\sum_{i=0}^n i^2=\frac{(n^2+n)(2n+1)}{6}$$ $\sum_{i=0}^n i^2=\frac{(n^2+n)(2n+1)}{6}$

### Mode enforcement

$$\displaystyle \lim_{t \to 0} \int_t^1 f(t)\, dt \;$$ vs $$\; \lim_{t \to 0} \int_t^1 f(t)\, dt$$.

enforced with \displaystyle inside text mode and with \textstyle inside display mode

# Syntax

## Greek letters

$$\alpha \beta \Delta \Omega$$ = \alpha \beta \Delta \Omega

## Parentheses

$$(1)$$ = (1)
$$[1]$$ = [1]
$$\{1\}$$ = \{1\}
$$|1|$$ = |1|
$$\|1\|$$ = \|1\|
$$\lvert{1}\rvert$$ = \lvert{x}\rvert
$$\lVert{1}\rVert$$ = \lVert{x}\rVert

$$\left( \frac{x}{y} \right)$$ = \left( \right)
$$\left[ \frac{x}{y} \right]$$ = \left[ \right]
$$\left\{ \frac{x}{y} \right\}$$ = \left\{ \right\}
$$\left| \frac{x}{y} \right|$$ = \left| \right|
$$\lvert \frac{x}{y} \rvert$$ = \lvert \rvert
$$\left\vert \frac{x}{y} \right\vert$$ = \left\vert \right\vert
$$\lVert \frac{x}{y} \rVert$$ = \lVert \rVert
$$\left\Vert \frac{x}{y} \right\Vert$$ = \left\Vert \right\Vert
$$\left\langle \frac{x}{y} \right\rangle$$ = \left\langle \right\rangle
$$\binom nk$$ = \binom nk

Invisible parentheses with .:
$$\left. \frac{x}{y} \right\}$$ = \left. \right\}

## Sums, integrals, etc

$$\sum_1^ni^2$$ = \sum_1^ni^2
$$\sum_{i=1}^\infty x^2$$ = \sum_{i=1}^\infty x^2
$$\iint_{i=1}^\infty x^2$$ = \iint_{i=1}^\infty x^2
$$\prod_{i=1}^n x^2$$ = \prod_{i=1}^n x^2

## Fractions

$$\frac ab$$ = \frac ab
$$\dfrac ab$$ = \dfrac ab = in displaymode!
$$\frac{a+1}{b+1}$$ = \frac{a+1}{b+1}
$$\sqrt[3] \frac{x^3}{b}$$ = \sqrt[3] \frac{x^3}{b}
$$x^\frac 23$$ = x^\frac 23

$$\lim_{x\to 0}$$ =\lim_{x\to 0}
$$\displaystyle\lim_{x\to 0}$$ =\displaystyle\lim_{x\to 0}

$$\hat x$$ = \hat x
$$\widehat {xy}$$ = \widehat {xy}
$$\bar x$$ = \bar x

$$\vec x$$ = \vec x
$$\overrightarrow {xyz}$$ = \overrightarrow {xyz}
$$\lvert x \rvert$$ = \lvert x \rvert
$$\lVert x \rVert$$ = \lVert x \rVert
$$_5C_3$$ = _5C_3

## Matrices

### matrix

$$\begin{matrix} 1 & x \\ 1 & y \end{matrix}$$ = \begin{matrix} 1 & x \\ 1 & y \end{matrix}

### pmatrix (parentheses)

$$\begin{pmatrix} 1 & x \\ 1 & y \end{pmatrix}$$ = \begin{pmatrix} 1 & x \\ 1 & y \end{pmatrix}

### bmatrix (curved bracket)

$$\begin{bmatrix} 1 & x \\ 1 & y \end{bmatrix}$$ = \begin{bmatrix} 1 & x \\ 1 & y \end{bmatrix}

### Bmatrix (square Bracket)

$$\begin{Bmatrix} 1 & x \\ 1 & y \end{Bmatrix}$$ = \begin{Bmatrix} 1 & x \\ 1 & y \end{Bmatrix}

### vmatrix (vertical line)

$$\begin{vmatrix} 1 & x \\ 1 & y \end{vmatrix}$$ = \begin{vmatrix} 1 & x \\ 1 & y \end{vmatrix}

### Vmatrix (Vertical lines)

$$\begin{Vmatrix} 1 & x \\ 1 & y \end{Vmatrix}$$ = \begin{Vmatrix} 1 & x \\ 1 & y \end{Vmatrix}

### Smallmatrix

$$\bigl(\begin{smallmatrix}a&b\\c&d\end{smallmatrix}\bigr)$$  \bigl(\begin{smallmatrix}a&b\\c&d\end{smallmatrix}\bigr) 

## Arrays

$$\left[ \begin{array}{cc|c} 1 & 2 & 3 \\ \hline 1 & x & y \\ \end{array} \right]$$  \left[ \begin{array}{cc|c} 1 & 2 & 3 \\ \hline 1 & x & y \\ \end{array} \right] 

## Alignment

\begin{align} a^2-b^2 & = (a+b)(a-b) \\ &= a^2 + ab -ab +b^2 \end{align}
 \begin{align} a^2-b^2 & = (a+b)(a-b) \\ &= a^2 + ab -ab +b^2 \end{align} 

## Cases

$$f(n) = \begin{cases} n/2, & \text{if n is even} \\ 3n+1, & \text{if n is odd} \end{cases}$$
 f(n) = \begin{cases} n/2, & \text{if $n$ is even} \\ 3n+1, & \text{if $n$ is odd} \end{cases} 

## Tables

$$\begin{array}{c|lcr} n & \text{Left} & \text{Center} & \text{Right} \\ \hline 1 & 0.24 & 1 & \color{red}{125} \\ 2 & -1 & 189 & -8 \\ 3 & -20 & 2000 & 1+10i \end{array}$$
 \begin{array}{c|lcr} n & \text{Left} & \text{Center} & \text{Right} \\ \hline 1 & 0.24 & 1 & 125 \\ 2 & -1 & 189 & -8 \\ 3 & -20 & 2000 & 1+10i \end{array} 

## Table with Lines

$$\begin{array}{ |c|c|c| } \hline a & a^2 \pmod{5} & 2a^2 \pmod{5} \\ \hline 0 & 0 & 0 \\ 1 & 1 & 2 \\ 2 & 4 & 3 \\ \hline \end{array}$$
 $$\begin{array}{ |c|c|c| } \hline a & a^2 \pmod{5} & 2a^2 \pmod{5} \\ \hline 0 & 0 & 0 \\ 1 & 1 & 2 \\ 2 & 4 & 3 \\ \hline \end{array}$$ 

## Highlighted Box

$$\bbox[#ffe,5px,border:2px solid #fee] { e^x=\lim_{n\to\infty} \left( 1+\frac{x}{n} \right)^n \qquad (1) }$$
 $$\bbox[yellow,5px,border:2px solid red] { e^x=\lim_{n\to\infty} \left( 1+\frac{x}{n} \right)^n \qquad (1) }$$ 

## Arrows

$$\implies$$ =  \implies
$$\impliedby$$ = \impliedby
$$\iff$$ =  \iff
$$\mapsto$$ =  \mapsto
$$\to$$ =  \to
$$\gets$$  \gets
$$\rightarrow$$ =  \rightarrow
$$\leftarrow$$ = \leftarrow
$$\Rightarrow$$ = \Rightarrow
$$\Leftarrow$$ =  \Leftarrow

## Vector

$$\|\mathbf{v}\|$$ =  \|\mathbf{v}\|

## Integral

$$\int_{a}^{b} \! f(x)\,\mathrm{d}x$$ =  \int_{a}^{b} \! f(x)\,\mathrm{d}x

## Binomial

$$\binom nk$$ =  \binom nk

## Underbrace

$$\underbrace{a_0+a_1+a_2+\cdots+a_n}_{x}$$ = $$\underbrace{a_0+a_1+a_2+\cdots+a_n}_{x}$$

$$\overbrace{a_0+a_1+a_2+\cdots+a_n}^{x}$$ = $$\overbrace{a_0+a_1+a_2+\cdots+a_n}_{x}$$

## Alignment

Aligning e.g. "$$=$$" signs and "$$|$$":
\begin{align} 2+3x&=y &&|-2\\ 3x&=y-2 &&|\div 3\\ x&=\frac{y-2}{3} \end{align}
 \begin{align} 2+3x&=y &&|-2\\ 3x&=y-2 &&|\div 3\\ x&=\frac{y-2}{3} \end{align} 

## Fonts

$$\mathrm{ABCD abcd}$$ =  \mathrm{ABCD abcd}  = rm=Roman font
$$\mathsf{ABCD abcd}$$ =  \mathsf{ABCD abcd}  = sf=sans-serif
$$\mathtt{ABCD abcd}$$ =  \mathtt{ABCD abcd}  = tt=typewriter
$$\mathbf{ABCD abcd}$$ =  \mathbf{ABCD abcd}  = bf=boldface
$$\mathbb{ABCD abcd}$$ =  \mathbb{ABCD abcd}  = bb=blackbord bold
$$\mathfrak{ABCD abcd}$$ =  \mathfrak{ABCD abcd}  = frak=fraktur