I need to solve differential equation which is defined as:

$$ y'=2+y,\quad y(0)=2 $$

Attempt to solve

Now we could write the equation in form of:

$$ \frac{dy(x)}{dx}=y(x)+2$$ Divide by $y(x)+2$ $$ \frac{\frac{dy(x)}{dx}}{y(x)+2}=1 $$ Now integral both sides $$ \int{\frac{\frac{dy(x)}{dx}}{y(x)+2}}dx = \int{1} dx $$ Now here is the part i don't understand. This should equal the following: $$ \int{\frac{1}{y+2}}dy=\int{1}dx $$ Solving left side with u-substitution shouldn't be problematic but the problem is i don't have good understanding what's going on here ? How do you get

$$ \int{\frac{\frac{dy(x)}{dx}}{y(x)+2}}dx=\int{\frac{1}{y+2}}dy $$

Another thing i don't understand is the notation used in the problem. there is $y(0)=2$ what i am suppose to do with this information ?

The solution set for this equation is:

enter image description here

But again i don't think i can fully understand this.

If someone could provide some explanation whats going on here that would be highly appreciated.

  • $\begingroup$ Sometimes, it is taken for granted that $y(x)$ can be written as $y$. Hence, $$\frac{dy(x)}{dx} = y(x)+2 \equiv \frac{dy}{dx} = y+2$$ which can be easily solved. $\endgroup$
    – user371838
    Dec 4 '17 at 12:17
  • $\begingroup$ Maybe of interest: math.stackexchange.com/questions/27425/… $\endgroup$ Dec 4 '17 at 13:25

As written the symbol $y$ is doing double duty: as the indeterminate function in the original differential equation, and as the variable of substitution. To untangle what's going on here, it might help to introduce a new symbol for the substitution variable. Your integral is $$\int \frac{\frac{d}{dx} y(x)}{y(x) + 2} dx .$$ Substituting $$u = y(x) , \qquad du = \frac{d}{dx} y(x) \, dx ,$$ (here, as usual, we have computed $du$ using the chain rule) gives that the integral is $$\int \frac{du}{u + 2} = \log\left\vert u + 2 \right\vert + C' = \log\left\vert y(x) + 2 \right\vert + C'.$$

Separately, note that we can change simplify slightly our original equation before separating variables, by writing $v(x) = y(x) + 2$. Then, $v'(x) = y'(x)$ and we can write the original equation as $$v'(x) = v(x) .$$


$$\int{\frac{\frac{dy(x)}{dx}}{y(x)+2}}dx=\int{\frac{1}{y(x)+2}\cdot \frac{dy(x)}{dx}}dx=\int\frac{1}{y(x)+2}dy(x)$$

$dx$ in the numerator simplifies with $dx$ in the denominator

which can be written, for brevity, $$\int{\frac{1}{y+2}}dy$$ but the meaning is the same.



Hope this helps

$$y+2=e^{x+C}$$ to determinate $C$ you substitute $x=0$ and get

$2+2=e^C\to C=\log 4$

so the solution which solves the differential equation is



You can solve this equation with an integration factor.

$$y'(x)=2+y(x)$$ $$e^{-x}y'(x)=e^{-x}(2+y(x)) $$ Now write one side as a derivative: $$\Rightarrow (y(x)e^{-x})'=2e^{-x}$$ Now we just integrate, I renamed the variable to $\alpha$ to clarify its just a dummy variable. $x_0$ is just a constant. $$\Rightarrow \int_{x_0}^x (y(\alpha)e^{-\alpha})'d\alpha=\int_{x_0}^x2e^{-\alpha}d\alpha$$ Integrate the expression: $$y(x)e^{-x}-y(x_0)e^{-x_0}=-2e^{-x}+2e^{-x_0}.$$ This solution is not unique, it still has a constant that can have different values. Luckily we have given an initial condition $y(0)=2$. So, when we use it we get a unique solution.

Just put $x_0=0$ and simplify the expression above: $$y(x)e^{-x}-2=-2e^{-x}+2 \Rightarrow y(x)=-2+4e^x.$$

  • $\begingroup$ While this is a decent solution, it does not address any of OP's questions. $\endgroup$
    – Dylan
    Dec 4 '17 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.