Components of vector as an inner product I am making my way through the book Mathematical methods for physics and engineering and am stuck trying to understand orthonormal bases. So far, I have been introduced to the idea of an N-dimensional vector space $V$, that any vector $N+1$ must be linearlly dependant and can be written as a linear combination of the basis vectors $\hat{e_i}$.
Assuming these are orthonormal so that $\left\langle \hat{e_j} | \hat{e_i}\right\rangle = \delta_{ij}$, for the vector $\vec{a}$, we can say that for any $\vec{a}$ that,
$$ \left\langle \hat{e_j}|\vec{a}\right\rangle = \sum_{i=1}^{N} \left\langle \hat{e_j}|a_{i}\hat{e_i}\right\rangle = \sum_{i=1}^{N} a_i \left\langle\hat{e_j}|\hat{e_i}\right\rangle = a_j,$$
This ends by saying that the components of $\vec{a}$ are given by $a_{i} =\left\langle\hat{e_i}|\vec{a}\right\rangle$. Intuitivley, I think this makes sense if I think of the vector $\vec{a}$ being a basis vector scaled by some scalar $a_i$. Is this just saying that the inner product of any basis vector and some vector in that N-dimensional space gives the component of that vector in the direction the basis vector lies - providing it is an orthonormal basis vector? I do not understand the above expression mathematically. Any insight would be great.
 A: Yes, your intuition is right. Suppose $\{e_1,\ldots,e_N\}$ is an orthonormal basis, and suppose that you have a vector $a$ which you can write as $a_1 e_1 + \cdots + a_N e_N$. Consider then the inner product $\langle e_i \mid a \rangle$:
$$ \begin{split}
\langle e_i \mid a \rangle &= \langle e_i \mid a_1  e_1 + \cdots + a_N e_N \rangle \\
&= \langle e_i \mid a_1 e_1 \rangle + \cdots + \langle e_i \mid a_N e_N \rangle \\ 
&= \langle e_i \mid a_i e_i \rangle = a_i
\end{split} $$
where we're using both linearity of the inner product and orthonormality.
A: $(V, <\cdot ,\cdot >) $ be an $n-dimensional$  inner product space.
A basis $\{e_1,e_2,...,e_n\}$ is orthonormal basis if
$$<e_i ,e_j >=\begin{cases} 1 &\text{ if } i=j \\0 &\text{ if } i\neq j .\end{cases}$$
Suppose, $v\in V$, then $v$ can be written as a unique linear combination of basis vectors.
$$v=c_1 e_1 +c_2 e_2 +... +c_n e_n$$
Now take the inner product of $v $
with $e_1$.
\begin{align}<v, e_1>&=<c_1 e_1 +c_2 e_2 +... +c_n e_n,e_1>  \\
&=<c_1 e_1,e_1>+<c_2 e_2 ,e_1>+... +<c_n e_n,e_1> \\
&=c_1<e_1, e_1>+c_2<e_2, e_1>+... +c_n<e_n, e_1> \\
&= c_1+0+0+...+0\\
&=c_1
\end{align}
Similarly, by taking inner product of $v$ with $e_2$ we get , $c_2=<v, e_2>$
\begin{align} <v, e_j>&=<\sum_{i=1}^{n} c_i e_i, e_j>\\
&= <c_j e_j, e_j>+ <\sum_{i\neq j }< c_i e_i, e_j>\\
&=c_j
\end{align}
Hence, $$v=<v, e_1>e_1 +<v, e_2>e_2+... +<v, e_n>e_n$$
