The mathematical equations and symbols in this website is created using MathJax service.

MathJax enables us to use LaTeX code in WordPress for mathematical equations/symbols.

How to Use MathJax on WordPress

To use MathJax on WordPress, write the following code in header.php.

(I put the code just before </head > .)

That’s it!!

<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ["\(","\)"]] } }); </script> <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <meta http-equiv="X-UA-Compatible" CONTENT="IE=EmulateIE7" />

For example,

if you type $\sin x$ in an editor, it gives $\sin x$.

\begin{align*} \cos^2 x +\sin^ 2 x=1 \end{align*}

creates

\begin{align*}

\cos^2 x +\sin^ 2 x=1

\end{align*}

My setting with macros

Here is my current setting. The following codes include macros as well.

<script type="text/x-mathjax-config">// <![CDATA[ MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ["\(","\)"]] }, TeX: { Macros: { R: "{\mathbb R}", N: "{\mathbb N}", C: "{\mathbb C}", Z: "{\mathbb Z}", Q: "{\mathbb Q}", SL: "{\operatorname {SL}}", SO: "{\operatorname {SO}}", GL: "{\operatorname {GL}}", id: "{\mathbb {id}}", tr: "{\operatorname {tr}}", trans: "{\mathrm T}", Span: "{\operatorname {Span}}", Hom: "{\operatorname {Hom}}", Rep: "{\operatorname {Rep}}", Aut: "{\operatorname {Aut}}", End: "{\operatorname {End}}", Repart: "{\operatorname {Re}}", Impart: "{\operatorname {Im}}", im: "{\operatorname {im}}", rk: "{\operatorname {rank}}", nullity: "{\operatorname {null}}", Stab: "{\operatorname {Stab}}", Zmod: ["{\mathbb Z / #1 \mathbb Z}",1], bold: ["{\bf #1}",1], Abs: ['\left\lvert #2 \right\rvert_{\text{#1}}', 2, ""] } } }); </script> <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <meta http-equiv="X-UA-Compatible" CONTENT="IE=EmulateIE7" />

Useful LaTeX code for MathJax.

Here is the list of LaTeX codes that I used in this website and I found them useful.

System of equations

Here is the LaTeX code for the system of equations.

