\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{amssymb} \title{Exercise 8:Math Formula} \begin{document} \maketitle \section{Numbered Equation} \label{sec:one} Add $a$ squared and $b$ squared to get $c$ squared. Or, using a more mathematical approach. \\ You can use numbered equation as in section ~\ref{sec:one} or un-numbered equation as in section~\ref{sec:two}. \begin{equation} \label{eq:one} a^2 + b^2 = c^2 \end{equation} \section{Numbered Equation} \label{sec:two} \begin{equation*} \label{eq:two} a^2 + b^2 = c^2 \end{equation*} Formulas as listed in Equation~\ref{eq:one} and Equation~\ref{eq:two} are doing the same task. \section{Array Equation} \label{sec:three} \begin{equation*} \mathbf{X} = \left( \begin{array}{ccc} x_1 & x_2 & \ldots \\ x_3 & x_4 & \ldots \\ \vdots & \vdots & \ddots \end{array} \right) \end{equation*} \section{Multi-value Equation} \label{sec:four} \begin{equation*} |x| = \left\{ \begin{array}{rl} -x & \text{if } x < 0,\\ 0 & \text{if } x = 0,\\ x & \text{if } x > 0. \end{array} \right. \end{equation*} \section{Macro} \begin{equation} \mathbf{P}= \begin{bmatrix} p_{11} & p_{12} & \ldots & p_{1n} \\ p_{21} & p_{22} & \ldots & p_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ p_{m1} & p_{m2} & \ldots & p_{mn}\end{bmatrix} \end{equation} \section{Fractions} \begin{equation*} 1 + (\frac{1}{1-x^{2}})^3 \end{equation*} \end{document}