# Approach to solving this differential equation

Today in calc, we were learning about slope fields and used $2y = 3x-y'$ an example. Just for fun, I tried to solve the equation, but I couldn't. I solved it as far as $dy = (3x - 2y)\ dx$, but I realized this is either unsolvable or I just haven't learned the method to solve this yet. I got this hunch that since y is written in terms of its own derivative, there could be an infinite number of possible solutions. I asked wolfram alpha to solve the equation and it returns:

$y(x) = c_1 e^{-2x} + \frac{3x}{2} - \frac{3}{4}$

However, I don't know what this notation means when it says $c_1$. Can anyone explain how you solve this equation and what the notation means?

• $c_1$ is just a constant. – Simply Beautiful Art Mar 20 '17 at 22:03
• You could look up the method of Integrating Factors, or Laplace Transforms. – Vivek Kaushik Mar 20 '17 at 22:05
• This is a standard linear differential equation. For a hint, $(y e^{cx})'=(y' +cy)e^{cx}$. Can you use this here? – Aritro Pathak Mar 20 '17 at 22:06
• @AritroPathak Thanks! I didn't know about this rule before. I get to $(ye^{2x})' = 3xe^{2x}$ but I don't know what to do next :/ – Ryan Mar 20 '17 at 22:14
• @Ryan Aren't you done now? – Aritro Pathak Mar 20 '17 at 22:57

Note that $c_1$ is just a constant. As a side note, differential equations of the form

$$a_ny^{(n)}+a_{n-1}y^{(n-1)}+\dots+a_1y'+a_0y=P_k(x)$$

where $P_k(x)$ is a polynomial of degree $n$, then

$$y=c_ne^{r_nx}+c_{n-1}e^{r_{n-1}x}+\dots+c_1e^{r_1x}+Q_k(x)$$

where $Q_k(x)$ is some polynomial of degree $n$ and $r_p$ are the roots to the auxiliary equation

$$a_nr^n+a_{n-1}r^{n-1}+\dots+a_0=0$$

If we have repeated roots, see here.

Notice that the coefficients $c_q$ are determined by your initial conditions. If $r_q=a_q+b_qi$, we may replace as follows by Euler's formula:

$$e^{r_qx}\to e^{a_qx}(\cos(b_qx)+i\sin(b_qx))$$

which returns real solutions to the DE.

$Q_k(x)$ may be found by substituting it in for $y$,

$$a_nQ_k^{(n)}(x)+a_{n-1}Q_k^{(n-1)}(x)+\dots+a_1Q_k'(x)+a_0Q_k(x)=P_k(x)$$

In your case, we have $P_1(x)=3x$ and

$$y'+2y=3x$$

We solve the auxiliary equation:

$$r+2=0\implies r=-2$$

Thus, we have

$$y=c_1e^{-2x}+Q_1(x)$$

$$Q_1(x)=d_1x+d_0$$

Substitute this into the original DE and we get

$$(d_1x+d_0)'+2(d_1x+d_0)=3x\implies Q_1(x)=\frac32x-\frac34$$

Thus,

$$y=c_1e^{-2x}+\frac32x-\frac34$$

Another example, this time involving trig functions as well:

$$y''-2y'+2y=x^2-2x$$

We solve the auxiliary equation:

$$r^2-2r+2=0\implies r=\frac{2\pm\sqrt{4-8}}2=1+i,1-i$$

Thus, we have

$$y=c_1e^{(1+i)x}+c_0e^{(1-i)x}+Q_2(x)$$

We may replace the complex exponential functions:

$$e^{(1+i)x}\to e^x(\cos(x)+i\sin(x))\\e^{(1-i)x}\to e^x(\cos(-x)+i\sin(-x))=e^x(\cos(x)-i\sin(x))$$

Adding things together and simplifying ($i$ is a constant, so it kinda gets absorbed in the coefficients), we get

$$y=c_1'e^x\cos(x)+c_0'e^x\sin(x)+Q_2(x)\\Q_2(x)=d_2x^2+d_1x+d_0$$

$$(d_2x^2+d_1x+d_0)''-2(d_2x^2+d_1x+d_0)'+2(d_2x^2+d_1x+d_0)=x^2-2x\\Q_2(x)=\frac12x^2-x+\frac34$$

Thus,

$$y=c_1'e^{(1+i)x}+c_0'e^{(1-i)x}+\frac12x^2-x+\frac34$$

where again, the coefficients are determined by the initial conditions.

