# Implicit differentiation of y with respect to x, what went wrong?

I have this implicit differentiation problem, taken from James Stewart's Calculus Early Transcendentals, 7th Ed. Page 215, Exercise 15.

Find $\frac{dy}{dx}$ by implicit differentiation. Note that $y$ is a function of $x$.

Given: $$e^\frac{x}{y}=x-y$$

My solution:

Take derivative of left-hand side $$\frac{dy}{dx}e^\frac{x}{y}=(e^\frac{x}{y})\left(\frac{y(1)-(1)y'x}{y^2}\right)=(e^\frac{x}{y})\left(\frac{y-y'x}{y^2}\right)$$

Take derivative of right-hand side

$$\frac{dy}{dx}(x)-\frac{dy}{dx}(y)=1-1(y')=1-y'$$

The expression is now

$$(e^\frac{x}{y})\left(\frac{y-y'x}{y^2}\right)=1-y'$$

Multiply both sides by $y^2$

$$e^\frac{x}{y}y-y'x=y^2-y'y^2$$

Rearrange variables

$$ye^\frac{x}{y}-y^2=y'x-y'y^2$$

Factor $y'$

$$ye^\frac{x}{y}-y^2=y'(x-y^2)$$

Factor $(x-y^2)$ out of right-hand side, divide on the left-hand side

$$\frac{ye^\frac{x}{y}-y^2}{(x-y^2)}=y'$$

The correct answer from the textbook is:

$$\frac{y^2-ye^\frac{x}{y}}{y^2-xe^\frac{x}{y}}=y'$$

Where did I go wrong? Thanks for your help.

You have a mistake in the step "Multiply both sides by $y^2$". Note that
$$y^2\cdot e^{x/y}\frac{y-xy'}{y^2}=e^{x/y}y-e^{x/y}xy'$$ while you have written
$$e^\frac{x}{y}y-y'x.$$