head> LaTeX Lab • Calculus, Algebra & Structure
Back to main LaTeX Lab
Calculus, algebra & structure

This page focuses on the LaTeX patterns that appear again and again in analysis, ODE, algebra, and linear algebra: fractions, limits, integrals, series, matrices, and determinants.

Limits, integrals & derivatives Series & products 🧮Matrices & determinants

Modules for calculus and algebra

Module A • Fractions, roots & simple expressions
Warm-up

Almost every computation involves fractions and roots. The pattern \frac{...}{...} and \sqrt{...} must become automatic.

$$
\frac{1}{1+x^2},\quad
\frac{a+b}{2},\quad
\sqrt{x^2+1},\quad
\sqrt[n]{1+x}
$$

Exercise: write the midpoint formula, the quadratic formula, and one inequality you know using \frac{...}{...} and \sqrt{...}.

Module B • Limits, derivatives & integrals
Analysis / ODE

For limits and derivatives, the subscript goes under the \lim and the variable of differentiation appears in the denominator:

$$
\lim_{x \to 0} \frac{\sin x}{x} = 1
$$

$$
f'(x) = \frac{d}{dx} f(x)
$$

$$
\int_0^1 x^n\,dx = \frac{1}{n+1}
$$

Exercise: write the definition of the derivative of a function at a point using \lim and \frac{...}{...}.

Module C • Sums & products
Series

Summations and products carry lower and upper indices and often include conditions:

$$
\sum_{n=0}^{\infty} a_n x^n
$$

$$
\sum_{k=1}^{n} k = \frac{n(n+1)}{2}
$$

$$
\prod_{p \leq n} p
$$

Exercise: type the geometric series \(\sum_{n=0}^{\infty} ar^n\) and its closed form, then specialise to your favourite value of \(r\).

Module D • Matrices, determinants & vectors
Linear algebra

Use pmatrix for matrices with parentheses and \det or vertical bars for determinants:

$$
A =
\begin{pmatrix}
1 & 2 \\
3 & 4
\end{pmatrix},
\quad
\det(A) = 1\cdot 4 - 2\cdot 3 = -2.
$$

$$
\mathbf{v} = (v_1,\dots,v_n),\quad
\langle x, y \rangle = \sum_{i=1}^n x_i y_i.
$$

Exercise: write the 3×3 identity matrix, a diagonal matrix, and the determinant of a 3×3 upper triangular matrix.

Worked example: limit and derivative

A typical exam-style computation can be written cleanly in LaTeX. Compare this with how you would write the same argument by hand.

Derivative from first principles

% Derivative of f(x) = x^2 from first principles.

Let $f(x) = x^2$. Then
$$
f'(x)
= \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}
= \lim_{h \to 0} \frac{(x+h)^2 - x^2}{h}
= \lim_{h \to 0} \frac{2xh + h^2}{h}
= \lim_{h \to 0} (2x + h)
= 2x.
$$

Exercise: adapt this template to compute the derivative of \(f(x) = x^3\) using the same first-principles definition.

Worked example: matrix and determinant

Upper triangular matrix

Let
$$
B =
\begin{pmatrix}
1 & 2 & 3 \\
0 & 1 & 4 \\
0 & 0 & 1
\end{pmatrix}.
$$
Then the determinant of $B$ is the product of the diagonal entries:
$$
\det(B) = 1 \cdot 1 \cdot 1 = 1.
$$

Exercise: write a general 3×3 upper triangular matrix with diagonal entries \(a,b,c\) and compute its determinant in LaTeX.

Mini routine for UI courses

At the end of each week in a calculus or algebra course, choose:

  1. One limit or integral you found difficult.
  2. One linear algebra computation (matrix, determinant, or eigenvalue problem).

Then, in the LaTeX Lab editor:

  • • Write the full question in LaTeX.
  • • Solve it step by step, using align to line up the equal signs.
  • • Copy the result into your course notes or Overleaf project.

By the time exams arrive, you will already have a clean LaTeX summary of your main ideas and techniques.