First-order Differential Equation on Exam Explanation

I'm taking an elementary differential equations class and we got our first exam back and I don't understand why I was wrong on one of the questions. I got a 96, and the professor said there were quite a few d's and f's, so I didn't want to quibble about this.

Anyway, the problem was $$\dfrac{dy}{dx} = \dfrac{1}{x+y+2}$$ and I chose the sub $$u = x+y+2$$, with $$\dfrac{dy}{dx}=\dfrac{dy}{du}\dfrac{du}{dx}=\dfrac{dy}{du}\left(1+\dfrac{1}{u}\right)$$ and then plugged in the expression for $$\dfrac{dy}{dx}$$, separated the equation and solved for $$y$$ in terms of $$u$$ and then substituted back to get $$y = \ln (x+y+3)+ c.$$ The professor took issue with my expression for $$\dfrac{dy}{dx}$$, saying that I couldn't differentiate $$y$$ w.r.t. $$u$$ if $$y$$ is part of $$u.$$ Is this correct?

Your solution seems fine, although it is an implicit solution. I think an easier way to solve the DE $$\frac{dy}{dx}=\frac{1}{x+y+2}$$ is to arrange as $$\frac{dx}{dy}=x+y+2.$$ This is a first-order linear equation for $$x(y).$$ I get $$x(y)=C e^y-y-3.$$ It's possible to solve for $$y$$ using the Lambert $$W$$ function, but it's rather messy and doesn't provide as much insight.

• It actually does provide some insight if you know a bit about the properties of Lambert W, but in elementary courses the solution is generally left in implicit form. – Robert Israel Jun 21 '19 at 23:13

Note that
$$u=x+y+2$$

$$\frac {du}{dx}= 1+ \frac{dy}{dx}$$

$$\frac {du}{dx}=1+\frac {1}{u}$$

$$\frac {udu}{u+1} =dx$$ $$u-\ln (u+1)=x+c$$

$$x+y+2 = x+ \ln (x+y+3)+c$$ $$y=\ln(x+y+3)+c$$

• How do you get that $\ln(u)$? $\int \frac{1}{u}\; du = \ln(u)$, but here you're integrating with respect to $x$. – Robert Israel Jun 21 '19 at 20:26
• I have edited my answer. – Mohammad Riazi-Kermani Jun 21 '19 at 20:43

Your solution is correct. There should be no problem in regarding $$u$$ as the independent variable (unless it turns out to be constant).