Define a Periodic DT Signal and Compute the Fourier Series Coefficients
I am going to choose a sine signal, since there have been many cosines done already.
DT signal: $ x[n] = 2\sin(\pi n + \frac{\pi}{2}) + 4\sin(\frac{\pi}{2} n + \pi)\, $
Now, each sine has its own period, and the fundamental period of the function is the greater of the separate periods.
$ N_2sin = \frac{2\pi}{\pi} k = \frac{2}{1} k $
$ N_4sin = \frac{2\pi}{\frac{\pi}{2}} k = \frac{2}{\frac{1}{2}} k $
Take $ k = 1\, $,
$ N_2sin = 2\, $
$ N_4sin = 4\, $, so the overall fundamental period is
$ N = 4\, $
In order to find the coefficients, we must first calculate the values of $ x[n]\, $ for four consecutive integer values of $ n\, $. By plugging values of $ n\, $ into the given signal, we find that
$ x[0] = 2\, $
$ x[1] = -6\, $
$ x[2] = 2\, $
$ x[3] = 2\, $
$ x[4] = 2\, $
$ x[5] = -6\, $
$ x[6] = 2\, $
$ x[7] = 2\, $, which continue to repeat in this way every 4 integers.
$ a_k = \frac{1}{4}\sum^{3}_{n = 0} x[n] e^{-jk\frac{\pi}{2} n}\, $
$ a_0 = \frac{1}{4}\sum^{3}_{n = 0} x[n] e^0\, $
$ = \frac{1}{4}\sum^{3}_{n = 0} x[n]\, $
$ = \frac{1}{4}(2 - 6 + 2 + 2)\, $
$ a_0 = 0\, $
$ a_1 = \frac{1}{4}\sum^{3}_{n = 0} x[n] e^{-j\frac{\pi}{2} n}\, $
$ = \frac{1}{4}(x[0] + x[1]e^{-j\frac{\pi}{2}} + x[2]e^{-j\pi} + x[3]e^{-j\frac{3\pi}{2}})\, $
$ = \frac{1}{4}(2 - 6(-j) + 2(-1) + 2(j))\, $
$ = \frac{1}{4}(8j)\, $
$ a_1 = 2j\, $
$ a_2 = \frac{1}{4}\sum^{3}_{n = 0} x[n] e^{-j\pi n}\, $
$ = \frac{1}{4}(x[0] + x[1]e^{-j\pi} + x[2]e^{-j2\pi} + x[3]e^{-j3\pi})\, $
$ = \frac{1}{4}(2 - 6(-1) + 2(1) + 2(-1))\, $
$ = \frac{1}{4}(8)\, $
$ a_2 = 2\, $
$ a_3 = \frac{1}{4}\sum^{3}_{n = 0} x[n] e^{-j\frac{3\pi}{2} n}\, $
$ = \frac{1}{4}(x[0] + x[1]e^{-j\frac{3\pi}{2}} + x[2]e^{-j3\pi} + x[3]e^{-j\frac{9\pi}{2}})\, $
$ = \frac{1}{4}(2 - 6(j) + 2(-1) + 2(-j))\, $
$ a_3 = \frac{1}{4}(-8j)\, $
$ a_3 = -2j\, $
So, the function is
$ x[n] = \sum^{3}_{k = 0} a_k e^{jk\frac{\pi}{2} n}\, $, with coefficients which repeat every four integers,
$ a_0 = 0 , k = ..., -8, -4, 0, 4, 8, ... \, $
$ a_1 = 2j , k = ..., -7, -3, 1, 5, 9, ... \, $
$ a_2 = 2 , k = ..., -6, -2, 2, 6, 10, ... \, $
$ a_3 = -2j , k = ..., -5, -1, 3, 7, 11, ... \, $