Solving y' = (x - y)/(x + y) by Substitution

Brain Teaser · Medium · Free problem

Find the general solution of $$\frac{dy}{dx} = \frac{x - y}{x + y}, \qquad x + y \neq 0.$$ Express the answer as an implicit relation between $x$ and $y$.

Hints

  1. The equation is not separable as written, but both numerator and denominator involve $x + y$ and $x - y$. Try substituting $z = x + y$ (or, alternatively, $y = vx$ since the right side is homogeneous of degree $0$).
  2. With $z = x + y$: $z' = 1 + y' = 1 + \dfrac{x - (z - x)}{z} = \dfrac{2x}{z}$. Now the equation is separable in $z$ and $x$.
  3. $z\,dz = 2x\,dx$ integrates to $z^2/2 = x^2 + C$. Substitute back $z = x + y$ and simplify.

Worked Solution

How to Think About It: The right-hand side depends on $x$ and $y$ only through $x + y$ and $x - y$, which suggests using $x + y$ as a new variable. After the substitution the equation separates. A second route notices that the equation is exact.

Quick Estimate: Check a candidate answer along one curve. On the line $y = 0$ the slope should be $x/x = 1$. Differentiating the implicit solution $y^2 + 2xy - x^2 = c$ gives $2yy' + 2y + 2xy' - 2x = 0$, i.e. $y' = (x - y)/(x + y)$, which at $y = 0$ equals $1$. $\checkmark$

Formal Solution:

*Step 1 -- Substitute $z = x + y$.* Then $y = z - x$ and $\dfrac{dz}{dx} = 1 + \dfrac{dy}{dx}$. The equation becomes $$\frac{dz}{dx} = 1 + \frac{x - (z - x)}{z} = \frac{z + 2x - z}{z} = \frac{2x}{z}.$$

*Step 2 -- Separate and integrate.* $$z\,dz = 2x\,dx \quad \Longrightarrow \quad \frac{z^{2}}{2} = x^{2} + C_1 \quad \Longrightarrow \quad z^{2} = 2x^{2} + C_2.$$

*Step 3 -- Substitute back.* With $z = x + y$: $$(x + y)^{2} = 2x^{2} + C_2 \;\Longrightarrow\; x^{2} + 2xy + y^{2} - 2x^{2} = C_2 \;\Longrightarrow\; y^{2} + 2xy - x^{2} = c.$$

*Step 4 -- Alternative: exactness.* Write the equation as $(x - y)\,dx - (x + y)\,dy = 0$. With $M = x - y$ and $N = -(x + y)$, $\partial M/\partial y = -1 = \partial N/\partial x$, so the form is exact. A potential $F$ with $F_x = M$, $F_y = N$ is $F = \tfrac12 x^{2} - xy - \tfrac12 y^{2}$, and the solutions are the level sets $F = \text{const}$, i.e. $x^2 - 2xy - y^2 = \text{const}$, the same family.

*Step 5 -- Verify.* Implicit differentiation of $y^2 + 2xy - x^2 = c$: $2yy' + 2y + 2xy' - 2x = 0 \Rightarrow y'(x + y) = x - y$. $\checkmark$ (Explicitly, $y = -x \pm \sqrt{2x^2 + c}$; the family is a set of hyperbolas.)

Answer: $y^{2} + 2xy - x^{2} = c$ (equivalently $(x+y)^2 = 2x^2 + C$), a family of hyperbolas.

Intuition

Many first-order equations become separable after a change of variable that groups the way $x$ and $y$ appear together; here $x + y$ is the natural coordinate. Equivalently, the equation is exact, $(x - y)\,dx - (x + y)\,dy = 0$ with a conserved quantity $x^2 - 2xy - y^2$. Spotting conserved quantities is exactly the skill used for invariants in random walks, martingales in gambling problems, and hyperbolic level curves in relative-value trades.

Open the full interactive solver →