← Course Home Module 1 · Math Foundations
Module 1 · Foundations

Math Foundations

Everything in both papers reduces to a handful of mathematical ideas: vectors and matrices, functions, derivatives, time series, and a little statistics. Master these short sections and no equation in the papers will scare you.

▶
Audio recap
A ~2-minute spoken summary of this module — great for revision on the go.

1.1 Vectors: lists of numbers

A vector is an ordered list of numbers, e.g. v = (2, −1, 3), living in ℝ³ because it has 3 entries. In this course everything becomes a vector: one time-step of plant measurements (power, irradiance, temperature, …), a robot's joint angles (A₁, A₂, A₃, A₄), a 3D point (x, y, z).

Where the papers use this Paper 1 measures how similar two inverters' output histories are with exactly this Euclidean distance (its Eq. 1), and clusters inverters by it. Paper 2 treats every 3D location in the robot's workspace as a vector query. Distance and dot products are not abstractions here — they are the working parts.

1.2 Matrices and rotations

A matrix is a grid of numbers; multiplying a matrix by a vector produces a new vector, each entry a dot product of a matrix row with the input. So a matrix is a machine that transforms vectors. Two uses matter here:

y = W x + b

First, the linear layer — the atom of every neural network in both papers. W (weights) and b (bias) hold the learnable numbers; training means finding good values for them.

Second, rotation matrices. Rotating a 3D point about an axis is a matrix multiplication. Chaining rotations = multiplying their matrices. Paper 2 uses this directly: the robot's first two joints (yaw and pitch) define rotations Ryaw(A₁) and Rpitch(A₂), and the model maps a world point X into the arm's own frame via a transformation built from them:

X′ = T−1X,   T = (Rpitch(A₁) Ryaw(A₀))1

You do not need to derive rotation matrices — you need to explain why they are there: they let the model factor out the first joints' motion geometrically, so the networks only learn what cannot be written down directly.

1.3 Functions, composition, and ReLU

A function maps inputs to outputs; functions can be composed: g(f(x)). A deep network is a long composition of simple layers. Between linear layers we insert a nonlinear activation, almost always ReLU(x) = max(0, x) in these papers: it passes positives, zeroes negatives. Without nonlinearity, stacked linear layers collapse into one linear layer — no curves, no interesting behaviour.

ReLU earning its keep twice Paper 1 chooses ReLU for fast convergence, avoiding vanishing gradients — and notes a bonus: wrongly predicted negative power outputs get clamped to zero, which is physically sensible for a solar plant. Paper 2 wraps ReLU inside its density formula σ = 1 − exp(−ReLU(B)) so that predicted density is always positive and smoothly increasing — stabilizing training. Same little function, two thoughtful jobs.

1.4 Derivatives and gradients: which way is downhill?

The derivative is the slope: how much the output changes per tiny nudge of the input. With many inputs, the gradient ∇f collects all the slopes; it points steepest uphill, so stepping against it walks downhill. That single idea powers everything:

w ← w − η ∇L

η is the learning rate. The chain rule — multiply slopes through a composition — lets gradients flow through many layers (backpropagation, Module 3).

The same hammer, two nails Both papers use gradient descent to train networks (Adam, lr 1×10⁻⁴). But Paper 2 also uses it to control the robot: because the learned self-model is differentiable end-to-end, it can ask "in which direction should I nudge my joint angles so my fingertip moves toward the target?" and follow that gradient (Adam again, lr 0.04). Gradient descent through a learned model replacing hand-derived inverse kinematics — a genuine exam favourite.

1.5 Time series in five minutes

A time series is a sequence of measurements indexed by time: p₁, p₂, …, p_t. Key vocabulary:

Crucial subtlety: time series data must be split chronologically (train on 2015–2017, validate on 2017–2018, test on 2018–2019, as Paper 1 does) — random shuffling would let the model peek at the future.

1.6 Statistics you actually need

1.7 One-hot encoding and encodings in general

Categories must become numbers — but plain integers smuggle in false order. Paper 1 one-hot encodes wind direction into 4 binary entries (N, E, S, W) and month into 12, precisely because "a wind direction of 359° and 0° effectively represents the same direction" — the raw number lies about closeness. A one-hot vector has a single 1 and no false geometry.

The mirror-image trick: sometimes a raw number is too simple for a network to use well. Paper 2 expands each 3D coordinate with positional encoding — a set of sine/cosine transforms at 5 frequencies (3 numbers → 33) — because plain coordinates make it hard for networks to learn fine spatial detail (Module 6). Encoding design, in both directions, is quiet engineering that examiners love to probe.

Exam warm-up — say it out loud
  1. What does Euclidean distance measure, and what does Paper 1 use it for?
  2. Why do neural networks need nonlinear activations, and what two extra jobs does ReLU do in these papers?
  3. Why must time series be split chronologically rather than randomly?
  4. Why one-hot encode wind direction instead of feeding degrees 0–360 directly?

Module 1 Quiz

10 questions. These exact ideas reappear in every later module.

← Previous
Module 0: The Two Worlds