It is assumed to work for a large number of samples because the variable terms cancel:

Sum( [VAC1 + VDC1] * [VAC2 + VDC2] ) =

Sum( VAC1 * VAC2 + VAC2 * VDC1 + VAC1 * VDC2 + VDC1 * VDC2] ) =

Sum( VAC1 * VAC2 + VDC1 * VDC2] )

Because: VAC2 * VDC1 + VAC1 * VDC2 tends to cancel out and is worth zero.

Let's look at the mixing product of two sine wave signals (same frequency and phase) with DC offsets:

(DC1+A1*sin(x)) * (DC2+A2*sin(x)) =

0.5*A1*A2 + DC1*DC2 +

(A2*DC1+A1*DC2)*sin(x) - 0.5*A1*A2*cos(2*x)We get a DC component (blue), a sine wave with carrier frequency and amplitude A2*DC1+A1*DC2, and a cosine wave with 2x carrier frequency and amplitude 0.5*A1*A2.

The DC value we want to measure is 0.5*A1*A2, but it is biased by DC1*DC2, i.e. we measure 0.5*A1*A2 + DC1*DC2 instead of the true value. The purple terms are AC components, and they must be filtered out by the lowpass filter after the mixer. This leads to the following objectives:

1) We want to get rid of the bias DC1*DC2

2) The lowpass filter must be able to remove the AC components (or at least attenuate them sufficiently).

Here I'd like to distinguish two cases:

2a) If the lowpass filter has zeros at the carrier frequency and 2x carrier frequncy, then it can eliminate them

completely2b) If 2a is not granted, then the removal of the AC components relies on the filter's stop band attenuation (which is limited)

Why do I distinguish 2a and 2b? Because it makes big difference whether you allow arbitrary carrier frequencies or not. Arbitrary carrier frequencies imply case 2b, which means that you require a computationally expensive filter with high selectivity and high stop band attenuation. OTOH, for case 2a, even a trivial 1st order boxcar filter can eliminate the carrier and all its harmonics

completely if it is granted that the length of the boxcar is an

**exact** integer multiple of the carrier period.

[ Let's reconsider your AVR milliohmmeter. Why did it work pretty well although it was much simpler? Because you had a frequency plan. The carrier frequency was exactly 1/16 of the sample rate and the integration period was an exact integer multiple of the carrier period. Furthermore, the reference signal was numerically generated and had a DC offset of exactly zero. Under these conditions, the bias DC1*DC2 becomes zero as well, and the boxcar is able to eliminate the carrier and its harmonics completely. So it did not matter if there was an uncompensated DC offset in the signal being measured. ]

Back to case 2b: Here we also must take care that the amplitude A2*DC1+A1*DC2 of the sin(x) term of the mixing product does not become too large, because the stopband attenuation of the lowpass filter after the mixer is limited. After attenuation by the filter, the residual amplitude of the sin(x) term should be well below the level of the signal we want to measure (which is 0.5*A1*A2). There are two ways to accomplish that: Either the residual DC offsets must be suffiently low, or the filter must be designed with an even higher stop band attenuation, making it even more computationally expensive.

It would be better to have a real-time estimate of the average of the two signals, but that means averaging with low-pass filtering the two signals separately in real time.

Yes, it means exactly that. You could do it in principle, but it is computationally expensive (possibly too expensive).