\[ \left\{ \begin{array}{c} a_1x+b_1y+c_1z=d_1 \ a_2x+b_2y+c_2z=d_2 \ a_3x+b_3y+c_3z=d_3 \end{array} \right. \]

The result is

\[

\left\{

\begin{array}{c}

a_1x+b_1y+c_1z=d_1 \\

a_2x+b_2y+c_2z=d_2 \\

a_3x+b_3y+c_3z=d_3

\end{array}

\right.

\]

If you don’t need the big bracket, then omit \left\{ and \right. from the above code.

The LaTex code

\[\begin{array}{c} a_1x+b_1y+c_1z=d_1 \ a_2x+b_2y+c_2z=d_2 \ a_3x+b_3y+c_3z=d_3 \end{array} \]

generates

\[\begin{array}{c}

a_1x+b_1y+c_1z=d_1 \\

a_2x+b_2y+c_2z=d_2 \\

a_3x+b_3y+c_3z=d_3

\end{array}.

\]

Augmented matrix

By writing

\[ \left[\begin{array}{rrr|rrr} 1 & 0 & 0 & 1 &1 & 1 \ 0 & 1 & 0 & 0 & 1 & 1 \ 0 & 0 & 1 & 0 & 0 & 1 \ \end{array} \right] \]

You get

\[ \left[\begin{array}{rrr|rrr}

1 & 0 & 0 & 1 &1 & 1 \\

0 & 1 & 0 & 0 & 1 & 1 \\

0 & 0 & 1 & 0 & 0 & 1 \\

\end{array} \right]\]

Block matrix

To write a block matrix using MathJax, write the following LaTeX code

\[ M= \left[\begin{array}{c|c} A & B\ \hline C & D \end{array} \right] \]

The result is

\[

M=

\left[\begin{array}{c|c}

A & B\\

\hline

C & D

\end{array}

\right] \]

Matrix with fractions

When you write a matrix whose entries are fractions, you might feel the line are cramped.

So to widen the gap between lines, use \\[6pt] instead of \\ as in the following code.

\[ A=\begin{bmatrix} \frac{1}{3} & \frac{1}{3} & \frac{1}{3} \[6pt] \frac{2}{3} &\frac{-1}{3} &\frac{-1}{3} \[6pt] \frac{1}{3} & \frac{1}{3} & \frac{-2}{3} \end{bmatrix} \]

The result is

\[

A=\begin{bmatrix}

\frac{1}{3} & \frac{1}{3} & \frac{1}{3} \\

\frac{2}{3} &\frac{-1}{3} &\frac{-1}{3} \\

\frac{1}{3} & \frac{1}{3} & \frac{-2}{3}

\end{bmatrix}

\]

Elementary row operations (Gauss-Jordan elimination)

To get

\[ \left[\begin{array}{rrrr|r}

1 & 1 & 1 & 1 &1 \\

0 & 1 & 2 & 3 & 5 \\

0 & -2 & 0 & -2 & 2 \\

0 & 1 & -2 & 3 & 1 \\

\end{array}\right] \xrightarrow{\substack{R_1-R_2 \\ R_3-R_2\\R_4-R_2}}

\left[\begin{array}{rrrr|r}

1 & 0& -1 & -2 &-4 \\

0 & 1 & 2 & 3 & 5 \\

0 & 0 & 4 & 4 & 12 \\

0 & 0 & -4 & 0 & -4 \\

\end{array}\right] \xrightarrow[\frac{-1}{4}R_4]{\frac{1}{4}R_3}

\left[\begin{array}{rrrr|r}

1 & 0& -1 & -2 &-4 \\

0 & 1 & 2 & 3 & 5 \\

0 & 0 & 1 & 1 & 3 \\

0 & 0 & 1 & 0& 1 \\

\end{array}\right] \] write the LaTeX code

\left[\begin{array}{rrrr|r} 1 & 1 & 1 & 1 &1 \ 0 & 1 & 2 & 3 & 5 \ 0 & -2 & 0 & -2 & 2 \ 0 & 1 & -2 & 3 & 1 \ \end{array}\right] \xrightarrow{\substack{R_1-R_2 \ R_3-R_2\R_4-R_2}} \left[\begin{array}{rrrr|r} 1 & 0& -1 & -2 &-4 \ 0 & 1 & 2 & 3 & 5 \ 0 & 0 & 4 & 4 & 12 \ 0 & 0 & -4 & 0 & -4 \ \end{array}\right] \xrightarrow[\frac{-1}{4}R_4]{\frac{1}{4}R_3} \left[\begin{array}{rrrr|r} 1 & 0& -1 & -2 &-4 \ 0 & 1 & 2 & 3 & 5 \ 0 & 0 & 1 & 1 & 3 \ 0 & 0 & 1 & 0& 1 \ \end{array}\right]

Use array for tabular

The LaTeX code for the following table

\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 \\

3 & 4 & 3\\

4 & 1 & 2\\

\hline

\end{array}

is

\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 \ 3 & 4 & 3\ 4 & 1 & 2\ \hline \end{array}

Giving reasons for each line in align

To give a reason how to obtain each equality, like

\begin{align*}

f(ab)&=(ab)^2 && (\text{by definition of $f$})\\

&=(ab)(ab)\\

&=a^2 b^2 && (\text{since $G$ is abelian})\\

&=f(a)f(b) && (\text{by definition of $f$}).

\end{align*}

write the LaTex code

\begin{align*} f(ab)&=(ab)^2 && (\text{by definition of $f$})\ &=(ab)(ab)\ &=a^2 b^2 && (\text{since $G$ is abelian})\ &=f(a)f(b) && (\text{by definition of $f$}). \end{align*}

Cases

If the values of a function depends on cases (like parity), you might want to write:

\begin{align*}

\det(A)&=1+(-1)^{n+1} \\

&= \begin{cases}

2 & \text{ if } n \text{ is odd}\\

0 & \text{ if } n \text{ is even}.

\end{cases}

\end{align*}

The following LaTex code produces the above equation with cases:

\begin{align*} \det(A)&=1+(-1)^{n+1} \ &= \begin{cases} 2 & \text{ if } n \text{ is odd}\ 0 & \text{ if } n \text{ is even}. \end{cases}

Arrows

When you want to say $A$ implies $B$, and want to write $A\implies B$, then use

\implies for the allow $\implies$.

The opposite direction arrow $\impliedby$ is given by \impliedby .

When you want to say $A$ if and only if $B$, and want to write $A\iff B$, then use

\iff for the allow $\iff$.

Symbols Latex codes $\implies$ \implies $\impliedby$ \impliedby $\iff$ \iff $\mapsto$ \mapsto $\to$ \to $\gets$ \gets $\rightarrow$ \rightarrow $\leftarrow$ \leftarrow $\Rightarrow$ \Rightarrow $\Leftarrow$ \Leftarrow $\hookrightarrow$ \hookrightarrow $\hookleftarrow$ \hookleftarrow

Second derivative

If you want to write the second derivative $f^{\prime\prime}$, then write the LaTeX code f^{\prime\prime} .

Note that for the first derivative $f’$, the latex code f' works but f'' produces $f”$.

The length (magnitude) of vectors

To write a length of a vector such as

\[\|\mathbf{v}\| \text{ or } \left\|\frac{a}{b}\right \|,\] use the LateX codes

\|\mathbf{v}\|

or

\left\|\frac{a}{b}\right \|

Explanations under equations

If you want to add some explanations under an equation like

\[n=\underbrace{1+1+\cdots+1}_{\text{$n$ times}},\] then use the Latex code

\[n=\underbrace{1+1+\cdots+1}_{\text{$n$ times}}.\]

Integral

An integral of a function

\[\int_{a}^{b} \! f(x)\,\mathrm{d}x\] is generated by the LaTex code

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

Note that \! narrows the space between the integral sign and the function, and \, increases the space between the function and $\mathrm{d}x$.

Crossing things out

To strike through an expression obliquely like \(\require{cancel}\)$\cancel{A}$ to cancel the expression $A$, we first need to put the code

\(\require{cancel}\)

before the formula where you want to put $\cancel{A}$.

You just need only one \(\require{cancel}\) per page.

Then write the LaTex code \cancel{A} .

Reference

The following website contains more useful LaTex codes for MathJax.

MathJax basic tutorial and quick reference

For LaTex symbols, check the website LaTeX:Symbols (Art of Problem Solving).