LaTeX Code. How to Write an Equation?

All logged in users can include math equations in their posts and it is easy to do. Inline equations can be written between dollar signs and centered equations are between double dollar signs.

If you write $x = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}$ the output will be $x = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}$ which is an inline equation. If you wish to center the equation, you can write $$x = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$ and it will result to this $$x = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$ which is a centered equation.

Here are the most used $\rm\LaTeX$ code.

Name LaTeX Code Output
Power $x^2$ $x^2$
Subscript $x_1$ $x_1$
Square root $\sqrt{x}$ $\sqrt{x}$
nth root $\sqrt[n]{x}$ $\sqrt[n]{x}$
Small fraction $\frac{a}{b}$ $\frac{a}{b}$
Full fraction $\dfrac{a}{b}$ $\dfrac{a}{b}$
Summation $$\sum_{i = 1}^n x_i$$ $\displaystyle \sum_{i = 1}^n x_i$
Integral $$\int_a^b f(x) \, dx$$ $\displaystyle \int_a^b f(x) \, dx$
Partial $\dfrac{\partial y}{\partial x}$ $\dfrac{\partial y}{\partial x}$
Trigonometric $\sin \theta$ $\sin \theta$
Angle $\pi = 180^\circ$ $\pi = 180^\circ$
Parenthesis $\left( 1 - \dfrac{x}{y} \right)$ $\left( 1 - \dfrac{x}{y} \right)$
Brackets $\left[ 1 - \dfrac{x}{y} \right]$ $\left[ 1 - \dfrac{x}{y} \right]$


Sample Equations

  • Pythagorean Theorem

    Code: $\sin^2 \theta + \cos^2 \theta = 1$

    Output: $\sin^2 \theta + \cos^2 \theta = 1$

  • Euler's Identity

    Code: $e^{i\pi} + 1 = 0$

    Output: $e^{i\pi} + 1 = 0$

  • Laplace Transform

    Code: $\displaystyle F(s) = \int_0^\infty e^{-st} \, f(t) \, dt$

    Output: $\displaystyle F(s) = \int_0^\infty e^{-st} \, f(t) \, dt$