• In the first part, isn't that only true if the auxiliary equation doesn't have repeated roots? For $d$ repeated roots $\lambda_{r}$, you then have powers of $x$ up to $d-1$ multiplied by $e^{\lambda_{r}x}$. – mrnovice Mar 20 '17 at 22:48
• @mrnovice For that, see here: en.wikipedia.org/wiki/… I'll add it. – Simply Beautiful Art Mar 20 '17 at 22:53
• I understand everything up to "Thus we have". Would you mind expanding/explaining the next step just a little further or putting it in simpler terms? – Ryan Mar 20 '17 at 23:02
• @Ryan It came from the second block of math at the top of my answer. – Simply Beautiful Art Mar 20 '17 at 23:04
• I guess the part I'm confused about is, why did you write $y = c_1 e^{r_1x} + Q_k(x)$ instead of $y = c_1 e^{r_1x} + c_0 e^{r_0x} + Q_k(x)$ like the equation calls for? – Ryan Mar 20 '17 at 23:12

Start with $\frac{dy}{dx} +2y = 3x$ Which is a differential equation of the form $\frac{dy}{dx} + P(x)\cdot y = Q(x)$, where $P(x), Q(x)$ are functions of x, in this case $P(x) =2$.

A method of solving this type of equation is multiplying the whole thing by $$R(x) = e^{\int P(x)dx} = e^{\int 2dx} = e^{2x}$$

So we have : $\frac{dy}{dx}\cdot e^{2x} +2y \cdot e^{2x} = 3x\cdot e^{2x}$

We can see that the left hand side is just like the result of a product rule when differentiating $ye^{2x}$ So the equation becomes : $$\frac{d}{dx} (y\cdot e^{2x}) = 3x\cdot e^{2x}$$ $$y\cdot e^{2x} = \int 3x e^{2x} dx$$

Then using integration by parts you get : $$\int 3x e^{2x} dx = \frac{3}{2}x e^{2x} - \frac{3}{4} e^{2x} +c_1$$ where $c_1$ is an arbitrary constant we always add at the end of integration when we don't have initial conditions or when the integral is not definite.

So we have : $$y\cdot e^{2x} = \frac{3}{2}x e^{2x} - \frac{3}{4} e^{2x} +c_1$$ Then dividing through by $e^{2x}$ : $$y = \frac{3}{2}x - \frac{3}{4} +c_1 \cdot e^{-2x}$$ (this is what wolfram alpha gave me as well, so I'm not sure how you got the -4).

• The $3/4$ at the end is indeed correct. – Simply Beautiful Art Mar 21 '17 at 0:16

The easiest way to see it is to complete the differential. Let $w(x) > 0$ be a differentiable function. Then,

\begin{align} w(x)\Big(y'(x) + 2 y(x)\Big) &= 3 x w(x)\\\\ w(x) y'(x) + 2 w(x) y(x) &= 3 x w(x)\\\\ \frac{d}{dx}\Big\{w(x) y(x)\Big\} - w'(x) y(x) + 2 w(x) y(x) &= 3 x w(x)\\\\ \frac{d}{dx}\Big\{w(x) y(x)\Big\} - y(x) \Big(w'(x) - 2 w(x)\Big) &= 3 x w(x) \end{align}

Now, if we could only loose the $y(x)$ term in the left side, we could integrate and solve the equation. But... wait! If $$w'(x) - 2 w(x) = 0,$$ then $$y(x) = \frac{3}{w(x)} \int x w(x) dx.$$ So, given that $w(x) > 0$, then \begin{align} \frac{w'(x)}{w(x)} &= 2\\\\ \frac{d}{dx} \log w(x) &= 2\\ \\ \log w(x) &= 2 x + c \\ \\ w(x) &= e^c e^{2 x}\\ \\ w(x) &= C e^{2 x} \end{align} where $C = e^c$ and $c$ is any real constant.

Finally, \begin{align} y(x) &= 3 e^{-2 x} \int x e^{2 x} dx \\ \\ &= 3 e^{-2 x} \left(\frac{x e^{2 x}}{2} - \frac{e^{2 x}}{4} + K_0 \right) \\ \\ &= K e^{-2 x} + \frac{3 x}{2} - \frac{3}{4} \end{align}

where $K = 3K_0$ is a constant of integration.

Your hunch was right, at least for this problem. Given that the ode is linear, and you don't have any specific conditions on $y(x)$, there is an infinite family of functions that satisfy the equation, just as there are an infinite number of primitives to an integrable function.

To solve a linear ode, we need to integrate it, hence the arbitrary constant and the infinite number of solutions.