There is one step in a proof that I don't understand. Could someone please explain?

u = any vector in vector space S
W = finite dimensional subspace of S with orthonormal basis of vectors {v1, v2, ..., vn}

The theorem to prove is: u can be expressed exactly one way as
u = w1 + w2

w1 = orthogonal projection of u onto W
w2 = component of u orthogonal to W
w = arbitray vector in subspace W

w1 = <u,v1>*v1 + <u,v2>*v2 + ... + <u,vn>*vn
w2 = u - w1
w = k1*v1 + k2*v2 + ... + kn*vn

<w2,w> = <u - w1,w> = <u,w> - <w1,w>
<u,w> = <u,k1*v1 + k2*v2 + ... + kn*vn> = k1*<u,v1> + k2*<u,v2> + ... + kn*<u,vn>
(!!! Don't understand where this equation came from --->) <w1,w> = <u,v1>*k1 + <u,v2>*k2 + ... + <u,vn>*kn
<u,w> = <w1,w> so <w2, w> = 0

Where, did that one line come from? the textbook makes a reference to this theorem but includes no other explanation:

If S is an orthornormal basis for an n-dimensional inner product space and
us = (u1,u2,...,un)
vs = (v1,v2,...,vn)
then
<u,v> = u1v1 + u2v2 + ... + unvn

Can anyone follow this?

You use the fact that the inner product is bi-linear. So, you can always linearly expand. E.g.:

<c_1u_1 + c_2u_2, d_1v_1+d_2v_2> =

c_1d_1<u_1,v_1> +
c_1d_2<u_1,v_2> +
c_2d_1<u_2,v_1> +
c_2d_2<u_2,v_2> +

If you take u_i = v_i to be the i-th unit vector, then:

<u_1,v_1> = 1

<u_2,v_2> = 1

<u_1,v_2> = 0

<u_2,v_1> = 0

The vector

c_1u_1 + c_2u_2

can be denoted as

(c_1,c_2)

and

d_1v_1+d_2v_2 as

(d_1,d_2)

The inner product is

c_1d_1 + c_2d_2

because the "cross terms" vanish as they are proportional to inner products of orthogonal vectors.

In your problem:

w1 = <u,v1>*v1 + <u,v2>*v2 + ... + <u,vn>*vn

w = k1*v1 + k2*v2 + ... + kn*vn

and if you take the inner product between w1 and w then you get a sum of the inner products of all the combinations where you pick the i-th term from w1 and the j-th term from w, summed over i and j. But these are zero unless i = j, because <v_i,v_j> = 0 if i and j are not equal. If i and j are the same then it is 1. So, you end up with the sum of

<u,v_j>k_j from j = 1 to n.

bingo, got it! In hindsight, that's pretty simple. But, I just couldn't figure that out yesterday.

thank you so much count iblis!

You're welcome! Sometimes, understanding certain steps in a proof can be challenging, but breaking it down and using the properties of the inner product can help clarify things. Don't worry about struggling with it initially; learning is a process, and asking questions is an important part of that process. If you have any more questions or need further explanations, don't hesitate to ask!