Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Imagine a black box which accepts a digital input signal which is a pure sine wave and outputs the area between this input signal and some constant data set over a sample window.


Given the input and output signals, is it possible to determine the sample data set?

Edit: Here is how the box calculates area between two data points...

    private double areaBetween(double a, double b)
        if (Math.Sign(a) == Math.Sign(b))
            if (Math.Abs(a) > Math.Abs(b))
                return a - b;
                return b - a;
            return a + b;
share|cite|improve this question
It appears you are outputting the signed area. In the figure, it looks like the areas above and below the green curve are equal and the output is zero. Is that correct? Also, am I given the length of the sample window? – Ross Millikan Mar 7 '13 at 21:32
If it is possible to determine without knowing the window length, this would be preferable. – Madison Brown Mar 7 '13 at 21:38
Area which lies above the x-axis is considered positive, and negative if it lies below. – Madison Brown Mar 8 '13 at 1:33

Since integrals are additive, your output is really just the integral of the green input signal over the sample window, minus the integral of the blue sample signal over the same sample window.

The blue integral is constant, and is the only way the sample signal influences your output. So all you can learn about the blue signal from observing the black-box relation between the green and red signals is what the average value of the blue signal is -- that is, in this case, $0$.

(On the other hand, this is also all you need to reconstruct the behavior of the black box for a different input signal, if that is what you're ultimately interested in).

share|cite|improve this answer
Well done. I was trying to make this into Fourier analysis but was just seeing we need the output to be the product of the two curves for that. – Ross Millikan Mar 7 '13 at 21:47
The integral of both the green and blue signal is zero over the window at any given time (in the case of the diagram), however the output is not 0, it is a sawtooth wave. Don't the intersections between the two functions complicate your explanation? – Madison Brown Mar 7 '13 at 21:57
@MadisonBrown: Your example output doesn't look very sawtoothy. But neither does it look like what you ought to be getting as far as I understand your description -- so I may be misunderstanding something. Is it perhaps a result of integrating over only some of the sample window at the beginning, rather than extending the green signal with zeroes to the left of its starting point? – Henning Makholm Mar 7 '13 at 22:02 here is a screenshot of the application i created to test this. The input signal is a sinewive. the sample function is a square wave. the window is 16 samples long. the output is seen in the blue window. – Madison Brown Mar 7 '13 at 22:08
My understanding is that the area between two curves is equal to the difference between their integrals only if the two curves do not intersect over the range you are calculating. Is this wrong? – Madison Brown Mar 7 '13 at 22:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.