# Need help with the proof {needed for my algorithm}

I am not from pure math background. I am working on an algorithm which works good for all the practical reasons based on the following assumption.

that, if ab = cd and a+b = c+d then, either a = c & b = d or a = d & b = c. where, $$a,b,c,d$$ $$\in$$ $$\mathbb{Z}$$

I am not sure if this is true in the all conditions, but if it's can anyone provide proof, why ?

Addition -1 : Is this also true for pair of N numbers ?

Addition -2 (Answer for the above) - I think I got it, @saulspatz's proof can be generalized (already sufficient), we can say,

After proof since, $$a = c$$ & $$b = d$$ then, by saying $$b = b1 + b2$$ and $$c = c1 + c2$$ proof can be further generalized for the addition and multiplication of pair of $$N$$ such numbers.

$$a1, a2,...aN \in \mathbb{Z}$$

$$b1, b2,....bN \in \mathbb{Z}$$

• What do you mean by "Is this also true for pair of N numbers ?"? What constraints do you have in mind? Commented Jan 14, 2019 at 19:14
• in this case its just 2 numbers a + b = c+ d ... in case where its a1 + a2 + ... +an = b1 + b2 +b3 ...bn how can the proof be extended ? Commented Jan 15, 2019 at 1:15
• I updated my answer to give an example with more values. Also can you explain what your algorithm aims to achieve? @rahulb Commented Jan 15, 2019 at 10:06

Let $$a+b=n=c+d$$. Then $$ab=cd\implies a(n-a)=c(n-c)$$ so that $$an-a^2=cn-c^2,$$ or$$(a-c)n=a^2-c^2=(a-c)(a+c)$$

Either $$a-c,$$ and we are done, or $$a-c\ne 0$$ so we can cancel the $$a-c$$ to get $$n=a+c$$

Together with $$n=aa+b$$ this gives $$b=c.$$

In short, your assumption is correct.

• thanks @saulspatz .. in case where its a1 + a2 + ... +aN = b1 + b2 +b3+ ...+bN and a1* a2 * a3*... aN = b1 * b2 *b3 ...*bN how can the proof be extended ? Commented Jan 15, 2019 at 1:16

Only an idea: if $$a+b=c+d$$ we get by squaring $$a^2+b^2=c^2+d^2$$ since $$ab=cd$$ so we get $$a^2-c^2=d^2-b^2$$ or $$a^2-d^2=b^2-c^2$$

This is true.

In general, $$r$$ and $$s$$ are the two roots of the quadratic equation $$x^2 -(r+s)x + rs = (x-r)(x-s).$$ so knowing the sum and the product determines the values (up to swapping them).

Let $$\exists \delta_1, \delta_2 \in \mathbb{Z}$$ such that $$c = a + \delta_1, d = b + \delta_2$$ and $$(\delta_1,\delta_2) \neq (0,0)$$. However from $$a+b=c+d$$ it follows that $$\delta_1 = -\delta_2$$. Now $$ab = cd = (a+\delta_1)(b-\delta_1)$$, then $$\delta_1^2 + (a-b)\delta_1 = \delta_1(\delta_1+a-b) = 0$$. Since we assumed $$\delta_1 \neq 0$$ it follows that $$\delta_1 = b-a$$, however then we get $$c = b, d=a$$. Thus it necessarily holds that for the given constraints either $$(a,b) = (c,d)$$ which corresponds to $$\delta_1 = 0$$, or $$(a,b)=(d,c)$$ which corresponds to $$\delta_1 = b-a$$. Note that this is true for $$a,b,c,d \in \mathbb{R}$$.

Edit: Since the original question was extended through an edit, I'll address that also. If you have more variables you need more equations, for example: $$a,b,c,d,e,f \in \mathbb{R}$$ $$a+b+c = d+e+f$$ $$ab + bc + ac = de + ef + df$$ $$abc=def$$