The equation is $x^2-4x=y^2-4y$ in the case where $x\ne y$. The answer is $x+y=4$.

I can start from $x+y=4$ and create the equation very easily, and I can substitute $x+4=y$ into the equation and show both sides are equal easily. I just don't get how I would find the answer if I didn't know it before hand, and all I had was the equation? Any advice?

  • $\begingroup$ I just realized, assuming that x and y aren't equal, then x must equal +/- (y-4) and y must equal +/- (x-4), otherwise there's no way x(x-4)=y (y-4). $\endgroup$ Nov 27, 2017 at 2:11
  • $\begingroup$ Be weary of the line of reasoning; it’s fallacious. Just because $ab = cd$ and $a \neq b$, doesn’t mean $a = c$. That trick only works when we have something like $ab = 0$, whence we can conclude $a$ or $b$ is zero. See the most recent answer to this question for the right application of this idea. It’s subtle. $\endgroup$ Nov 28, 2017 at 1:49

5 Answers 5


\begin{align} x^2 - 4x &= y^2 - 4y \\ x^2 - y^2 &= 4x - 4y \\ (x-y)(x+y) &= 4(x-y) \\ x+y &= 4\end{align} where dividing by $x-y$ is allowed since $x \neq y$.

  • 2
    $\begingroup$ It seems so obvious now, thanks for showing the way! I wasn't seeing it at all. $\endgroup$ Nov 26, 2017 at 21:17

As an alternative, the solution that struck me first was completing the square in both $x$ and $y$. This is common when dealing with quadratics, especially once there are no $xy$ cross-terms. $$ x^2 - 4x = y^2 - 4y $$ $$ x^2 - 4x + 4 = y^2 - 4y + 4 $$ $$ (x-2)^2 = (y-2)^2 $$ This means that either $x-2 = y-2$ or $x-2 = -(y-2)$, which means either $x = y$ or $x+y = 4$, as desired.

  • $\begingroup$ I actually saw that I could complete the square when I was working on it. I missed that it would progress towards the solution though. Thanks for the alternative approach! $\endgroup$ Nov 27, 2017 at 1:38
  • $\begingroup$ You're welcome. Look into quadratic forms and conic sections for more general problems of this type. $\endgroup$ Nov 27, 2017 at 1:44
  • $\begingroup$ This is the way I first went, so +1 ;) $\endgroup$ Nov 27, 2017 at 4:37

Let $c$ be the common value of $x^2-4x$ and $y^2-4y$. Then $x$ and $y$ are both roots of the polynomial $t^2-4t-c$. Since we are assuming $x$ and $y$ are distinct, they are all of the roots, so $t^2-4t-c$ factors as $(t-x)(t-y)$. Since $(t-x)(t-y)$ expands to $t^2-(x+y)t+xy$, comparing the coefficients of $t$ gives $x+y=4$.

(Conversely, if $x+y=4$, then since $x$ and $y$ are both roots of $(t-x)(t-y)=t^2-(x+y)t+xy=t^2-4t+xy$, $x^2-4x$ and $y^2-4y$ are both equal to $-xy$.)

  • $\begingroup$ Very interesting approach, but where did the -4t come from in your polynomial? $\endgroup$ Nov 27, 2017 at 2:04
  • $\begingroup$ I'm not sure what you mean. Since $x^2-4x=c$, $x^2-4x-c=0$, and similarly for $y$. So $x$ and $y$ are roots of $t^2-4t-c$. $\endgroup$ Nov 27, 2017 at 2:32
  • $\begingroup$ Okay so it comes from the original equation, I see now $\endgroup$ Nov 27, 2017 at 2:43
  • $\begingroup$ And you're using the t for clarities sake I think? $\endgroup$ Nov 27, 2017 at 2:45

Write $x+y=d$. Then we have $y=d-x$ and so: $$(d-x)^2-4(d-x) = x^2-4x$$ so $$d^2-2dx-4d =-8x$$thus $$d(d-2x)-4(d-2x)=0$$ so $$(d-2x)(d-4)=0$$ If $d=2x$ we get $x=y$ which is impossible. So $d=4$ and we have $x+y=4$.


I take the opportunity of this question to consider a more general issue.

Here is a methodology that can be applied to any equation of the form :

$$f(x_1)=f(x_2) \tag{1}$$

where $f$ is a function from $I$ (subset of $\mathbb{R}$) to $J:=f(I)$.

(I intentionally take variables $(x_1,x_2)$ instead of $(x,y)$)

Of course, $(x,x), \ x \in I$ is a natural (trivial) set of solutions.

Once the study of variations of $f$ has been done, operate a segmentation of the range $J$ of $f$ into the following components : $$J=J_1 \cup J_2 \cup J_3 \cup \cdots$$

where $J_k$ is defined as the subset of $J$ of all $y$ that $f(x)=y$ has $k$ distinct solutions. As a consequence, each $J_k$ will generate $k(k-1)$ non-trivial solutions to equation (1) ; for example, when $k=3$, we will have solutions :

$$(x_1,x_2), (x_1,x_3), (x_2,x_3) \ \text{and, symmetrically} \ (x_2,x_1), (x_3,x_1), (x_3,x_2)$$

Remark : the "trivial" cases correspond to $J_1$.

Let us consider the following example :

$$y=f(x)=x(x-1)(x-2)(x-3) \ \ \text{on} \ \ I=[0, +\infty) \ \text{and} \ J=[-1,+\infty).$$

with the following curve, possessing in particular a local maximum in $(-\tfrac12,a:=\tfrac{9}{16})$

enter image description here

We will have

  • $J_1=(a,+\infty)$ generating "trivial solutions" to (1),

  • $J_2=\{0,a\}$ (set with two elements), generating sets of two non-trivial solutions,

  • $J_3=(0,a)$ (a whole line segment !), generating sets of $3 \times 2$ solutions,

  • $J_4=(-1,0)$ generating sets of $6 \times 2$ solutions.

Now, let us return to the case of function $y=f(x)=x^2-4x$ (see Fig. 2) :

enter image description here

we will clearly have :

  • $J_1={y=-4}$ corresponding to point $x=2$ giving trivial solution $(x_1,x_1)=(2,2)$

  • $J_2=(-4,+\infty)$, yielding 2 solutions $(x_1,x_2)$ and $(x_2,x_1)$ obtained by solving, for each $y \in (-4,+\infty)$ the quadratic equation :


(take care, once again : this $y$ has nothing to do with the $y$ of the initial question $f(x)=f(y)$ !)

giving the two solutions :

$$x_{1,2}=2 \pm \sqrt{4+y^2}\tag{2}$$

A first remark is that

$$x_1+x_2=4 \ \ \ \text{which is the solution "as presented"}. \tag{3}$$

A second and final remark is that (3) describes exactly all solutions because $x_1$ (and the same for $x_2$) can take any value : for every value of $x_1$, one can find a value of $y$ such that (2) is fulfilled.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .