# How to solve this tricky equation?

The following equation $${\left( {\frac {x}{2017}}-a \right) \left( {\frac {x}{a}}-2017 \right) ^{-1}}={ \left( {\frac {x}{a}}-2017 \right) \left( {\frac { x}{2017}}-a \right) ^{-1}}$$ in $x$ was asked in a school math olympiad (8th grade). It is clear there is no solution if $a \neq 2017$ or $a \neq -2017$. If $a=2017$ or $a=-2017$ respectively, then each complex number but $2017^2$ or $-2017^2$ respectively is its solution.

Here is my try to solve it with Mathematica:

Solve[((1/2017)*x - a)/(x/a - 2017) == (x/a - 2017)/((1/2017)*x - a),x]


{}

and

Reduce[((1/2017)*x - a)/(x/a - 2017) == (x/a - 2017)/((1/2017)*x - a), x]


a == -2017 || a == 2017

The question arises: how to obtain the correct answer in Mathematica?

Addition. Another casuistic equation is as follows.

Reduce[Abs[1/2017*x - a]/(x/a - 2017) ==  Abs[x/a - 2017]/((1/2017)*x - a), x, Reals]


(a == -2017 && x == -4068289) || a == 2017

The above answer is not correct.

• I'm not sure what you want. Solve[] correctly identifies no solution, and Reduce[] (as it does) ignores the removable discontinuity. – Feyre Jan 23 '17 at 10:05
• @Feyre: You wrote " Solve[] correctly identifies no solution". But there is a lot of solutions if $a=2017$ or $a=-2017$. A conditional expression is expected as an answer, not $\{\}$. – user64494 Jan 23 '17 at 10:11
• Solve[((((x/2017) - a)/(x/a - 2017) - (x/a - 2017)/((x/2017) - a)) /. {x -> 2017^2}) == 0] returns {{a -> -2017}, {a -> 2017}} so Solve[] also skips the discontinuity. I thinks Solve[] just fails in the first instance, though it's weird no warning is returned. – Feyre Jan 23 '17 at 10:33
• @Feyre: Your Solve[((((x/2017) - a)/(x/a - 2017) - (x/a - 2017)/((x/2017) - a)) /. {x -> 2017^2}) == 0] solves a different problem than a problem under consideration. Therefore, your conclusion is not based. – user64494 Jan 23 '17 at 10:43
• Eliminate[((1/2017)*x - a)/(x/a - 2017) == (x/a - 2017)/((1/2017)*x - a), x] gives a^2==4068289 – Rolf Mertig Jan 23 '17 at 11:22

From the docs for Solve: "Solve gives generic solutions only." And the returned empty solution is generically correct.

From the docs for Reduce: "The result of Reduce[expr,vars] always describes exactly the same mathematical set as expr."

This is not strictly true. For instance, 1/(x/y) evaluates automatically to the generically equivalent y/x, independently of Reduce or Solve. But even inside Reduce, a similar transformation must take place in the following, since division by y is indicated in the formula which should exclude y == 0:

Reduce[1/(1 - x/y) == 0, x]
(*  y == 0 && x != 0  *)


Well, somehow FunctionDomain manages to be a bit more careful (although I don't think anything that lets 1/(x/y) evaluate can save that case).

eqn = ((1/2017)*x - a)/(x/a - 2017) == (x/a - 2017)/((1/2017)*x - a);

Reduce[eqn && FunctionDomain[eqn /. Equal -> Subtract, x], {x}]
(*  (a == -2017 && 4068289 + x != 0) || (a == 2017 && -4068289 + x != 0)  *)

• You saw the heart of the problem. – user64494 Jan 23 '17 at 11:38
FullSimplify[((1/2017)*x - a)/(x/a - 2017) == (x/a - 2017)/((1/2017)*x - a)]


yields

a == 4068289/a


Solving that yields {{a->2017},{a-> -2017}}.

Simply doing ((1/2017)*x - a)/(x/a - 2017) == (x/a - 2017)/((1/2017)*x - a) /. {{a->2017},{a-> -2017}} // FullSimplify yields {True,True}, indicating the equation is true independent of x.

• Sorry, this is not it at all. – user64494 Jan 24 '17 at 8:46