HTML for Math using Mathjax

This tutorial is about how to write mathematical equations and expressions in HTML. The tutorial is basically aimed at using the Mathjax javascript library.

The Library we use will be included inline, though it is possible for you to download a copy and keep it in your server.

Your first HTML Math equation

Here is our first code for the Mathjax equation.

<title>Reference Designer Title </title>
<script type="text/javascript"

My first html Page.<i>This text is italics</i>

$$x^2 = \frac{n^2+n}{2}$$

It will produce a code that will look something like

$$x^2 = \frac{n^2+n}{2}$$

You may like to try this example here.

We suggest that you make changes in the code to see how it works.


1. To display a formula in a new line strat the formula with $$ and end it with $$ .

2.The x^2 is rendered as x squared 2 or $$x^2$$ .

3. To render $$\frac{x}{y}$$ we write \frac{x}{y}.


You may want to take up the following exercise to strengthen your understanding.
1. Render the formula $$x^y = \frac{p^q+n^3}{2}$$