Orthogonal

For functions f and g defined on the range [lo..hi], define their inner product to be
<f, g> = lo..hi f(x) g(x) dx,
and the norm
||f||2 = <f, f>1/2     (also written as just ||f||);
 
hence
<c f, g> = <f, c g> = c <f, g>
and
||c f||2 = c ||f||2,   where c is a constant.
 
Functions {fi | i ≥ 0} are orthogonal if
<fi, fj> = 0,   ∀ i, j s.t. i≠j
and are orthonormal if also
||fi|| = 1,   ∀ i.
 
Note that
-1..+1 f(x) dx = 1/a -a..+a f(y/a) dy
and that
-a..+a f(x) dx = -a+b..a+b f(y-b) dy
so one can scale and shift a set of orthogonal functions to another range, [lo, hi], and normalise them (individually).
 

Series of Functions

If a function f(x) has an expansion
f(x) = a0f0(x) + a1f1(x) + ...
over [lo, hi] in terms of orthogonal basis functions, {f0(x), f1(x), ...}, then
<f, fi> = [lo..hi] f(x) fi(x) dx
= [lo..hi] a0 f0(x) fi(x) + a1 f1(x) fi(x) + ... dx
= a0.<f0,fi> + a1.<f1,fi> + ...
= a0 . 0 + ... + ai-1 . 0 + ai . ||fi||2 + ai+i . 0 + ...
= ai . ||fi||2
so
ai = <f, fi> / ||fi||2
If the basis functions are orthonormal then ai = <f, fi>.
 

Interpolation

Suppose we are given "training" data points {(x1, y1), (x2, y2), ..., (xN, yN)}, where the xi ∈ [lo, hi], and want to find a function, f(x), that is a "good" fit to the data, that is each f(xi) is close to its corresponding yi. A common approach is to try to find some function, f(), expressed as a series in terms of a set of "simple" functions (orthonormal basis functions have advantages), which amounts to solving the resulting linear regression problem to minimise the sum of the squared errors, i (yi - f(xi))2.
A random example computed by JavaScript (if it is on) ...
true f=sawtooth, range=[-1,1]
sampled {x[i]} : -0.9, -0.83, -0.81, -0.72, -0.62, -0.6, -0.45, -0.43, -0.26, -0.16, -0.16, 0.16, 0.29, 0.4, 0.48, 0.7, 0.74, 0.75, 0.95, 0.97,
sampled {y[i]} : -0.21, -0.34, -0.37, -0.55, -0.76, -0.8, -0.91, -0.86, -0.51, -0.33, -0.32, 0.32, 0.58, 0.8, 0.97, 0.59, 0.53, 0.5, 0.1, 0.06,
fit polynomial, order 3 :
{est_f(x[i])}: -0.15, -0.38, -0.43, -0.64, -0.77, -0.78, -0.77, -0.76, -0.54, -0.37, -0.37, 0.32, 0.57, 0.72, 0.79, 0.72, 0.67, 0.64, 0.04, -0.05,
RMS=0.089, <true_f,est_f>=0.64
fit polynomial, order 5 :
{est_f(x[i])}: -0.17, -0.36, -0.4, -0.6, -0.76, -0.78, -0.82, -0.81, -0.58, -0.39, -0.38, 0.42, 0.67, 0.79, 0.82, 0.61, 0.55, 0.52, 0.1, 0.05,
RMS=0.06, <true_f,est_f>=0.65