# 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. Commented Jan 23, 2017 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 $\{\}$. Commented Jan 23, 2017 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. Commented Jan 23, 2017 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. Commented Jan 23, 2017 at 10:43
• Eliminate[((1/2017)*x - a)/(x/a - 2017) == (x/a - 2017)/((1/2017)*x - a), x] gives a^2==4068289 Commented Jan 23, 2017 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. Commented Jan 23, 2017 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. Commented Jan 24, 2017 at 8:46