Skip to main content

01. Mathematical Notation — The Minimum Grammar of Optimization

// BACKGROUND 1/6 — read sets, intervals, vectors, functions, mappings, summations, and norms in a consistent way

Optimization documents look difficult because they contain many symbols. But most of them are shorthand for "a collection of possible values," "a rule that maps inputs to outputs," "a way of adding several terms," or "a way of measuring magnitude."

Sets and intervals

A set is a collection of elements. For example, xSx \in S means that "xx is an element of the set SS." Optimization expresses all possible candidates as a set.

An interval is a contiguous portion of the real numbers.

NotationMeaningEndpoints included?
[a,b][a,b]At least aa and at most bbBoth
(a,b)(a,b)Greater than aa and less than bbNeither
[a,b)[a,b)At least aa and less than bbLeft only
(a,b](a,b]Greater than aa and at most bbRight only

The feasible region of an optimization problem is usually written in set notation:

F={xRngi(x)0, hj(x)=0}.\mathcal{F}=\{x\in\mathbb{R}^n \mid g_i(x)\le 0,\ h_j(x)=0\}.

Here F\mathcal{F} is "the set of candidates satisfying every constraint."

Vectors

A vector bundles several numbers into one decision:

x=(x1,x2,,xn)Rn.x = (x_1,x_2,\dots,x_n)^\top \in \mathbb{R}^n.

In optimization, xx is usually the decision variable. In a factory design, for example, x1x_1 might be length, x2x_2 thickness, and x3x_3 flow rate.

:::tip Sentence to remember Choosing one scalar is searching on a line; choosing a vector is searching for a point in a space. :::

Functions and mappings

A function is a rule that maps inputs to outputs.

f:RnRf:\mathbb{R}^n\to\mathbb{R}

maps an nn-dimensional vector to one number. An objective function usually has this form:

minxRnf(x).\min_{x\in\mathbb{R}^n} f(x).

In contrast, F:RnRmF:\mathbb{R}^n\to\mathbb{R}^m maps an input vector to an output vector. It is natural to view several constraints or simulation outputs as a vector-valued function.

Summation

Summation notation compresses repeated addition.

i=1nxi=x1+x2++xn.\sum_{i=1}^{n} x_i = x_1+x_2+\cdots+x_n.

The mean squared error of a regression problem is usually written as

1ni=1n(yiy^i)2.\frac{1}{n}\sum_{i=1}^{n}(y_i-\hat{y}_i)^2.

It is simple to read: substitute values from i=1i=1 through nn and add everything.

Norms

A norm is a function that measures the magnitude of a vector. The Euclidean norm is used most often:

x2=x12+x22++xn2.\|x\|_2=\sqrt{x_1^2+x_2^2+\cdots+x_n^2}.

Optimization uses norms to decide "how far did we move?", "how large is the error?", and "has the gradient become small enough?"

NormDefinitionIntuition
x1\|x\|_1$\sum_ix_i
x2\|x\|_2ixi2\sqrt{\sum_i x_i^2}Straight-line distance
x\|x\|_\infty$\max_ix_i

How to read an optimization statement

Consider

minxRnf(x)subject toAxb.\min_{x\in\mathbb{R}^n} f(x)\quad\text{subject to}\quad Ax\le b.

It reads as follows:

  1. Choose a vector called xx.
  2. We want to make f(x)f(x) small.
  3. But the constraint AxbAx\le b must be respected.
  4. Find the best point among the possible values of xx.

Next: Calculus for Optimization