In (ℝ^3)

First, define our three basis vectors.

v1={1,0,2};
v2={2,5,-1};
v3={-2,1,1};

Now define the vector to be written in terms of the basis vectors.

w={4,3,7}

We can plot the components of this vector versus the component index (1,2, or 3).

ListPlot[w,
PlotStyle->PointSize[0.02],
Filling->Axis,
FillingStyle->Automatic,
PlotRange->{-10,10},
Ticks->{Range[0,4],Range[-10,10,2]}]

Now we create a Manipulate object that let's us play with the coefficients in a linear combination of the basis vectors.  The goal is to find the coefficient values so that the linear combination matches the given vector w.

Manipulate[
ListPlot[{w,a1*v1+a2*v2+a3*v3},
	PlotStyle->PointSize[0.02],
	Filling->Axis,
	FillingStyle->Automatic,
	PlotRange->{-10,10},
	Ticks->{Range[0,4],Range[-10,10,2]},
	ImageSize->Medium],
{{a1,0},-5,5},
{{a2,0},-4,4},
{{a3,0},-4,4}]

An alternate way of looking at the same thing is to picture each vector as an arrow in space.  Here's a picture show the four vectors:
w (black), v1 (red), v2 (green), and v3(blue).

Graphics3D[{
Thick,Black,Line[{{0,0,0},w}],
Red,Line[{{0,0,0},v1}],
Green,Line[{{0,0,0},v2}],
Blue,Line[{{0,0,0},v3}]},
PlotRange->{{-8,8},{-8,8},{-8,8}},
Boxed->False,
BoxRatios->{1,1,1}]

Now we build a manipulate object with the linear combination coefficients as manipulation variables.  We add a fourth vector (orange) to show the linear combination.  The goal is to find coefficient values so the orange vector equals the black vector.

Manipulate[
Graphics3D[{
Thick,Black,Line[{{0,0,0},w}],
Red,Line[{{0,0,0},v1}],
Green,Line[{{0,0,0},v2}],
Blue,Line[{{0,0,0},v3}],
Orange,Line[{{0,0,0},a1*v1+a2*v2+a3*v3}]},
PlotRange->{{-8,8},{-8,8},{-8,8}},
Boxed->False,
BoxRatios->{1,1,1}],
{{a1,0},-5,5},
{{a2,0},-5,5},
{{a3,0},-5,5}]

In (L^2)[-π,π]

We start with a function to be expressed in terms of a set of sine functions.

f[x_]=Piecewise[{{Pi^2/8(-2-2/Pi x),-Pi<x<-Pi/2},{Pi^2/8(2/Pi x),-Pi/2<x<Pi/2},{Pi^2/8(2-2/Pi x), Pi/2<x<Pi}}]

To make things prettier, we can adjust the ticks and tick labels.

Plot[f[x],{x,-Pi,Pi},
Ticks->{Range[-Pi,Pi,Pi/2],Range[-Pi^2/8,Pi^2/8,Pi^2/8]}]

Now build a manipulate object showing f together with a linear combination of three sine functions.  The coefficients are the manipulation variables.

Manipulate[Plot[{f[x],a1*Sin[ x]+a2*Sin[2x]+a3*Sin[3x],a2*Sin[2x],a3*Sin[3x]},{x,-Pi,Pi},
PlotRange->{-1.5,1.5},
ImageSize->Medium],
{{a1,0},-2,2},
{{a2,0},-2,2},
{{a3,0},-2,2}]

For this example, the correct coefficients turn out to have a nice pattern.  (We'll soon learn how to compute these coefficients.)  Here's a plot with the first six non-zero terms in an expansion of f.

Plot[{f[x], Sin[x]-(1/9)*Sin[3x]+(1/25)*Sin[5x]-(1/49)Sin[7x]+(1/81)Sin[9x]-(1/121)Sin[11x]},{x,-Pi,Pi},ImageSize->Medium]

We can use the Sum command to build the linear combination.

Sum[(-1)^(k/2-1/2)Sin[k x]/k^2,{k,1,7,2}]

With this, we can build a manipulate object showing f together with a linear combination of sines with the manipulation variable controlling the number of terms in the linear combination.

Manipulate[Plot[{f[x],Sum[(-1)^(k/2-1/2)Sin[k x]/k^2,{k,1,n,2}]},{x,-Pi,Pi}],{n,1,101,1}]