How does $\sum_{n=0}^{\infty} (a_n \cos{nx}+b_n \sin{nx})=\sum_{n=-\infty}^{\infty} c_n e^{inx}$? Just started learning Fourier series and am having a rough time trying to wrap my head around the textbook. Below are two excerpts from the book each followed up a question. Many thanks in advance!
"The theory of Fourier series deals with the representation of an "arbitrary" $2\pi$ periodic function $u$ as an (infinite) sum of multiples of these functions.
$$u(x)= \sum_{n=0}^\infty (a_n \cos{nx}+b_n \sin{nx}) \tag 1$$
can be rewritten using Euler's formulae as
$$u(x)= \sum_{n=-\infty}^\infty c_n e^{inx} \tag 2."$$
Question 1
How do I get from equation (1) to equation (2)? My attempt gives me-
$$(a_n \cos{nx}+b_n \sin{nx})=e^{inx}\bigg( \frac{a_n}{2}+\frac{b_n}{2i}\bigg)+e^{-inx}\bigg( \frac{a_n}{2}-\frac{b_n}{2i}\bigg) \text{???}$$
Also why do the limits of summation change from $\sum_{n=0}^\infty$ to $\sum_{n=-\infty}^{\infty}$?
Further the textbook goes on to explain-
"Now suppose that (2) is uniformly convergent. Then the sum $u(x)$ is continuous. Multiply both sides by $e^{-imx}$ and integrate from $0$ to $2\pi$. Since the convergence is uniform the right hand side can be integrated term-wise. This yields
$$\int\limits_{0}^{2\pi}u(x)e^{-imx}dx=\sum_{n=-\infty}^{\infty} c_n \int\limits_{0}^{2\pi} e^{i(n-m)x}dx=2\pi c_m$$
Where all the integrals in the sum are zero except the one with $m=n$ which equals $2\pi$."
Question 2
What is the reason for multiplying by $e^{-imx}$? Also I do not understand the final statement about all the integrals summing to zero? If we sum between two finite numbers e.g. between $-3$ and $3$ then we get-
$$c_{-3}(-2\pi)+c_{-2}(2\pi)+c_{-1}(-2\pi)+c_{0}(2\pi)+c_{1}(-2\pi)+c_{2}(2\pi)+c_{3}(-2\pi)$$
How can we possibly say that this sums to zero if we do not know the values of the $c_{n}$'s?
 A: Note that we can write
$$\begin{align}
\sum_{n=0}^\infty(a_n\cos(nx)+b_n\sin(nx))&=\sum_{n=0}^\infty \left(a_n\frac{e^{inx}+e^{-inx}}{2}+b_n\frac{e^{inx}-e^{-inx}}{i2}\right)\\\\
&=\sum_{n=0}^\infty \left(\frac{a_n-ib_n}{2}\,e^{inx}\right)+\sum_{n=0}^\infty \left(\frac{a_n+ib_n}{2}\,e^{-inx}\right)\\\\
&=\sum_{n=0}^\infty \left(\frac{a_n-ib_n}{2}\,e^{inx}\right)+\sum_{n=-\infty}^0 \left(\frac{a_{-n}+ib_{-n}}{2}\,e^{inx}\right)\\\\
&=\sum_{n=-\infty}^\infty c_n e^{inx}
\end{align}$$
where we have
$$c_n=\begin{cases}\frac{a_n-ib_n}{2}&,n>0\\\\
a_0&,n=0\\\\\frac{a_{-n}+ib_{-n}}{2}&,n<0\end{cases}$$
A: You got 
$$(a_n \cos{nx}+b_n \sin{nx})=e^{inx}\bigg( \frac{a_n}{2}+\frac{b_n}{2i}\bigg)+e^{-inx}\bigg( \frac{a_n}{2}-\frac{b_n}{2i}\bigg)=e^{inx}c_n+e^{-inx}d_n$$
so
$$\sum_{n=0}^{\infty} (a_n \cos{nx}+b_n \sin{nx})=\sum_{n=0}^{\infty} e^{inx}c_n+\sum_{n=0}^{\infty}e^{-inx}d_n=\sum_{n=0}^{\infty} e^{inx}c_n+\sum_{-n=0}^{\infty}e^{inx}d_{-n}$$
since $c_n=\overline{d_n}$ then
this will be
$$=\sum_{n=0}^{\infty} e^{inx}c_n+\sum_{-n=0}^{\infty}e^{inx}\overline{c_n}=\sum_{n=-\infty}^{\infty} e^{inx}c_n$$
Note that for $n\neq m$ with $k=n-m\neq0$
$$\int\limits_{0}^{2\pi} e^{i(n-m)x}dx=\int\limits_{0}^{2\pi} e^{ikx}dx=\dfrac{e^{ikx}}{ik}\Big|_{0}^{2\pi}=\dfrac{e^{ik2\pi}-1}{ik}=0$$
and for $n=m$
$$\int\limits_{0}^{2\pi} e^{i(0)x}dx=\int\limits_{0}^{2\pi} dx=x\Big|_{0}^{2\pi}=2\pi$$
A: Question 1
The summation goes from $-\infty$ to $+\infty$ to take into account the $\mathrm e^{-inx}$ terms.
Question 2
This is related to the periodicity of $\mathrm e^{ikx}$:
$$\int_0^{2\pi}\mathrm e^{ikx}\mathrm dx =\begin{cases}0&\text{if }\; k\ne 0,\\2\pi&\text{if }\; k= 0.\end{cases}$$
A: \begin{align}
a\cos(nx) + b\sin(nx) & = a \frac {e^{inx} + e^{-inx}} 2 + b \frac{e^{inx} - e^{-inx}}{2i} \\[12pt]
& = \frac {a-bi} 2 e^{inx} + \frac{a+bi} 2 e^{-inx} \\[12pt]
& = c_n e^{inx} + c_{-n} e^{-inx}.
\end{align}
(Here we used the fact that $\dfrac b i = -bi$ and $\dfrac {-b} i = bi.$)
