# redundancy of sin and cos waves with real data

I have the following question. Isn't it true that when applying a fourier transform to a real function (i.e. computing a characteristic function for a density), we only ever need one of the two waves: sin or cosin, to capture it's behavior.

I did a numerical exercise of moving back and forth between a probability density and a characteristic function, and every time it seems like either of the two waves is enough. Here are the waves: Here are the original real data histogram (yellow), estimated smooth density (red) and the same density reconstructed separately from the sin (green) and cosine (blue) waves of it's own characteristic function.

Maybe for the complex input, the two waves are really necessary, but there is clearly some redundancy when the input is real.

Has anyone seen this before?

Both sin and cos waves are needed. Sure, you can find a signal (somewhere between a sine and a cosine, which seems as if it can be evaluated using either a sine or a cosine but in the general case you need both waves. And FT needs both waves anyway because internally it works with complex numbers regardless of the input you pass to it (real input is usually interpreted as real0, img0, real1, img1...)

Suppose you have a pure sine wave and want to estimate its spectral content. Which wave would you use, a sine or a cosine?

It should be evident that only sine waves can accurately estimate the frequency and amplitude of your tested sine signal (provided that they're in phase and the frequency resolution is narrow enough to reduce spectral leakage effetcs). If you now inspect the DFT/FFT results, you'll see that only a single, imaginary coefficient (corresponding to the sine wave being tested) contributes to the overall amplitude/magnitude. Likewise, cosine waves are necessary to accurately estimate the cosine components of your signal. Since most real signals are neither sin or cos waves, you need to use both to estimate them properly.

In addition to that, the DC component can only be represented by using a cosine wave (since sin(DC) = 0)

I personally don't think that you need to fully understand the math behind FT to realize that both waves are necessary.

When the input signal is real and even , then its Fourier transform will be real and even too. Hence its FT will be zero phase real-even function indicating that sine waves are not needed to compute its Fourier transform.

Similarly, when the input signal is real and odd , then its Fourier transform will be purely imaginary and odd too. Hence indicating that cosine waves are not needed to compute its Fourier transform.

Anything in between requires both cosine and sine waves to be present to compute the phases of the sinusoidals.

Note that for any real input, its FT will be conjugate-symmetric which means that only one half of the FT is sufficient to reconstruct the signal back. But do not misunderstand this as only cosine or sine waves being sufficient to compute the FT; No, they both are still required to compute the conjugate-symmetric FT.

Generally it's not true that you only need sines or cosines to represent a real-valued function using its Fourier transform, as is explained in dsp_user's answer.

The obvious case is that if the (real-valued) function (in your case: the PDF) is even (or odd) we can reconstruct it using only cosines (or sines).

And now comes the more interesting and important part: if the PDF is zero for negative values of its argument (as seems to be the case in your example), then you can also reconstruct it using only sines or only cosines. This corresponds to the case of a causal function and the Hilbert transform relationship between the real and imaginary parts of its Fourier transform. If $$F(\omega)=R(\omega)+jX(\omega)$$ is the Fourier transform of a real-valued and causal function $$f(t)$$ then the following equations hold:

$$f(t)=\frac{2}{\pi}\int_{0}^{\infty}R(\omega)\cos(\omega t)d\omega,\quad t>0$$

$$f(t)=-\frac{2}{\pi}\int_{0}^{\infty}X(\omega)\sin(\omega t)d\omega,\quad t>0$$

So you can reconstruct $$f(t)$$ using either just cosines or just sines. For $$t=0$$ you need to evaluate

$$f(0)=\frac{1}{\pi}\int_{0}^{\infty}R(\omega)d\omega$$

A key in the understanding resides in the following considerations:

• if one wants to precisely recover all real functions, no, both sine and cosine are required
• if one want to only extract features or statistics from a subset of real signals, yes, you might be able to get them (imperfectly though in general).

In other words, there are signals for which you can extract about the same information from either the real part or the imaginary part. And causal signals, as explained by @Matt L., are ones which you can even perfectly reconstruct.

Aside the Fourier transforms, you can look at alternative representation. For instance the Hartley transform, defined as:

$$\sqrt{2\pi}F(\omega) = \int_{-\infty}^{\infty}f(t)(\cos(\omega t)+\sin(\omega t))dt$$ or $$\sqrt{\pi}F(\omega) = \int_{-\infty}^{\infty}f(t)(\cos(\omega t-\pi/4)dt$$ or $$\sqrt{\pi}F(\omega) = \int_{-\infty}^{\infty}f(t)(\sin(\omega t+\pi/4)dt$$

This transformation is involutive, as it is is own inverse. And it turns real signals into real coefficients. It used to be fashionable, see for instance Hartley Transform vs Fourier Transform or Fast Hartley Transform Implementation in MATLAB. So, somewhat, only sines and cosines could be used, but not on the classical Fourier transform, and only because sine and cosine are sides of the same complex exponential coin, and

$$\cos t+ \sin t = \sqrt{2}\sin(t+\pi/4)$$

You can also look at the sine and cosine transforms, respectively $$\int_{-\infty}^{\infty}f(t)\sin(2\pi\nu t)dt$$ and $$\int_{-\infty}^{\infty}f(t)\cos(2\pi\nu t)dt$$. There is an inversion formula involving the two of them, but it can be rephrased as, using cosine addition formulae:

$$\pi/2(f(x^+)+f(x^-)) = \int_0^{\infty}\int_{-\infty}^{\infty}f(t)\cos(\omega(t-x))dt \,d\omega$$

where $$f(x^+)$$ denotes the limit of $$f$$ at $$x$$ from above(right limit), and $$f(x^-)$$ denotes the limit of $$f$$ at $$x$$ from below(left limit).