We started with natural numbers to count discrete objects. Then we extended them to integers to have the closure property satisfied for the subtraction operator (or less formally, to be able to use numbers to describe profit and loss statements).
Then we extended them to rationals to talk about ratios, then to reals to include square and other roots and sums of infinite series (transcendental numbers). Then we extended them to complex numbers to have the closure property satisfied for the square roots and thus to exponentiation by rationals.
We also extend it to vectors, numbers that have two, three or n dimentions and to Hamiltonions (quaternions) which are a generalization of complex numbers etc.
This extension of the concept of numbers is driven partially by the need to model the world efficiently, many of the extensions have come from physics.
When we look back at the new theories that resulted while extending the concept of numbers of we can extract out common patterns in the number systems and their spaces and this gives rise to mathematical structures such as groups, rings, fields etc.
Function spaces is essentially extending the concept of numbers to include functions.
To understand function spaces, we first need to understand Hilbert space. To create a Hilbert space, we start with
and extend it to
.
Thus our space contains vectors with an infinite sequence of components. The length of vectors in this space can be defined analogously to the way it is defined in
, that is by sums of squares of the individual components with
.
Length squared:

Inner products and orthogonality are defined just be letting
in the
definitions of these quantities.

Now we are ready to extend Hilbert space to a function space. Since function space includes continuous functions on the real line, the number of values is uncountably infinite and cannot be listed. So instead of summing the square of components we use the integral of the square of the function over some interval as our definition of length of the vector which is here a continuous function.
Length definition for function space:

We can use the same idea of replacing infinite summation by integration to define inner products of two vectors, or here as we are in a function space, to two functions.

Sines and cosines, that is
and
, form an orthonormal basis for this space (after dividing by their length which is
).

and

Just as we can write any vector as a linear combination of the basis vectors for a space, we can write any function as a linear combination of the sines and cosines.
This decomposition of a function into a series of sines and cosines is called the Fourier Series of that function.

The coefficients
and
can be calculated in the same way we calculate them in finite dimensional vector spaces. We multiply both sides by a basis vector. All term but one on the right hand side then become zero (due to orthogonality of the basis vectors). Thus the coefficients can be calculated in terms of the norms and the inner products of the basis vectors with the given vector that is to be written as a linear combination.
As an example, to find
, we multiply both sides by the corresponding function
and integrate over the interval 0 to
.

As has already been mentioned, all integrals on the right hand side except the one in which sin multiplies itself are zero. Thus
is:

To see the analogy with projections,
, the component of vector
, along the line spanned by
is

It is helpful to see equation 9 as analogous to equation 10 for function spaces.
Here we are projecting the vector
onto
vector (they are ofcourse not truly vectors, but it is easier to see the analogy if they are thought of as vectors).