# How to solve $x_j y_j = \sum_{i=1}^N x_i$

I have N equations and am having trouble with finding a solution.

$$\left\{\begin{matrix} x_1 y_1 = \sum_{i=1}^N x_i\\ x_2 y_2 = \sum_{i=1}^N x_i\\ \vdots\\ x_N y_N = \sum_{i=1}^N x_i \end{matrix}\right.$$

where $x_i$, ($i = 1, 2, \cdots, N$) is an unknown and $y_i$, ($i = 1, 2, \cdots, N$) is a known variable.

Given $y_i$'s, I have to find $x_i$'s but, I don't know where to start and even if it has a solution.

-
Well, you see tha $x_i=0$ is a solution – leonbloy Jun 4 '12 at 3:21

You can rewrite the system in the following form:

\left\{\begin{align*} &(1-y_1)x_1+x_2+x_3+\ldots+x_N=0\\ &x_1+(1-y_2)x_2+x+3+\ldots+x_N=0\\ &x_1+x_2+(1-y_3)x_3+\ldots+x_N=0\\ &\qquad\qquad\qquad\qquad\vdots\\ &x_1+x+2+x+3+\ldots+(1-y_N)x_N=0\;, \end{align*}\right.

or in matrix form as

$$\pmatrix{1-y_1&1&1&\dots&1&1\\1&1-y_2&1&\dots&1&1\\1&1&1-y_3&\dots&1&1\\\vdots&\vdots&\vdots&\ddots&\vdots&\vdots\\1&1&1&\dots&1-y_{N-1}&1\\1&1&1&\dots&1&1-y_N}\pmatrix{x_1\\x_2\\x_3\\\vdots\\x_{N-1}\\x_N}=\pmatrix{0\\0\\0\\\vdots\\0\\0}\;.$$

Solving this homogeneous linear system is in principal completely straightforward.

-
1. $x_i= 0$ $\forall i$ is always a solution.

2 Suppose that $y_i \ne 0$ $\forall i$. Then, $x_1 = \frac{1}{y_1} \sum x_i$ and summing over all indexes we get $\sum x_i = \sum \frac{1}{y_i} \sum x_i$ So we must either have $\sum x_i = 0$ or $\sum \frac{1}{y_i} = 1$

2.a The case $\sum x_i = 0$ gives only the trivial solution $x_i=0$

2.b Elsewhere, if we are given $\sum \frac{1}{y_i} = 1$, then any $x_i = \frac{\alpha}{y_i}$ is a solution, for any $\alpha$

3 If some $y_j=0$ for some $j$, then we must have $\sum x_i =0$ and $x_i=0$ for all $i$ with $y_i\ne 0$. This provides extra solutions if there are more than one zero-valued $y_j$. Eg, say $y_1=y_2=y_3=0$ and $y_j \ne 0$ for $j>3$; then any ${\bf x}$ with $x_j=0$ for $j>3$ and $x_1+x_2+x_3=0$ is a solution.

-
Clever solution! – process91 Jun 4 '12 at 3:41

We have that for each $j$

$$x_j(1-y_j) + \sum_{i=1}^{j-1} x_i + \sum_{i=j+1}^{N} x_i = 0$$

Given that the $y_i$'s are known, we can just use Gaussian elimination to solve this.

-