Remember, two functions are orthogonal if their dot product is 0, and the dot product of two functions is the integral of their product.
Consider two functions f = sin(mx) and g = sin(nx). Here m and n are distinct positive integers. What is the integral of f×g, as x runs from 0 to 2π?
Use the angle addition formula to write the following trig identity.
sin(mx)×sin(nx) = ½ ( cos(mx-nx) - cos(mx+nx) )
Integrate the right side from 0 to 2π and get 0. Here are two more identities to demonstrate the orthogonality of cos(mx)×cos(nx) and sin(mx)×cos(nx).
cos(mx)×cos(nx) = ½ ( cos(mx-nx) + cos(mx+nx) )
sin(mx)×cos(nx) = ½ ( sin(mx+nx) + sin(mx-nx) )
Moving to two dimensions, let f = sin(x)×sin(y), and let g = sin(x)×sin(2y). To find f.g, take the double integral of f×g, as x and y are contained within a square from 0 to 2π. A double integral is a nested integral, so integrate with respect to y first. The integrand is now some function of x times sin(y)×sin(2y), and as shown above, this drops to 0. The same thing would happen if we compared sin(x)×sin(y) with sin(2x)×sin(y). Just integrate with respect to x first.
The various two dimensional functions, sin(mx)×sin(ny), cos(mx)×sin(ny), cos(mx)×cos(ny), sin(mx)×cos(ny), are all pairwise orthogonal.
We can extend this to three dimensions, with functions like sin(3x)×cos(7y)×sin(9z). In fact it extends to n dimensions. Any two trig functions, constructed in this manner, will be orthogonal, as long as they aren't the same function.
We shouldn't forget the first basis function, the constant 1. Verify that 1 is orthogonal to all the trig functions described above, in any number of dimensions.
If most of your wave form floats above or below the x axis, you'll need to use this term in the fourier series. Subtract a suitable constant, a multiple of 1, from your wave form, so that it is centered about the x axis. Then you can write it as a sum of sines and cosines, which are also centered about the x axis.