In a Fourier Series, there are two terms in the nth harmonic - a cosine term and a sine term. Together they give you the components of the signal at that frequency, i.e. the nth harmonic. Writing them out we have:

![]()

And, it is possible to compute the a's and b's by approximating those integrals. However, that isn't necessarily the way it is done. In most cases a different representation is used. Consider the following.

In the integral above, the function, f(t), is multiplied by a complex exponential. However, the complex exponential can be represented as a complex sum of the cosine and the sine.
ejn2pt/T = cos(n2pt/T) + jsin(n2pt/T)
Using that representation gives the two integrals above. (And, note the presence of "j" multiplying the sine in the integral above, and in the expression for the complex exponential. That is what makes it complex.)
Now, the neat result from this is that you can do one integral and get
both the a's and b's simultaneously. In the fft functions in any
analysis program that is what happens most of the time.