Can the difference between a number and a set of numbers be calculated as follows?

220 Views Asked by At

I have a number $X$ (lets say $45$)

and I have five other numbers, lets say $(3, 4, ,5, 6, 7)$

I want to know the difference between my number and the other numbers like this:

(X-3) + (X-4) + (X-5) + (X-6) + (X - 7)
=
(45-3) + (45-4) + (45-5) + (45-6) + (45 - 7)
=
42 + 41 + 40 + 39 + 38 
=
200

but what I found is:

if we get the average of these five points like this:

average = (3 + 4 + 5 + 6 + 7)/5 = 5

and then we calculate the difference between X and the average like this:

X-average = 45 - 5 = 40

and then multipli the result by the number of 5 (because we have 5 numbers) like this:

40 * 5 = 200

I got the same value.

so my questions is this a rule? or my numbers are setted by accident to have the same values by both ways?

if there is a prove mathmatically using whatever x and whatever points kindly tell me

2

There are 2 best solutions below

0
On BEST ANSWER

More generally, if $(x_1,x_2,\dots,x_n)$ and $(y_1,y_n,\dots,y_n)$ then the average of differences: $$(x_1-y_1,x_2-y_2,\dots,x_n-y_n)$$ is just the difference of the averages.

In your case, all of the $x$ values are the same value, and hence their average is also the same value.

This is because:

$$(x_1-y_1)+(x_2-y_2)+\cdots+(x_n-y_n) = (x_1+x_2+\cdots +x_n)-(y_1+y_2+\cdots+y_n)$$

then divide both sides by $n$.

The averaging operation actually has a stronger behavior - it is what mathematicians call a "linear funtional."

1
On

I believe your calculation boils down to $\sum{(x-a_i)} = nx - \sum a_i = n(x - Average)$ so your intuition is correct.

May be worth noting: when trying to quantify the "distance between" a target value and a number of comparison values, people generally use things like the sum of squared differences, or the sum of the absolute values of the differences. Among other things, this avoids getting 0 when the target isn't equal to the comparison values (with your method, for example, the distance between 10 and the points {5, 15} comes out to 0 which is unsatisfying).