# Is arctangent of average equivalent to average of arctangent

I am working a coordinate transformation algorithm and for performance reasons would like to determine if the average of the arctangent of a series is equivalent to the arctangent of the averages.

For that reason I would like to know if there is an identity that would show the following to be a good approximation?

$$\frac{1}{n}\sum_{i=0}^n \arctan\left(\frac{y_i}{x_i}\right) = \arctan\left( \frac{\sum_{i=0}^n y_i}{\sum_{i=0}^n x_i}\right)$$

I suspect that it should not be an equivalence based on the identity: $$\arctan(a)+\arctan(b)=\arctan\left(\frac{a+b}{1−ab}\right)$$

I rewrite your identity under the slightly different form:

$$\frac{1}{n}\sum_{i=0}^n \arctan\left(\frac{y_i}{x_i}\right) = \arctan\left( \frac{\frac{1}{n}\sum_{i=0}^n y_i}{\frac{1}{n}\sum_{i=0}^n x_i}\right)$$

meaning that, naming $G$ the center of gravity (barycenter with equal mass for all points) of points $(x_i,y_i)$, its "phase" (= "polar angle", which could as well be called the "argument" when one thinks to the associated complex number) HAS TO BE the mean of the phases of points $(x_i,y_i)$.

Thus there are many possibilities. An evident possibility, already a rather general one, (a sufficient condition) being that the set of points is symmetrical with respect to the internal bissector '$y=x$ of the first quadrant, as illustrated on the figure below.

It's not equivalent. In the real domain $f$(average) = average of $f$ values only if $f$ is a linear function.

• Thank you, I accept that the rhs of my first equation is not correct. What I also wanted to know is if there is a form for the rhs of that equation which would provide an equivalence, and thus allow me to evaluate how good an approximation is my current relationship. – user19330 Apr 2 '16 at 13:32
• @Oscar Lanzi I don't agree. What the OP asks is not connected to a classical Jansen type inequality – Jean Marie Apr 2 '16 at 15:02
• Maybe I have not addressed directly your preoccupations, but I think now that the discrepancy between the left and right side of the formula can be a measure of the assymetry of the points you take with respect to the mean direction. – Jean Marie Apr 3 '16 at 16:10