# How can I solve this linear differential equation $y^{\prime\prime}-4y^{\prime}+3y=\frac{1}{1+e^{-x}}$?

My problem is to solve this linear differential equation: $$y^{\prime\prime}-4y^{\prime}+3y=\frac{1}{1+e^{-x}}$$

My approach was: i can see this must be an ordinary differential equation of second-order. If i let $y^{\prime} = z$ i would get:

$$z^{\prime}-4z+3y=\frac{1}{1+e^{-x}}$$ ... at this point i get a problem in substitute y. So i cannot use this method. Another try was:

$$3y=-y^{\prime\prime}+4y^{\prime}+\frac{1}{1+e^{-x}}$$

$$y=-\frac{y^{\prime\prime}}{3}+\frac{4y^{\prime}}{3}+\frac{\frac{1}{1+e^{-x}}}{3}$$ But this seems to lead me to nowhere.

Lets solve this problem using variation of parameters.

We are given:

$$y''-4y'+3y=\dfrac{1}{1+e^{-x}}$$

The associated homogeneous equation is $y'' - 4 y' + 3 y = 0$, which has a complementary solution of:

$$y_c = c_1 e^x + c_2 e^{3x}.$$

To find Green's function, we need the Wronskian of $(y_1(t), y_2(t))$ from the homogeneous solution, so we let $y_1 = c_1 e^t$ and $y_2 = c_2 e^{3t}$, thus we have:

$$\text{Wronskian} = W(t) = \text{Wronskian} (c_1 e^t, c_2 e^{3t}) = 2 c_1 c_2 e^{4 t}$$

To form Green's function, we have:

$$G(x, t) = \dfrac{y_1(t)y_2(x) - y_1(x)y_2(t)}{W(t)} = \dfrac{c_1e^t c_2e^{3x} - c_1e^x c_2e^{3t}}{2 c_1 c_2 e^{4 t}} = \dfrac{1}{2}\left(e^{-3t}e^{3x} - e^x e^{-t}\right)$$

For this problem, we have $f(t) = \dfrac{1}{1 + e^{-t}}$

To find the particular solution, we set up and solve:

$$y_p = \int G(x, t)f(t)dt = \int \dfrac{1}{2}\left(e^{-3t}e^{3x} - e^x e^{-t}\right)\left(\dfrac{1}{1 + e^{-t}}\right) dt$$

These two integrations yield:

$$\displaystyle y_p(x) = -\frac{e^x x}{2}+\frac{e^{2 x}}{2}-\frac{1}{2} e^{3 x} \ln(e^{-x}+1)+\frac{1}{2} e^x \ln(e^x+1) -\frac{1}{4}e^x$$

Of course, to form the final solution, we have:

$$\displaystyle y(x) = y_c + y_p = c_1 e^x+c_2 e^{3 x}-\frac{e^x x}{2}+\frac{e^{2 x}}{2}-\frac{1}{2} e^{3 x} \ln(e^{-x}+1)+\frac{1}{2} e^x \ln(e^x+1)-\frac{1}{4}e^x$$

Note: We can combine the $e^x$ terms into a single constant $\left(c_1 - \dfrac{1}{4}\right)e^x$ or just $c_1 e^x$, but I left it in this form so you can work it and duplicate the steps.

• @ToralfWestström: I did the entire solution using variation of parameters. It would be good to try it using reduction of order and undetermined coefficients. Regards – Amzoti Jun 25 '13 at 1:38
• Nice work, and always encouraging the OP to explore further! +1 – amWhy Jun 25 '13 at 2:31

First consider the homogeneous equation, $$y''-4y'+3y=0$$ The characteristic polynomial for this equation is $m^{2}-4m+3=(m-1)(m-3)$. Hence, the general solution to the homogeneous equation is $$y=Ae^{x}+Be^{3x}$$ for $A,B$ depending on initial conditions. This is the complementary solution.

Now to solve the inhomogeneous case, we need to find a particular integral of your equation - any solution to the equation which is not part of the complementary solution. There is no general method for obtaining these, and often the trick is to try adding together multiples of the right hand side, or its derivatives if these repeat or terminate. There doesn't seem to be a simple expression for the particular integral, and WolframAlpha gives $$y=\frac{1}{2}(-xe^{x}+e^{2x}-e^{3x}\log(1+e^{-x})+e^{x}\log(1+e^{x}))$$ For your general solution, simply add these two together! This is as much as I can tell you about solving these kinds of equations; hopefully there are more advanced methods which will produce the particular integral more readily.

This equation may be solved using Laplace transforms. Defining

$$Y(s) = \int_0^{\infty} dx \, y(x) \, e^{-s x}$$

The LT of $y'$ is $s Y(s) - y(0)$; that of $y''$ is $s^2 Y(s) - s y(0)-y'(0)$. You may then derive an equation for $Y(s)$:

$$Y(s) = \frac{y(0) s-(y'(0)-4 y(0))}{(s-3) (s-1)} + \frac{F(s)}{(s-3) (s-1)}$$

where

$$F(s) = \sum_{n=0}^{\infty} \frac{(-1)^n}{n+s}$$

is the LT of the RHS. The inverse LT $y(x)$ is found using the residue theorem - the ILT is the sum of the residues of the poles of $Y(s) e^{s x}$. Because the poles are all simple, we may write the ILT as

$$f(x) = \left ( \frac{3}{2} y(0) - \frac12 y'(0) + \log{2}\right) e^x + \left (\frac{y'(0)}{2} - \frac{y(0)}{2} + \log{2} - \frac12 \right ) e^{3 x} + \\\sum_{k=0}^{\infty} (-1)^k \frac{e^{-k x}}{(k+1) (k+3)}$$

The sum is straightforward when you use a partial fraction decomposition and remember the Maclurin series for $\log{(1+z)}$. I get

$$\sum_{k=0}^{\infty} (-1)^k \frac{e^{-k x}}{(k+1) (k+3)} = \frac12 e^{2 x} - \frac14 e^x - \frac12 e^x (e^{2 x}-1) \, \log{(1+e^{-x})}$$

• Nice alternative. I always forget the LT. – Julien Jun 25 '13 at 2:31
• @julien: we complement each other. I only remember the LT and forget every other alternative. – Ron Gordon Jun 25 '13 at 2:33

Possible methods:

(1) Variation of parameters

(2) Reduction of order

(3) Undetermined coefficients (after expanding $1/(1+e^{-x})$ in a series in powers of $e^{-x}$).