The goal of the lesson is to become familiar with LaTeX, specifically for the purpose of writing mathematical expressions.
What is LaTeX?
LaTeX is a high-quality typesetting system, primarily used for technical and scientific documents. It is particularly powerful for formatting complex mathematical equations and formulas, making it a preferred choice in academia and research.
What are the advantages of LaTeX?
Getting Started:
Basic Document Structure:
\documentclass{article} % Specifies the document class (article, report, book, etc.) \begin{document} % Begins the content of the document % Your content goes here \end{document} % Ends the content of the document
$…$
.$E = mc^2$
in LaTeX.$$…$$
.$$E = mc^2$$
.\documentclass{article} \begin{document} The equation $E = mc^2$ is famous in physics. It is so important that we can highlight $$E = mc^2$$ by putting it to a separate line. \end{document}
This code will became:
^
for superscripts.$x^2$
.$a_1$
.$\frac{a}{b}$
.\documentclass{article} \begin{document} % Exponent and subscript The formula for the area of a circle is $A = \pi r^2$. % Fraction The equation $\frac{a}{b} = c$ represents a fraction. % Combined The equation for kinetic energy is $K = \frac{1}{2}mv^2$. \end{document}
This code will become:
LaTeX provides a variety of symbols to accurately represent mathematical expressions.
\pm
, which displays as $\pm$.\sqrt{…}
. For example, \sqrt{2}
produces $\sqrt{2}$ \sqrt[3]{…}
, yielding $\sqrt[3]{9}$\infty
, and it is displayed as $\infty$ \geq
and \leq
, which render as $\geq$ and $\leq$, respectively.
The general form of summation in LaTeX is written using the \sum
command. For example, the sum from $i=1$ to $n$ is given by:
$$\sum_{i=1}^{n} i^2$$
This expression sums the squares of integers from 1 to $n$.
The derivative of a function $f(x)$ with respect to $x$ is represented in LaTeX using the \frac
command for fractions. The notation for the derivative of $f(x)$ with respect to $x$ is:
$$\frac{d}{dx} f(x)$$
This gives the rate of change of $f(x)$ with respect to $x$.
For partial derivatives, the \partial
command is used. The partial derivative of a function $f(x, y)$ with respect to $x$ is:
$$\frac{\partial}{\partial x} f(x, y)$$
This expression gives the partial derivative of $f$ with respect to $x$, holding other variables constant.
Partial integration, also known as integration by parts, can be expressed in LaTeX. For the specific example of integrating $x \sin(x)$ from $a$ to $b$, the integral is written as:
\[ \int_{a}^{b} x \sin(x) \, dx \]
This represents the definite integral of $x \sin(x)$ with respect to $x$ from $a$ to $b$.
\documentclass{article} \usepackage{amsmath} \begin{document} \begin{align} 3x + 2y + 0z &= 6 \\ 4x - y &= 25 \end{align} \end{document}
This code will become:
Explanation:
Tips:
\label{}
command and refer to them later with \ref{}
.\begin{equation} \label{eq:quadratic} x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \end{equation}
To refer to this equation later, use Equation \ref{eq:quadratic}
.
Reproduce the following mathematical proof in LaTeX. Use inline and display math, as well as basic and special symbols! Save the result in PDF format!
Raw text:
Proof: √2 is Irrational Assume, for contradiction, that 2 is rational. Then it can be expressed as a fraction a/b, where a and b are coprime integers. Then: HERE COMES AN EQUATION. Squaring both sides: HERE COMES AN EQUATION. Multiplying both sides by b2: HERE COMES AN EQUATION. This implies that a2 is even, so a must also be even. Let a = 2k for some integer k. Substituting into the equation: HERE COMES AN EQUATION. Dividing by 2: HERE COMES AN EQUATION. This implies that b2 is even, so b must also be even. But if both a and b are even, they are not coprime, which contradicts our original assumption. Therefore, 2 must be irrational.