Certainly! Here are some examples of LaTeX code for various mathematical expressions:
-
Inline Math Mode: To include mathematical expressions within a line of text, enclose them with dollar signs $...$.
The quadratic formula is given by $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$.
This will render as: "The quadratic formula is given by (x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a})."
-
Display Math Mode: For standalone equations, use the equation environment.
\begin{equation}
E = mc^2
\end{equation}
This centers the equation and numbers it automatically.
-
Fractions: Use the \frac command to create fractions.
\[
\frac{a}{b} + \frac{c}{d} = \frac{ad + bc}{bd}
\]
This displays the addition of two fractions.
-
Superscripts and Subscripts: Use ^ for superscripts and _ for subscripts.
\[
x_i^2 + y_j^2 = z_k^2
\]
This represents variables with subscripts and their squares.
-
Summation and Integration: Use \sum for summation and \int for integration.
\[
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
\]
This represents the formula for the sum of the first (n) natural numbers.
\[
\int_{a}^{b} x^2 \, dx = \frac{b^3}{3} - \frac{a^3}{3}
\]
This represents the definite integral of (x^2) from (a) to (b).
-
Matrices: Use the array or pmatrix environment to create matrices.
\[
A = \begin{pmatrix}
a_{11} & a_{12} \\
a_{21} & a_{22}
\end{pmatrix}
\]
This creates a 2x2 matrix.
-
Piecewise Functions: Use the cases environment to define piecewise functions.
\[
f(x) =
\begin{cases}
x^2 & \text{if } x \geq 0 \\
-x & \text{if } x < 0
\end{cases}
\]
This defines a piecewise function with two cases.
-
Greek Letters and Symbols: Use commands like \alpha, \beta, \gamma, etc., to include Greek letters.
\[
\alpha + \beta = \gamma
\]
This displays the sum of alpha and beta equaling gamma.
For a comprehensive guide on mathematical expressions in LaTeX, you can refer to the Overleaf documentation[1]: