Solve the differential equation \[ (x - y) \frac{dy}{dx} = x + 2y. \]
Step 1: Rearrange the given equation: \[ (x - y) \frac{dy}{dx} = x + 2y. \] Divide both sides by \( (x - y) \): \[ \frac{dy}{dx} = \frac{x + 2y}{x - y}. \] At this point, we cannot directly separate the variables. We proceed by using substitution to simplify the equation.
Step 2: Use the substitution \( u = x - y \). This implies: \[ du = dx - dy \quad \text{or equivalently} \quad \frac{du}{dx} = 1 - \frac{dy}{dx}. \] Now, rewrite the differential equation in terms of \( u \).
Step 3: Express \( y \) in terms of \( u \) and \( x \): \[ y = x - u. \] Substitute \( y = x - u \) into the equation \( \frac{dy}{dx} = \frac{x + 2y}{x - y} \): \[ \frac{dy}{dx} = \frac{x + 2(x - u)}{u} = \frac{x + 2x - 2u}{u} = \frac{3x - 2u}{u}. \]
Step 4: Now we have a simpler equation: \[ \frac{dy}{dx} = \frac{3x - 2u}{u}. \] Using the relation \( \frac{du}{dx} = 1 - \frac{dy}{dx} \), we substitute into the expression: \[ \frac{du}{dx} = 1 - \frac{3x - 2u}{u}. \] Simplify this to: \[ \frac{du}{dx} = 1 - \frac{3x}{u} + 2. \] Combine terms: \[ \frac{du}{dx} = 3 - \frac{3x}{u}. \]
Step 5: Multiply both sides by \( u \) to eliminate the fraction: \[ u \frac{du}{dx} = 3u - 3x. \] Now, we can proceed with solving this equation by separating the variables.
Step 6: Further steps would involve solving the equation using appropriate methods such as separation of variables or integrating factors. The explicit solution for \( y \) can be obtained once this equation is solved.