Find the equation of the curve which passes through the origin and is such that $\frac{dy}{dx}=2x+y$ at all points $(x,y)$ on the curve, giving the equation in the form $y=f(x)$.

I checked with WolframAlpha, and the first step listed was to multiply both sides by $e^{\int-1dx}$ - which seems strange (I've never covered this way of dealing with integrands before). Is there a simpler and more intuitive approach?


5 Answers 5


The method of integrating factors is generally the standard way to approach linear first-order ODEs (that aren't separable or exact).

Consider what happens when we multiply both sides of the ODE by some function of $x$ (say $\mu(x)$) and do a bit of rearranging: $$ \mu(x) \cdot y' - \mu(x) \cdot y = \mu(x) \cdot 2x $$ If we squint at the LHS hard enough, it sort of looks familiar. Recall that Product Rule says that: $$ (fg)' = f \cdot g' + f' \cdot g $$ This matches the LHS, provided that:

  • $g = y$
  • $f = \mu(x)$
  • $f' = -\mu(x)$

Differentiating both sides of the second condition and combining with the third condition, we obtain a separable ODE: \begin{align*} \frac{d\mu}{dx} &= -\mu \\ \frac{-1}{\mu} \, d\mu &= dx \\ \int \frac{-1}{\mu} \, d\mu &= \int dx \\ -\ln|\mu| &= x + C \\ \ln|\mu| &= -x - C \\ |\mu| &= e^{-x - C} \\ \mu(x) &= (\pm e^{-C})e^{-x} \end{align*} Taking $C = 0$ (and dropping the $\pm$), we have $\mu(x) = e^{-x}$. Substituting, we can now apply Product Rule in reverse: \begin{align*} e^{-x}\cdot y' - e^{-x} \cdot y &= e^{-x} \cdot 2x \\ (e^{-x}y)' &= e^{-x} \cdot 2x \\ e^{-x}y &= \int 2xe^{-x} \, dx\\ e^{-x}y &= -2xe^{-x} - 2e^{-x} + D \\ y(x) &= De^x - 2x - 2 \end{align*} Since the curve passes through the origin, we may plug in the point to get: $$ 0 = De^0 - 0 - 2 \iff D = 2 $$ so we conclude that: $$ y(x) = 2e^x - 2x - 2 $$

  • $\begingroup$ This is a fantastic answer - I get it now. Thanks! $\endgroup$
    – hohner
    Nov 19, 2014 at 18:48
  • $\begingroup$ Also - why take $C$ as $0$? Is that an assumption? $\endgroup$
    – hohner
    Nov 19, 2014 at 18:49
  • $\begingroup$ Any value of $C$ would also work. Choosing $C = 0$ makes the integrating factor $\mu(x)$ as simple as possible though. $\endgroup$
    – Adriano
    Nov 19, 2014 at 18:50

NOTE: This answer gives notes on why and how you do the calculations stated in other answers, as simple as I can explain it.

This is a differential equation (DE)! You are asked to find the curve $y=y(x)$, so note that $y$ is a function, and you have differente derivatives of $y$ in the equation: $$\frac{d}{dx}y(x)=2x+y(x)\Rightarrow\frac{d}{dx}y(x)-y(x)=2x\qquad(1)$$

The DE has the function $y$ as the unknown. Therefore, the thing is to know what methods can you use to solve it.

In this case, you have first degree linear ordinary DE. That is because the highest derivative is the first derivative (degree 1) and it's linear. In this case, you can use the method of the integrating factor $\mu$.

In the general case of the DE $$\frac{d}{dx}y+P(x)\cdot y=Q(x)$$ This integrating factor is calculated as: $$\mu = e^{\int P(x)\,dx}=\exp\bigg\{\int P(x)\,dx\bigg\}$$

So, for your equation $(1)$, you have: $$\mu = \exp\bigg\{\int P(x)\,dx\bigg\}=\exp\bigg\{\int -1\,dx\bigg\}=\exp\{-x\}=e^{-x}$$

Then, you can solve easily multiplying $(1)$ by $\mu$, as said in the other answer.

HINT: Step 2 of the other answer is because: $$\begin{array}{rcl} \frac{d}{dx}(y\cdot\mu)&=&\frac{d}{dx}(y)\cdot\mu+y\cdot\frac{d}{dx}(\mu)\\ &=& y'\mu + \mu\cdot P\cdot y \end{array}$$

Note that, because of the Chain Rule, $$\frac{d}{dx}(\mu)=\frac{d}{dx}\bigg(e^{\int P\,dx}\bigg)=e^{\int P\,dx}\cdot\frac{d}{dx}\bigg(\int P\,dx\bigg)=e^{\int P\,dx}\cdot P=\mu\cdot P$$


Rewrite as y' - y = 2x.

Homogeneous solution y = ex, from y' - y = 0.

Assume solution y = u*v. y' = u'v + uv'.

u'v + uv' - u*v = 2x

u*v' = 2x

v' = 2x * e-x

Integrate by parts.

v = -2x*e-x - 2*e-x

y = uv = -2x - 2

But, include the homogeneous solution ex with a constant K

y = K * ex - 2x - 2


Step 1: Find the multiplier $\mu = e^{\int -1 dx} = e^{-x}$

Step 2: Rewrite equation as: $\left(e^{-x}y\right)' = 2xe^{-x}$

Step 3: Integrate both sides: $e^{-x}y = \displaystyle \int 2xe^{-x} dx = -2xe^{-x} - 2e^{-x} + C$.

Step 4: Solve for $y$: $y = Ce^x - 2x - 2$, $C$ is a real constant. The initial condition that $y(0) = 0 \Rightarrow 0 = C - 2 \Rightarrow C = 2$. Thus: $y = 2e^x - 2x - 2$.

Step 5: Check the answer.

  • $\begingroup$ Why pick $e^{\int1dx}$ as the multiplier? Does $ye^{\int1dx}=0$? $\endgroup$
    – hohner
    Nov 19, 2014 at 18:41
  • $\begingroup$ Okay, but where does $y$ go in step 2? $\endgroup$
    – hohner
    Nov 19, 2014 at 18:43

This is called a first order linear differential equation.
Consider $\frac{dy}{dx}+P(x)y=Q(x)$ this is the first order linear differential equation.

To solve such a equation consider the following process,
1)Multiply both side by a assumed function, say g(x)


2) Select g(x) in such a way that LHS become the derivative of y.g(x)

i.e., $g(x)\frac{dy}{dx}+P(x).g(x).y=\frac{d[y.g(x)]}{dx}$

3) Simplifying the expression, we get.


4)Integrating and simplifying we get, $g(x)=e^{\int P(x).dx}$

5) This factor is called the integrating factor.

6)Putting $g(x)$ in original equation we would get the equation as,

$e^{\int P(x).dx}\frac{dy}{dx}+P(x).e^{\int P(x).dx}.y=Q(x).e^{\int P(x).dx}$

7)Which can be written as, $\frac{d[y.e^{P(x).dx}]}{dx}=Q(x)e^{\int P(x).dx}$

8) Integrating both sides and simplifying the solution is,

$y=e^{-\int P(x).dx}.[\int(Q(x).e^{\int P(x).dx})dx+c]$

The function of the integrating factor, or multiplier is to put the LHS of the equation in an explicit derivative of either x or y , so that "dx" or "dy" can be easily taken to the RHS which is Q(x).g(x) or Q(y).g(y) that is also single a valued function in x or y. So that it can be easily integrated with respect to "dx" or "dy".


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .