# Maths Commands in LaTeX

• Last Updated : 20 Jun, 2020

LATEX is a document preparation system for producing professional-looking documents. LaTeX is widely used for the communication and publication of scientific documents in many fields, including mathematics, statistics, computer science, engineering, physics, etc. It also has a prominent role in the preparation and publication of books and articles that contain complex multilingual materials, such as Sanskrit and Greek.

So in this post we have discussed the most used TEX commands used for Maths.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

1. Fractions:
Instead of writing fractions as A / B we will use below syntax
Syntax :

\frac{numerator}{denominator}


Example –

\frac{a+1}{b+1}


OUTPUT: 2. Nth power:
Instead of writing powers as x ^ n which is not clear as if it is xor or power so we will use below syntax
Syntax:
x^y


Example –

x^2


OUTPUT: 3. Nth root:
Instead of writing roots as x^(1/N) which is not clear as if it is xor or root so we will use below syntax
Syntax:
\sqrt[N]{27}


Example –

\sqrt{27}


OUTPUT: 4. Matrices
Instead of writing matrices as [[1, x, x^2], [1, y, y^2][1, z, z^2]] which is not very clear use below syntax
Syntax:
\begin{matrix}
1 & x & x^2 \\
1 & y & y^2 \\
1 & z & z^2 \\
\end{matrix}


Example –

\begin{matrix}
1 & x & x^2 \\
1 & y & y^2 \\
1 & z & z^2 \\
\end{matrix}


OUTPUT: 5. Definitions by cases (piecewise function) is a function defined by multiple sub-functions, each sub-function applying to a certain interval of the main function’s domain, a sub-domain.

Syntax:

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


Example –

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


OUTPUT: 6. System of equations is a function defined by multiple sub-functions, each sub-function applying to a certain interval of the main function’s domain, a sub-domain.

Syntax:

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


Example –

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


OUTPUT: 7. Summation is the addition of a sequence of any kind of numbers, called addends or summands; the result is their sum or total.

Syntax:

\sum_{i=0}^n i^2


Example –

\sum_{i=0}^n i^2


OUTPUT: 8. subscriptsis a character that is set slightly below the normal line of type.

Syntax:

\log_2 x


Example –

\log_2 x


OUTPUT: 9. floor is the function that takes as input a real number and gives as output the greatest integer less than or equal to, denoted.

Syntax:

\lfloor n \rfloor


Example –

\lfloor 2.2 \rfloor


OUTPUT: 10. ceil function maps to the least integer greater than or equal to, denoted.

Syntax:

\lceil n \rcei


Example –

\lceil 2.5 \rceil


OUTPUT: 11. Some Combined examples :
Example –

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

for Example –

• Use
\left(\frac{\sqrt x}{y^3}\right)

for Example –

• Use
\Biggl(\biggl(\Bigl(\bigl((n)\bigr)\Bigr)\biggr)\Biggr)

for Example –

• Use
\sqrt{\frac xy}

for My Personal Notes arrow_drop_up