# Why is $\frac{\sum_{i=1}x_iy_i}{\sum_{i=1}x_i^2}\ne \frac{\sum_{i=1}y_i}{\sum_{i=1}x_i}$?

I know they are not equal, but I am unable to come up with a convincing explanation as to why they are not equal. Cancelling the $x_i$'s when they are part of the summand is prohibited; Can anyone provide a decent argument as to why this is the case?

Thanks.

• Are you asking for a counterexample? – T.J. Gaffney Dec 8 '15 at 21:49
• @Gaffney Sure, that would be great thanks or an explanation would be nice – BLAZE Dec 8 '15 at 21:51
• To cancel, you have to have a common factor. You don't: instead you can do something like $\frac{\sum_{i=1}^n x_i y_i}{\sum_{i=1}^n x_i^2} = \frac{\sum_{i=1}^n \frac{x_i}{x_1} y_i}{\sum_{i=1}^n \frac{x_i^2}{x_1}}$ (replacing the $1$ with whatever you want). In fact it can happen that the left side is defined and the right side is not, for instance with $n=2,x_1=1,x_2=-1,y_1=1,y_2=1$. – Ian Dec 8 '15 at 21:51
• You need the same common factor; $x_i$ is not one number (in general). – Ian Dec 8 '15 at 21:54
• Is this a joke? Does it seem that $\dfrac {ab + cd} {a^2 + c^2} = \dfrac {b + d} {a + c}$? – Alex M. Dec 8 '15 at 22:04

Let the $y_i$'s be all $1$, and let's write the summation explicitly, like so: $${x_1 + x_2 + \cdots +x_n \over x_1^2 + x_2^2 + \dots +x_n^2} \neq {1 + 1 + \dots +1 \over x_1 + x_2 + \dots +x_n} = \frac{n}{x_1 + x_2 + \dots +x_n}$$ Does it seem convincing here that the $x_i$'s can't cancel? It's just not a valid logical step.

For a specific counterexample, take $x_i = 1,2,3,4$. Then we have $${1+2+3+4 \over 1 + 4 + 9 + 16} = \frac{10}{30} = \frac13 \neq \frac25 = \frac4{10} = \frac4{1 + 2 + 3 + 4}$$ Therefore we cannot cancel the $x_i$'s.

• In other words, asking for a convincing explanation why it's not true is like asking for a convincing explanation why $\frac ab+\frac cd=\frac{a+b}{c+d}$ is not true. It just ain't. – Greg Martin Dec 8 '15 at 22:06
• @GregMartin Exactly. – silvascientist Dec 8 '15 at 22:08
• @silvascientist Thanks for the explanation and counter-example. – BLAZE Dec 8 '15 at 22:32

Consider the simpler case when $n = 2$ (the upper bound for the summation index). Assume that $\dfrac {ab + cd} {a^2 + c^2} = \dfrac {b + d} {a + c}$. After cross-multiplication and canceling of similar terms, you may grup the remaining ones as $(a-c) (ad - bc) = 0$. This shows that, in order for that equality to be true, either $a = c$ (i.e. $x_1 = \dots = x_n$, which means that you may simplify a common factor), or your numbers have to verify a very special relationship ($ad - bc = 0$), so the equality cannot hold in general, for arbitrary values.

• I think the answer could be improved by adding a concrete example. – Kitegi Dec 8 '15 at 22:08
• @Farnight: I could do it, but I am certain that finding some $a,b,c,d$ that make the above equality false is a very good exercise for the OP, and I am also certain that he has the abilities to solve it for himself. – Alex M. Dec 8 '15 at 22:12
• @AlexM No offence taken, thanks for your answer (+1) – BLAZE Dec 8 '15 at 22:16
• @BLAZE: Maybe the expanded version of my answer better addresses your question. – Alex M. Dec 8 '15 at 22:23
• @GregMartin: I refuse to bow to political correctness, I hate that politically-motivated pervertion of "sexist, non-inclusive" English and, fortunately, I live in a country that still doesn't force me to do the above. – Alex M. Dec 8 '15 at 23:20

Maybe this answer of mine is not rigorous enough but I will give it a try because it gives some kind of alternative view on questions of this sort so I will add it maybe just to have a variety of views on the same question.

Suppose that we view $\sum_{i=1}^{n}x_iy_i$ as a function of $2n$ variables $x_1,...,x_n,y_1,...,y_n$. Then, in the same spirit, the sum $\sum_{i=1}^{n}x_i$ could be viewed as the function of $n$ variables $x_1,...x_n$. The sum $\sum_{i=1}^{n} {x_i}^2$ as a function of also the $n$ variables $x_1,...,x_n$ and sum $\sum_{i=1}^{n} y_i$ as a function of $n$ variables $y_1,...y_n$.

Let us write now $a(x_1,...x_n,y_1,...y_n)=\sum_{i=1}^{n}x_iy_i$ and $b(x_1,...x_n)=\sum_{i=1}^{n}x_i$ and $c(x_1,...x_n)=\sum_{i=1}^{n} {x_i}^2$ and $d(y_1,...y_n)=\sum_{i=1}^{n} y_i$.

Now, if we suppose that your equality is true then we would have

$a(x_1,...x_n,y_1,...y_n)=d(y_1,...y_n) \dfrac {c(x_1,...x_n)}{b(x_1,...x_n)}$

So we would have that the function of $2n$ variables is equal to the product of two functions, one that depends on the first $n$ variables and the second that depends on the remaining $n$ variables, and, intuitively, this will, I guess, happen rarely, and in this case it is only always true when $n=1$.